ORC.B

RISC-V ORC.B Instruction Details

Instruction ManualR-type

Bitwise OR-combine, byte granule

Instruction Syntax

orc.b rd, rs1
Operand Breakdown
Destination rd: register receiving the operation result.
Source rs1: register holding the first operand.
Source rs2: register holding the second operand.
BZbbBit ManipulationInteger Operation

Instruction Behavior

Byte-granule OR-combine: for each byte of rs, if any bit is set, that byte in rd becomes all-ones, else all-zeros. Used in string processing (strlen/strcpy) to detect zero bytes. Part of Zbb.

Quick Understanding & Search Notes

ORC.B is a B/Zbb instruction for byte-wise OR-combine. This page is checked against the official B extension semantics, with emphasis on XLEN, W suffixes, .uw suffixes, and bitwise or rotate boundaries.

Each byte independently becomes all zeros or all ones, which is useful for zero-byte detection.
It does not reorder bytes and is not ordinary OR; the result only records whether any bit in that byte was set.

Common Usage Scenarios

Bit Operations & Masks

Understand this scenario with real code like «orc.b x10, x11 ; for each byte: all-1s if any bit set, else 0».

Comparison & Detection

Understand this scenario with real code like «orc.b x10, x11 ; for each byte: all-1s if any bit set, else 0».

Network & Byte Order

Understand this scenario with real code like «orc.b x10, x11 ; for each byte: all-1s if any bit set, else 0».

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

Each byte is processed independently

FAQ

Does ORC.B access memory?

No. It only reads and writes integer registers; any memory access must be performed by a separate load or store instruction.

What is the result width of ORC.B?

Except that W-suffixed forms produce a 32-bit result then sign-extend and .uw forms first extract a 32-bit unsigned operand, the result is written to rd at XLEN width.