fsgnj.s

Floating point sign injection

Copies the second register into the first with the sign bit taken from the third, in single precision.

RISC-V manual: fsgnj.s

Forms

  • fsgnj.s , ,

Operands

f1
Any floating-point register, f0 to f31, or its named alias, such as ft0, fa0 or ft11.
f2
A floating-point register. It may be the same register as f1.
f3
A floating-point register. It may be the same register as f1.
.data
a: .float 6.0
b: .float 2.0
.text
la t0, a
flw f1, 0(t0)
la t1, b
flw f2, 0(t1)
# Copy magnitude 6.0 and combine its sign with -2.0; f3 (ft3) becomes -6.0.
fneg.s f2, f2
fsgnj.s f3, f1, f2