From bbdc657083b9ae012bcf1bd933dcaeee19b75111 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 16 Jun 2021 19:58:37 +0100 Subject: [PATCH] fix fmadds/fmsubs FPMULADD32 helper --- src/openpower/decoder/helpers.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/openpower/decoder/helpers.py b/src/openpower/decoder/helpers.py index 8b849fb8..134ef84a 100644 --- a/src/openpower/decoder/helpers.py +++ b/src/openpower/decoder/helpers.py @@ -295,15 +295,17 @@ def FPMULADD32(FRA, FRC, FRB, addsign, mulsign): #FRA = DOUBLE(SINGLE(FRA)) #FRB = DOUBLE(SINGLE(FRB)) if addsign == 1: - result = float(FRB) + if mulsign == 1: + result = float(FRA) * float(FRC) + float(FRB) # fmadds + elif mulsign == -1: + result = -(float(FRA) * float(FRC) + float(FRB)) # fnmadds elif addsign == -1: - result = -float(FRB) + if mulsign == 1: + result = float(FRA) * float(FRC) - float(FRB) # fmsubs + elif mulsign == -1: + result = -(float(FRA) * float(FRC) - float(FRB)) # fnmsubs elif addsign == 0: result = 0.0 - if mulsign == 1: - result += float(FRA) * float(FRC) - elif mulsign == -1: - result -= float(FRA) * float(FRC) log ("FPMULADD32", FRA, FRB, FRC, float(FRA), float(FRB), float(FRC), result) -- 2.30.2