restore use of ? : operator in bfp_ROUND_TO_BFP32/64 pseudocode
authorJacob Lifshay <programmerjake@gmail.com>
Tue, 25 Jul 2023 01:54:45 +0000 (18:54 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Tue, 25 Jul 2023 01:54:45 +0000 (18:54 -0700)
this changes it to match the PowerISA spec. better

openpower/isafunctions/bfp.mdwn

index 52df886308439a1afe554834058dab610fadc3bf..a4f09eb5f83cc9961526887f656c4df0600b99d0 100644 (file)
@@ -781,18 +781,11 @@ section 7.6.2.2
         if  ro=1                 then r <- bfp_ROUND_ODD(53, x)
         if bfp_COMPARE_GT(bfp_ABSOLUTE(r), bfp_NMAX_BFP64()) then
             if FPSCR.OE=0 then
-                if x.sign then
-                    if (ro=0) & (rmode=0b00) then r <- bfp_INFINITY()
-                    if (ro=0) & (rmode=0b01) then r <- bfp_NMAX_BFP64()
-                    if (ro=0) & (rmode=0b10) then r <- bfp_NMAX_BFP64()
-                    if (ro=0) & (rmode=0b11) then r <- bfp_INFINITY()
-                    if  ro=1                 then r <- bfp_NMAX_BFP64()
-                else
-                    if (ro=0) & (rmode=0b00) then r <- bfp_INFINITY()
-                    if (ro=0) & (rmode=0b01) then r <- bfp_NMAX_BFP64()
-                    if (ro=0) & (rmode=0b10) then r <- bfp_INFINITY()
-                    if (ro=0) & (rmode=0b11) then r <- bfp_NMAX_BFP64()
-                    if  ro=1                 then r <- bfp_NMAX_BFP64()
+                if (ro=0) & (rmode=0b00) then r <- x.sign ? bfp_INFINITY()   : bfp_INFINITY()
+                if (ro=0) & (rmode=0b01) then r <- x.sign ? bfp_NMAX_BFP64() : bfp_NMAX_BFP64()
+                if (ro=0) & (rmode=0b10) then r <- x.sign ? bfp_NMAX_BFP64() : bfp_INFINITY()
+                if (ro=0) & (rmode=0b11) then r <- x.sign ? bfp_INFINITY()   : bfp_NMAX_BFP64()
+                if  ro=1                 then r <- x.sign ? bfp_NMAX_BFP64() : bfp_NMAX_BFP64()
                 r.sign <- x.sign
                 ox_flag <- 0b1
                 xx_flag <- 0b1
@@ -850,16 +843,10 @@ section 7.6.2.2
 
         if bfp_COMPARE_GT(bfp_ABSOLUTE(r), bfp_NMAX_BFP32()) then
             if FPSCR.OE = 0 then
-                if x.sign then
-                    if rmode=0b00 then r <- bfp_INFINITY()
-                    if rmode=0b01 then r <- bfp_NMAX_BFP32()
-                    if rmode=0b10 then r <- bfp_NMAX_BFP32()
-                    if rmode=0b11 then r <- bfp_INFINITY()
-                else
-                    if rmode=0b00 then r <- bfp_INFINITY()
-                    if rmode=0b01 then r <- bfp_NMAX_BFP32()
-                    if rmode=0b10 then r <- bfp_INFINITY()
-                    if rmode=0b11 then r <- bfp_NMAX_BFP32()
+                if rmode=0b00 then r <- x.sign ? bfp_INFINITY()   : bfp_INFINITY()
+                if rmode=0b01 then r <- x.sign ? bfp_NMAX_BFP32() : bfp_NMAX_BFP32()
+                if rmode=0b10 then r <- x.sign ? bfp_NMAX_BFP32() : bfp_INFINITY()
+                if rmode=0b11 then r <- x.sign ? bfp_INFINITY()   : bfp_NMAX_BFP32()
                 r.sign <- x.sign
                 ox_flag <- 0b1
                 xx_flag <- 0b1