or
or
rd, rs1, rs2
rd = rs1 | rs2
R
31–25funct7
24–20rs2
19–15rs1
14–12funct3
11–7rd
6–0opcode
I
31–20imm[11:0]
19–15rs1
14–12funct3
11–7rd
6–0opcode
S
31–25imm[11:5]
24–20rs2
19–15rs1
14–12funct3
11–7imm[4:0]
6–0opcode
B
31–25imm[12,10:5]
24–20rs2
19–15rs1
14–12funct3
11–7imm[4:1,11]
6–0opcode
U
31–12imm[31:12]
11–7rd
6–0opcode
J
31–12imm[20,10:1,11,19:12]
11–7rd
6–0opcode

or is a bitwise instruction, meaning it works on each of a register's 32 individual bits separately rather than on the number as a whole (the and page introduces this idea in full). Where AND was strict, OR is generous: at each bit position, the result is 1 if *either* input bit is 1 — or both. Only when both inputs are 0 is the result 0. or rd, rs1, rs2 applies that across all 32 positions of rs1 and rs2 and writes the result to rd.

If AND is the tool for clearing bits, OR is the tool for setting them. Its signature use is turning a specific bit on while leaving every other bit exactly as it was: OR a value against a mask that has a 1 only in the position you care about, and that position becomes 1 while the rest are untouched. Settings and flags packed into a single register are switched on this way.

The other classic use is merging. If you shift two separate values into bit positions that do not overlap, a single OR welds them together into one packed register — the way separate red, green, and blue values combine into one color.

One limit worth noting: OR can only ever set bits to 1, never back to 0. To clear a bit you need AND with a mask, and to flip one you need XOR. For setting bits from a fixed constant rather than a register, there is a sibling instruction, ori.