subps
Subtract Pointers, Setting Flags
SUBPS <Xd>, <Xn|SP>, <Xm|SP>
Subtracts pointers (ignoring tags) and sets condition flags.
Pseudocode Operation
Xd ← Xn - Xm
// Flags affected: N, Z, C, V
Example
SUBPS x0, x1, x2
Encoding
Binary Layout
1
31
0
30
1
29
11010110
28:21
Xm
20:16
000000
15:10
Xn
9:5
Xd
4:0
Operands
-
Xd
Destination 64-bit integer register -
Xn
Addr 1 -
Xm
Addr 2
Related
More in MTE (Memory Tagging)
Reference
View in Arm A64 ISA Reference ↗
Arm A64 ISA
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0xBAC00000 | SUBPS <Xd>, <Xn|SP>, <Xm|SP> | A64 | 1 | 0 | 1 | 11010110 | Xm | 000000 | Xn | Xd |
Description
Subtract Pointer, setting Flags 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. It updates the condition flags based on the result of the subtraction.
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; bits(4) nzcv; operand2 = NOT(operand2); (result, nzcv) = AddWithCarry(operand1, operand2, '1'); PSTATE.<N,Z,C,V> = nzcv; X[d, 64] = result;