SH1ADD

Shift Left 1 and Add

SH1ADD rd, rs1, rs2

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

Details

SH1ADD shifts rs1 left by 1 bit, then adds the result to rs2, writing to rd. Used for stride-1 array indexing (byte element + base).

Pseudocode Operation

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

Example

SH1ADD x10, x11, x12

Encoding

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

Operands

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