您的位置:首页 > 其它

ARM指令中标志位的定义

2014-08-08 07:19 204 查看
C flag:For a subtraction, including the comparison instruction CMP, C is set to 0 if the subtraction produced a borrow (that is, an unsigned underflow), and to 1 otherwise.

Z flag: Is set to 1 if the result of the instruction is zero (which often indicates an equal result from

a comparison), and to 0 otherwise.

In either case, the new condition code flags (after the instruction has been executed) usually mean:

N Is set to bit 31 of the result of the instruction. If this result is regarded as a two's complement

signed integer, then N = 1 if the result is negative and N = 0 if it is positive or zero.

Z Is set to 1 if the result of the instruction is zero (which often indicates an equal result from

a comparison), and to 0 otherwise.

C Is set in one of four ways:

• For an addition, including the comparison instruction CMN, C is set to 1 if the addition

produced a carry (that is, an unsigned overflow), and to 0 otherwise.

• For a subtraction, including the comparison instruction CMP, C is set to 0 if the

subtraction produced a borrow (that is, an unsigned underflow), and to 1 otherwise.

• For non-addition/subtractions that incorporate a shift operation, C is set to the last bit

shifted out of the value by the shifter.

• For other non-addition/subtractions, C is normally left unchanged (but see the

individual instruction descriptions for any special cases).

V Is set in one of two ways:

• For an addition or subtraction, V is set to 1 if signed overflow occurred, regarding the

operands and result as two's complement signed integers.

• For non-addition/subtractions, V is normally left unchanged (but see the individual

instruction descriptions for any special cases).

http://blog.csdn.net/shansan/article/details/3137216
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: