Pseudo-code:
- FRT <- FPMULADD32(FRA, FRC, FRB, 1)
+ FRT <- FPMULADD32(FRA, FRC, FRB, 1, 1)
Special Registers Altered:
Pseudo-code:
- FRT <- FPMULADD32(FRA, FRC, FRB, -1)
+ FRT <- FPMULADD32(FRA, FRC, FRB, 1, -1)
+
+Special Registers Altered:
+
+ FPRF FR FI
+ FX OX UX XX
+ VXSNAN VXISI VXIMZ
+ CR1 (if Rc=1)
+
+# Floating Negative Multiply-Add [Single]
+
+A-Form
+
+* fnmadds FRT,FRA,FRC,FRB (Rc=0)
+* fnmadds. FRT,FRA,FRC,FRB (Rc=0)
+
+Pseudo-code:
+
+ FRT <- FPMULADD32(FRA, FRC, FRB, -1, 1)
+
+Special Registers Altered:
+
+ FPRF FR FI
+ FX OX UX XX
+ VXSNAN VXISI VXIMZ
+ CR1 (if Rc=1)
+
+# Floating Negative Multiply-Sub [Single]
+
+A-Form
+
+* fnmsubs FRT,FRA,FRC,FRB (Rc=0)
+* fnmsubs. FRT,FRA,FRC,FRB (Rc=0)
+
+Pseudo-code:
+
+ FRT <- FPMULADD32(FRA, FRC, FRB, -1, -1)
Special Registers Altered:
return cvt
-def FPMULADD32(FRA, FRB, FRC, sign):
+def FPMULADD32(FRA, FRB, FRC, addsign, mulsign):
from openpower.decoder.isafunctions.double2single import DOUBLE2SINGLE
#return FPMUL64(FRA, FRB)
#FRA = DOUBLE(SINGLE(FRA))
#FRB = DOUBLE(SINGLE(FRB))
- if sign == 1:
- result = float(FRA) * float(FRB) + float(FRC)
- elif sign == -1:
- result = float(FRA) * float(FRB) - float(FRC)
- elif sign == 0:
- result = float(FRA) * float(FRB)
+ if addsign == 1:
+ result = float(FRC)
+ elif addsign == -1:
+ result = -float(FRC)
+ elif addsign == 0:
+ result = 0.0
+ if mulsign == 1:
+ result += float(FRA) * float(FRB)
+ elif mulsign == -1:
+ result -= float(FRA) * float(FRB)
log ("FPMULADD32", FRA, FRB, FRC,
float(FRA), float(FRB), float(FRC),
result)