Condition codes for ARM directives

Source: Internet
Author: User

1. Conditional flag bit for program status register

The B31 bit value of the result of the N operation. For signed twos complement, the result is negative when n=1, the result is positive or 0 o'clock n=0;

The result of the Z command is 0 o'clock Z=1, otherwise z=0;

C uses addition operations (including CMN directives), B31 bits produce c=1 when rounding, otherwise c=0. With subtraction operations (including CMP), the B31 bit generates borrow when c=0, otherwise c=1. For non-addition/subtraction instructions combined with the shift operation, C is the last b31 of the bit, and the other instruction C is usually the same;

V uses the addition/subtraction operation, v=1 when there is a sign overflow, otherwise v=0, the other instruction V is usually the same.

2. Each arm instruction contains a 4-bit condition code

Operation code Condition Code mnemonics Sign Meaning
0000 EQ Z=1 Equal
0001 NE (not Equal) Z=0 Not equal
0010 CS/HS (Carry Set/high or Same) C=1 Unsigned number greater than or equal to
0011 Cc/lo (Carry clear/lower) C=0 Unsigned number less than
0100 MI (minus) N=1 Negative
0101 PL (PLus) N=0 Positive or 0
0110 VS (OVerflow Set) V=1 Overflow
0111 VC (OVerflow Clear) V=0 No overflow

1000

HI (High) C=1,z=0

Unsigned number greater than

1001 LS (Lower or Same) C=0,z=1 Unsigned number less than or equal to
1010 GE (Greater or Equal) N=v Signed number is greater than or equal to
1011 LT (less Than) N!=v Signed number is less than
1100 GT (Greater Than) Z=0,n=v Signed number is greater than
1101 LE (less or Equal) Z=1,n!=v Signed number is less than or equal to
1110 AL Any Unconditional Execution (default)
1111 NV Any Never Execute

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.