subpt
Subtract Checked Pointer
SUBPT <Xd|SP>, <Xn|SP>, <Xm>{, LSL #<amount>}
Subtracts offset from pointer with tag check (Checked Pointer Arithmetic).
Pseudocode Operation
No pseudocode available.
Encoding
Binary Layout
1
31
1
30
0
29
11010000
28:21
Rm
20:16
001
15:13
imm3
12:10
Rn
9:5
Rd
4:0
Operands
-
Xd
Dest -
Xn
Ptr -
Xm
Offset
Related
More in FEAT_CPA (v9.5)
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xDA002000 | SUBPT <Xd|SP>, <Xn|SP>, <Xm>{, LSL #<amount>} | A64 | 1 | 1 | 0 | 11010000 | Rm | 001 | imm3 | Rn | Rd | ||
| 0x04C50000 | SUBPT <Zdn>.D, <Pg>/M, <Zdn>.D, <Zm>.D | A64 | 00000100 | 1 | 1 | 000 | 10 | 1 | 000 | Pg | Zm | Zdn | ||
| 0x04E00C00 | SUBPT <Zd>.D, <Zn>.D, <Zm>.D | A64 | 00000100 | 1 | 1 | 1 | Zm | 000 | 01 | 1 | Zn | Zd |
Description
Subtract checked pointer subtracts an optionally-shifted register value from a base address register value, and writes the result to the destination register. The optionally-shifted register value is treated as the offset. If the operation would have generated a result where the most significant 8 bits of the result register differ from the most significant 8 bits of the base register, then the result is modified such that it is likely to be non-canonical when used as an address.
Operation
bits(64) result;
bits(64) base = if n == 31 then SP[] else X[n, 64];
bits(64) offset = LSL(X[m, 64], shift);
result = base - offset;
result = PointerAddCheck(result, base);
if d == 31 then
SP[] = result;
else
X[d, 64] = result;