cset

Conditional Set

CSET <Wd>, <cond>

Sets register to 1 if condition true, else 0. (Alias for CSINC)

Details

Sets the destination register to 1 if the condition code is true, otherwise sets it to 0. This is an alias for CSINC (Conditional Select Increment) with both source registers set to WZR. Condition flags (N, Z, C, V) are not affected. Executes in AArch64 state only.

Pseudocode Operation

if ConditionHolds(cond) then
  Wd ← 1
else
  Wd ← 0

Example

CSET w0, cond

Encoding

Binary Layout
0
0
0
11010100
11111
cond
0
1
11111
Rd
 
Format Cond Select
Opcode 0x1A9F07E0
Extension Base

Operands

  • Wd
    Destination 32-bit integer register
  • cond
    Condition

Reference (Arm A64 ISA)

Instruction Forms

Encoding Instruction ISA Bit pattern
0x1A9F07E0 CSET <Wd>, <invcond> A64 0 | 0 | 0 | 11010100 | 11111 | cond | 0 | 1 | 11111 | Rd
0x9A9F07E0 CSET <Xd>, <invcond> A64 1 | 0 | 0 | 11010100 | 11111 | cond | 0 | 1 | 11111 | Rd

Description

Conditional Set sets the destination register to 1 if the condition is TRUE, and otherwise sets it to 0.