notpseudo

not

pseudo
RISC-V Assembly Reference

lyszt.net covers not and other RISC-V instructions in more detail.

Description

Writes the bitwise complement of a register value. In not rd, rs, every bit of the value in rs is flipped and written to rd, so each 0 becomes 1 and each 1 becomes 0. The assembler expands it to xori rd, rs, -1.

Expands to

xori rd, rs, -1

The assembler replaces this pseudo-instruction with the real instruction or instructions listed above.

Official definition

RISC-V Instruction Set Manual

ANDI, ORI, XORI are logical operations that perform bitwise AND, OR, and XOR on register rs1 and the sign-extended 12-bit immediate and place the result in rd. Note, XORI rd, rs1, -1 performs a bitwise logical inversion of register rs1 (assembler pseudoinstruction NOT rd, rs).