subp
Subtract Pointers
SUBP <Xd>, <Xn|SP>, <Xm|SP>
Subtracts pointers ignoring Tags.
Pseudocode Operation
Xd ← (Xn | SP)[55:0] - (Xm | SP)[55:0]
Example
SUBP x0, x1, x2
Encoding
Binary Layout
1
31
0
30
0
29
11010110
28:21
Xm
20:16
000000
15:10
Xn
9:5
Xd
4:0
Operands
-
Xd
Destination 64-bit integer register -
Xn
Ptr 1 -
Xm
Ptr 2
Related
More in MTE (Memory Tagging)
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x9AC00000 | SUBP <Xd>, <Xn|SP>, <Xm|SP> | A64 | 1 | 0 | 0 | 11010110 | Xm | 000000 | Xn | Xd |
Description
Subtract Pointer subtracts the 56-bit address held in the second source register from the 56-bit address held in the first source register, sign-extends the result to 64-bits, and writes the result to the destination register.
Operation
bits(64) operand1 = if n == 31 then SP[] else X[n, 64]; bits(64) operand2 = if m == 31 then SP[] else X[m, 64]; operand1 = SignExtend(operand1<55:0>, 64); operand2 = SignExtend(operand2<55:0>, 64); bits(64) result; operand2 = NOT(operand2); (result, -) = AddWithCarry(operand1, operand2, '1'); X[d, 64] = result;