NEG
Negate
NEG rd, rs
Computes the two's complement negation (arithmetic negative).
Details
NEG negates rs1 and writes to rd. It is a pseudoinstruction for SUB rd, x0, rs1.
Pseudocode Operation
R[rd] = 0 - R[rs];
Example
NEG x5, x6
Encoding
Binary Layout
0100000
31:25
rs2
24:20
00000
19:15
000
14:12
rd
11:7
0110011
6:0
Operands
-
rd
Destination register (integer) -
rs
Source