Home/Instructions/Bit Clear
BCLR

RISC-V BCLR Instruction Details

Instruction ManualR-type

Clear single bit by register index

Instruction Syntax

bclr rd, rs1, rs2
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
BZbsBit ManipulationSingle-Bit Operation

Instruction Encoding

31..25
funct7
24..20
rs2
19..15
rs1
14..12
funct3
11..7
rd
6..0
opcode

BCLR uses opcode 0110011 (0x33), funct3 001, funct7 0100100. The rs1 and rs2 fields select the two source registers, and rd selects the destination register.

Format: R-type
opcode: 0110011 (0x33)
funct3: 001 (0x1)
funct7: 0100100 (0x24)

Instruction Behavior

bclr is a Zbs single-bit clear instruction. The bit index comes from the low log2(XLEN) bits of rs2.

Quick Understanding & Search Notes

bclr is a Zbs single-bit clear instruction. The bit index comes from the low log2(XLEN) bits of rs2.

These instructions are part of a B-extension subset and operate on XLEN-wide integer register values.
The register-index form uses only the low log2(XLEN) bits of rs2 to select the bit.
bclr changes one selected bit and leaves the other bits from rs1 unchanged.

Common Usage Scenarios

Bit Operations & Masks

Understand this scenario with real code like «bclr x10, x11, x12 ; x10 = x11 & ~(1 << (x12 & (XLEN-1)))».

Register Operations

Understand this scenario with real code like «bclr x10, x11, x12 ; x10 = x11 & ~(1 << (x12 & (XLEN-1)))».

Resource Management

Understand this scenario with real code like «bclr x10, x11, x12 ; x10 = x11 & ~(1 << (x12 & (XLEN-1)))».

Pre-Use Checklist

Syntax Check
  • Confirm the current instruction format is R-type.
  • Confirm the operand order matches the example.
Semantic Check
  • Ensure the destination register usage is compatible with the calling convention.
  • Confirm this is not the lower-level form of a pseudo-instruction expansion.

Pitfalls / Common Confusions

The register-index form uses only the low log2(XLEN) bits of rs2 to select the bit.
bclr changes one selected bit and leaves the other bits from rs1 unchanged.

FAQ

Does bclr access memory?

No. It reads integer register operands and writes rd only.

How is the bit index selected for bclr?

The low log2(XLEN) bits of rs2 select the bit, so higher bits do not extend the index range.