SH3ADD

Shift Left 3 and Add

SH3ADD rd, rs1, rs2

Shifts rs1 left by 3 and adds rs2. Used for calculating addresses of 64-bit elements.

Details

SH3ADD shifts rs1 left by 3 bits, then adds to rs2, writing to rd. Used for stride-8 array indexing (e.g., int64 arrays).

Pseudocode Operation

R[rd] = R[rs2] + (R[rs1] << 3);

Example

SH3ADD x10, x11, x12

Encoding

Binary Layout
0010000
31:25
rs2
24:20
rs1
19:15
110
14:12
rd
11:7
0110011
6:0
 
Format R-Type
Opcode 0x33
Extension Zba

Operands

  • rd
    Destination register (integer)
  • rs1
    Index
  • rs2
    Base