FSGNJN.S
Float Sign Injection Negate (Single)
FSGNJN.S rd, rs1, rs2
Injects the *negated* sign of rs2 into rs1. Used for negation and absolute value.
Encoding
Binary Layout
0010000
31:25
rs2
24:20
rs1
19:15
001
14:12
rd
11:7
1010011
6:0
Operands
-
rd
Destination register (integer) -
rs1
Source (Body) -
rs2
Source (Sign)
Example
FSGNJN.S f1, f2, f2
// Negates f2 (f1 = -f2).
Related
More in F
Reference
View in RISC-V Unprivileged ISA Specification ↗
RISC-V ISA Manual
Description
Produces a result with the magnitude of rs1 and the sign bit taken from the source rs2. Used to implement floating-point absolute value, negate, and copy-sign.
Operation
F[rd] = {~F[rs2][31], F[rs1][30:0]};