setf16
Set Flags 16-bit
SETF16 <Wn>
Sets PSTATE flags based on 16-bit operand.
Details
Sets PSTATE condition flags (N, Z, C, V) based on the lower 16 bits of the 32-bit source register Wn, interpreting them as a signed 16-bit value. AArch64-only; requires FEAT_FlagM. N is set if bit 15 of Wn is set; Z is set if the lower 16 bits are zero; C and V are cleared.
Pseudocode Operation
val16 ← Wn<15:0>; N ← val16<15>; Z ← (val16 == 0); C ← 0; V ← 0;
Example
SETF16 w1
Encoding
Binary Layout
0
0
1
11010000
000000
1
0010
Rn
0
1101
Operands
-
Wn
First source / base 32-bit integer register
Reference (Arm A64 ISA)
Instruction Forms
| Encoding | Instruction | ISA | Bit pattern | ||
|---|---|---|---|---|---|
| 0x3A00480D | SETF16 <Wn> | A64 | 0 | 0 | 1 | 11010000 | 000000 | 1 | 0010 | Rn | 0 | 1101 |
Description
Set the PSTATE.NZV flags based on the value in the specified general-purpose register. SETF8 treats the value as an 8 bit value, and SETF16 treats the value as an 16 bit value.
The PSTATE.C flag is not affected by these instructions.
Operation
bits(32) tmpreg = X[n, 32]; PSTATE.N = tmpreg<msb>; PSTATE.Z = if (tmpreg<msb:0> == Zeros(msb + 1)) then '1' else '0'; PSTATE.V = tmpreg<msb+1> EOR tmpreg<msb>; //PSTATE.C unchanged;