Program Structure

Expressions

frame (that is, .CALLINFO specified FRAME > 8191) or .CALLINFO specified .ALLOCA_FRAME. In those two cases, %previous_sp is the same as %r3, and %r3 is set up by the .ENTER pseudo-operation.

Expressions

Arithmetic expressions are often valuable in writing assembly code. The Assembler allows expressions involving integer constants, symbolic constants, and symbolic addresses. These terms can be combined with the standard arithmetic operators shown in “Standard Arithmetic Operators” on page 29 or with bit-wise operators shown in “Bit-Wise

 

Operators” on page 29.

 

Table 2-8

Standard Arithmetic Operators

 

 

 

 

Operator

Operation

+Integer addition

-Integer subtraction

*Integer multiplication

/Integer division (result is truncated)

The multiplication and division operators have precedence over addition and subtraction. That is, multiplications and divisions are performed first from left to right, then additions and subtractions are performed from left to right. Therefore, the expression 2+3*4 evaluates to 14.

Table 2-9

Bit-Wise Operators

 

 

 

 

Operator

Operation

 

 

 

 

Logical OR

 

 

 

 

&

Logical AND

 

 

 

 

~

Unary logical complement (tilde)

 

 

 

Chapter 2

29