ori
OR Immediate - 60 00 00 00
ori
Instruction Syntax
Mnemonic | Format | Flags |
ori | rA,rS,UIMM | None |
Instruction Encoding
0
1
1
0
0
0
S
S
S
S
S
A
A
A
A
A
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
I
Field | Bits | Description |
Primary Opcode | 0-5 | 011000 (0x18) |
rS | 6-10 | Source register |
rA | 11-15 | Destination register |
UIMM | 16-31 | Unsigned immediate value |
Operation
rA ← (rS) | UIMM
The logical OR of (rS) and the zero-extended UIMM is placed into rA.
Note: The ori instruction performs a logical OR operation between the source register and a 16-bit unsigned immediate value.
Affected Registers
General Purpose Registers (GPRs)
- rA (Destination register)
Examples
Basic OR Immediate
ori r3, r1, 0x00FF # r3 = r1 OR 0x000000FF ori r4, r2, 0x8000 # r4 = r2 OR 0x00008000
Bit Setting
# Set specific bits in r1 ori r1, r1, 0x0001 # Set bit 0 ori r1, r1, 0x0080 # Set bit 7
Address Construction
# Load upper 16 bits of address lis r3, 0x8000 # Load upper 16 bits ori r3, r3, 0x1234 # Add lower 16 bits # r3 now contains 0x80001234