Form PC-relative address adds an immediate value to the PC value to form a PC-relative address, and writes the result to the destination register.
This instruction is used by the alias SUB (immediate, from PC).
This instruction is used by the pseudo-instruction ADD (immediate, to PC).
It has encodings from the following instruction sets: A32 ( A1 and A2 ) and T32 ( T1 , T2 and T3 ) .
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
!= 1111 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | Rd | imm12 | |||||||||||||||||
cond |
d = UInt(Rd); imm32 = A32ExpandImm(imm12); add = TRUE;
31 | 30 | 29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
!= 1111 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | Rd | imm12 | |||||||||||||||||
cond |
d = UInt(Rd); imm32 = A32ExpandImm(imm12); add = FALSE;
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 0 | 1 | 0 | 0 | Rd | imm8 |
d = UInt(Rd); imm32 = ZeroExtend(imm8:'00', 32); add = TRUE;
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | i | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 0 | imm3 | Rd | imm8 |
d = UInt(Rd); imm32 = ZeroExtend(i:imm3:imm8, 32); add = FALSE; if d == 15 then UNPREDICTABLE; // ARMv8-A removes UNPREDICTABLE for R13
15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 | 15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0 |
1 | 1 | 1 | 1 | 0 | i | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | imm3 | Rd | imm8 |
d = UInt(Rd); imm32 = ZeroExtend(i:imm3:imm8, 32); add = TRUE; if d == 15 then UNPREDICTABLE; // ARMv8-A removes UNPREDICTABLE for R13
For more information about the constrained unpredictable behavior, see Architectural Constraints on UNPREDICTABLE behaviors.
<c> |
<q> |
The instruction aliases permit the addition or subtraction of the offset and the immediate offset to be specified separately, including permitting a subtraction of 0 that cannot be specified using the normal syntax. For more information, see Use of labels in UAL instruction syntax.
Alias | Of variant | Is preferred when |
---|---|---|
ADD (immediate, to PC) | Never | |
SUB (immediate, from PC) | T2 | i:imm3:imm8 == '000000000000' |
SUB (immediate, from PC) | A2 | imm12 == '000000000000' |
if ConditionPassed() then EncodingSpecificOperations(); result = if add then (Align(PC,4) + imm32) else (Align(PC,4) - imm32); if d == 15 then // Can only occur for A32 encodings ALUWritePC(result); else R[d] = result;
Internal version only: isa v00_81, pseudocode v34.2.2 ; Build timestamp: 2018-03-28T20:43
Copyright © 2010-2018 ARM Limited or its affiliates. All rights reserved. This document is Non-Confidential.