SH3ADD

Shift Left 3 and Add

SH3ADD rd, rs1, rs2

Computes rd = rs2 + (rs1 << 3); scales an index by 8 for 64-bit elements.

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 0x20006033
Extension Zba

Operands

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

Example

SH3ADD x10, x11, x12

// Calculate address: x12 + (x11 * 8).

Related

More in Zba

Description

SH3ADD shifts rs1 left by 3 bits and adds the result to rs2, writing the sum to rd: rd = rs2 + (rs1 << 3). With rs1 an element index and rs2 a base address it computes the address of element rs1 of an array of 64-bit elements.

Operation

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