12.14 Numeric expressions

Numeric expressions consist of combinations of numeric constants, numeric variables, ordinary numeric literals, binary operators, and parentheses.

Numeric expressions can contain register-relative or program-relative expressions if the overall expression evaluates to a value that does not include a register or the PC.

Numeric expressions evaluate to 32-bit integers in A32 and T32 code. You can interpret them as unsigned numbers in the range 0 to 232-1, or signed numbers in the range -231 to 231-1. However, armasm makes no distinction between -n and 232-n. Relational operators such as >= use the unsigned interpretation. This means that 0 > -1 is {FALSE}.

In A64 code, numeric expressions evaluate to 64-bit integers. You can interpret them as unsigned numbers in the range 0 to 264-1, or signed numbers in the range -263 to 263-1. However, armasm makes no distinction between -n and 264-n.

Note:

armasm does not support 64-bit arithmetic variables. See 21.63 SETA, SETL, and SETS (Restrictions) for a workaround.

ARM recommends that you only use armasm for legacy ARM® syntax assembly code, and that you use the armclang assembler and GNU syntax for all new assembly files.

Example

a   SETA    256*256           ; 256*256 is a numeric expression
    MOV     r1,#(a*22)        ; (a*22) is a numeric expression
Non-ConfidentialPDF file icon PDF versionARM 100069_0608_00_en
Copyright © 2014–2017 ARM Limited or its affiliates. All rights reserved.