2.6.5.1.5 Multiword Arithmetic Examples
The following example shows two instructions that add a 64-bit integer contained in R2 and R3 to another 64-bit integer contained in R0 and R1, and place the result in R4 and R5.
- Example 4: 64-bit
addition
ADDS R4, R0, R2 ; add the least significant words ADC R5, R1, R3 ; add the most significant words with carry
Multiword values do not have to use consecutive registers. The following example shows instructions that subtract a 96-bit integer contained in R9, R1, and R11 from another contained in R6, R2, and R8. The example stores the result in R6, R9, and R2.
- Example 5: 96-bit
subtraction
SUBS R6, R6, R9 ; subtract the least significant words SBCS R9, R2, R1 ; subtract the middle words with carry SBC R2, R8, R11 ; subtract the most significant words with carry