Webcentive RISC-V Reference

bclri

Single-Bit clear (Immediate)

Extension
Zbs
XLEN
RV32 and RV64
Assembly (riscv-unified-db)
bclri xd, xs1, shamt
Length
32-bit

Encoding

RV64 form

31262520191514121176210
010010shamtrs1001rd0010011

Match 0x48001013, mask 0xfc00707f. Source: bclri rd rs1 31..26=0x12 shamtd 14..12=1 6..2=0x04 1..0=3 in riscv-opcodes/extensions/rv64_zbs.

FieldBitsriscv-opcodes name
shamt25:20shamtd
rs119:15rs1
rd11:7rd

RV32 form; listed in riscv-opcodes as a pseudo-op of bclri

31252420191514121176210
0100100shamtrs1001rd0010011

Match 0x48001013, mask 0xfe00707f. Source: $pseudo_op rv64_zbs::bclri bclri.rv32 rd rs1 31..25=0x24 shamtw 14..12=1 6..2=0x04 1..0=3 in riscv-opcodes/extensions/rv32_zbs.

FieldBitsriscv-opcodes name
shamt24:20shamtw
rs119:15rs1
rd11:7rd

Description

Returns xs1 with a single bit cleared at the index specified in shamt. The index is read from the lower log2(XLEN) bits of shamt. For RV32, the encodings corresponding to shamt[5]=1 are reserved.

Description from riscv-unified-db, reformatted.

Operation

XReg index = shamt & (xlen() - 1);
X[xd] = X[xs1] & ~(1 << index);

Pseudocode in riscv-unified-db’s IDL, quoted unchanged.

Specification and related pages