AMOMAX.W

Atomic Max Word

AMOMAX.W rd, rs2, (rs1)

Atomically updates memory with the maximum of the memory value and register value (Signed).

Details

AMOMAX.W atomically loads a word, writes the signed maximum of the loaded value and rs2 back to memory, and returns the original value in rd.

Pseudocode Operation

temp = M[R[rs1]]; M[R[rs1]] = max(temp, R[rs2]); R[rd] = temp;

Example

AMOMAX.W x10, x11, (x12)

Encoding

Binary Layout
10100
31:27
aq
26
rl
25
rs2
24:20
rs1
19:15
010
14:12
rd
11:7
0101111
6:0
 
Format R-Type (Atomic)
Opcode 0x2F
Extension A

Operands

  • rd
    Dest (Old Value)
  • rs2
    Operand
  • rs1
    Address