Sub instruction and affected flags on x86
Since documentation doesn't really describe how the flags are affected, I couldn't figure out what's the difference between carry and signed flag during sub instruction, it seems like whenever a < b in sub a, b
both carry and signed flags will be set. Is there a case where signed flag will be set without carry (or vice versa) during sub instruction ?
Is there a case where signed flag will be set without carry (or vice versa) during sub instruction ?
Sure:
mov al,0xFE
sub al,2
The result is 0xFC, which when viewed as signed 8-bit is -4. So the SF will be set, buf CF will be clear (carry can be viewed as "unsigned less than", and 0xFE is obviously not unsigned less than 2).
链接地址: http://www.djcxy.com/p/85930.html上一篇: 英特尔Broadwell处理器经历的重大FMA性能异常
下一篇: Sub指令和受影响的x86标志