setf8

Set Flags 8-bit

SETF8 <Wn>

Sets PSTATE flags based on 8-bit operand.

Details

Sets PSTATE condition flags (N, Z, C, V) based on the lower 8 bits of the 32-bit source register Wn, interpreting them as a signed 8-bit value. AArch64-only; requires FEAT_FlagM. N is set if bit 7 of Wn is set; Z is set if the lower 8 bits are zero; C and V are cleared.

Pseudocode Operation

val8 ← Wn<7:0>; N ← val8<7>; Z ← (val8 == 0); C ← 0; V ← 0;

Example

SETF8 w1

Encoding

Binary Layout
0
0
1
11010000
000000
0
0010
Rn
0
1101
 
Format System
Opcode 0x3A00080D
Extension FEAT_FlagM

Operands

  • Wn
    First source / base 32-bit integer register

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x3A00080D SETF8 <Wn> A64 0 | 0 | 1 | 11010000 | 000000 | 0 | 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;