SEXT.B

Sign Extend Byte

SEXT.B rd, rs1

Sign-extends the lowest byte (8 bits) to XLEN bits.

Encoding

Binary Layout
0110000
31:25
00100
24:20
rs1
19:15
001
14:12
rd
11:7
0010011
6:0
 
Format I-Type
Opcode 0x60401013
Extension Zbb

Operands

  • rd
    Destination register (integer)
  • rs1
    Source

Example

SEXT.B x10, x11

// Sign extend 8-bit value.

Related

Across architectures

Sign Extend Byte : how x86, ARM, RISC-V, and PowerISA each do this.

More in Zbb

Description

SEXT.B sign-extends the least-significant byte of rs1 to XLEN bits.

Operation

R[rd] = sext(R[rs1][7:0]);