or
OR - 7C 00 00 78
or

Instruction Syntax

Mnemonic Format Flags
or rA,rS,rB Rc = 0
or. rA,rS,rB Rc = 1

Instruction Encoding

0
1
1
1
1
1
S
S
S
S
S
A
A
A
A
A
B
B
B
B
B
0
0
0
0
0
0
0
0
0
Rc

Field Bits Description
Primary Opcode 0-5 011111 (0x1F)
rS 6-10 Source register
rA 11-15 Destination register
rB 16-20 Source register
Reserved 21-29 000000000
Rc 30-31 Record Condition Register

Operation

rA ← (rS) | (rB)

The logical OR of (rS) and (rB) is placed into rA.

Note: The or instruction performs a logical OR operation on the source operands.

Affected Registers

Condition Register (CR0 field)

(if Rc = 1)

Note: CR0 field reflects the result of the logical operation.

Examples

Basic OR Operation

or r3, r1, r2     # r3 = r1 OR r2
or. r3, r1, r2    # Same as above, but also sets condition register

Bit Setting

# Set specific bits in r1 using a mask in r2
or r1, r1, r2     # r1 = r1 OR r2 (set bits that are 1 in r2)

Register Copy

# Copy r1 to r2 using OR with zero
li r3, 0          # Load immediate 0
or r2, r1, r3     # r2 = r1 OR 0 = r1

Related Instructions

ori, oris, and, xor, nor

Back to Index