Page 100 - ARM 64 Bit Assembly Language
P. 100

86 Chapter 4

                  4.1.3 Immediate data

                  There are two types of immediate values: 12 bit unsigned immediate, with a range of
                  [0, 4095], and 13 bit pattern immediate. The first immediate is used for every instruction type
                  that is not a logical instruction. Logical instructions use pattern immediates, which were in-
                  troduced in Table 3.3. When choosing a pattern immediate, only values that can be specially
                  encoded in the thirteen bits are valid. When choosing a pattern immediate value, a bit pattern
                  of consecutive one’s must be used. This pattern is then repeated either 1, 2, 4, 8, 16, or 32
                  times across the register, and it may also be rotated. For example, the immediate 5 would not
                  work because its binary representation, 0b101, is not a consecutive pattern of ones. A con-
                  secutive pattern of 0b10101010101010101010101010101010 (hexadecimal: 0xaaaaaaaa)
                  would work for a 32-bit Wn. An immediate value of 7 is valid because its binary representa-
                  tion, 0b111, is three ones in a row. Furthermore, 7 can be rotated to create 0x700,which is
                  also valid.



                  4.2 Data processing instructions

                  The following instructions use the ALU to perform arithmetic and logical operations. Most
                  of them require two source operands, and one destination register. However there are some
                  exceptions. For example, the instruction for calculating the two’s complement only requires
                  one source operand, and the comparison operations do not require a destination register. Most
                  of these instructions have an optional s modifier, which allows the programmer to choose
                  whether or not the instruction will affect the flags in the PSTATE register.



                  4.2.1 Arithmetic operations


                  There are six basic arithmetic operations:
                  add     Add,
                  adc     Add with Carry,
                  sub     Subtract,
                  sbc     Subtract with Carry,
                  neg     Negate, and
                  ngc     Negate with Carry.
                  All of the non-carry instructions involve two source operands, and a destination register. The
                  carry instructions may only use unshifted, unextended registers as the operands.
   95   96   97   98   99   100   101   102   103   104   105