fix bug in fcvttg OpenPower and saturating conversion
authorJacob Lifshay <programmerjake@gmail.com>
Wed, 17 May 2023 04:53:45 +0000 (21:53 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Wed, 17 May 2023 04:53:45 +0000 (21:53 -0700)
openpower/sv/int_fp_mv/moves_and_conversions.mdwn

index 94fd1f7fc901bf822228ab04111b2254c32a2e6d..c735a6944edad433a8682aefe5309a34a801e6b1 100644 (file)
@@ -512,9 +512,9 @@ Section 7.1 of the ECMAScript / JavaScript
             else if bfp_COMPARE_LT(rnd, range_min) then
                 result <- si64_CONVERT_FROM_BFP(range_min)
             else if IT[1] = 1 then  # Unsigned 32/64-bit
-                result <- ui64_CONVERT_FROM_BFP(range_max)
+                result <- ui64_CONVERT_FROM_BFP(rnd)
             else  # Signed 32/64-bit
-                result <- si64_CONVERT_FROM_BFP(range_max)
+                result <- si64_CONVERT_FROM_BFP(rnd)
         case(2, 3):  # Java/Saturating semantics
             if IsNaN(rnd) then
                 result <- [0] * 64
@@ -523,9 +523,9 @@ Section 7.1 of the ECMAScript / JavaScript
             else if bfp_COMPARE_LT(rnd, range_min) then
                 result <- si64_CONVERT_FROM_BFP(range_min)
             else if IT[1] = 1 then  # Unsigned 32/64-bit
-                result <- ui64_CONVERT_FROM_BFP(range_max)
+                result <- ui64_CONVERT_FROM_BFP(rnd)
             else  # Signed 32/64-bit
-                result <- si64_CONVERT_FROM_BFP(range_max)
+                result <- si64_CONVERT_FROM_BFP(rnd)
         default:  # JavaScript semantics
             # CVM = 6, 7 are illegal instructions
             # using a 128-bit intermediate works here because the largest type
@@ -677,9 +677,9 @@ Special Registers altered:
             else if bfp_COMPARE_LT(rnd, range_min) then
                 result <- si64_CONVERT_FROM_BFP(range_min)
             else if IT[1] = 1 then  # Unsigned 32/64-bit
-                result <- ui64_CONVERT_FROM_BFP(range_max)
+                result <- ui64_CONVERT_FROM_BFP(rnd)
             else  # Signed 32/64-bit
-                result <- si64_CONVERT_FROM_BFP(range_max)
+                result <- si64_CONVERT_FROM_BFP(rnd)
         case(2, 3):  # Java/Saturating semantics
             if IsNaN(rnd) then
                 result <- [0] * 64
@@ -688,9 +688,9 @@ Special Registers altered:
             else if bfp_COMPARE_LT(rnd, range_min) then
                 result <- si64_CONVERT_FROM_BFP(range_min)
             else if IT[1] = 1 then  # Unsigned 32/64-bit
-                result <- ui64_CONVERT_FROM_BFP(range_max)
+                result <- ui64_CONVERT_FROM_BFP(rnd)
             else  # Signed 32/64-bit
-                result <- si64_CONVERT_FROM_BFP(range_max)
+                result <- si64_CONVERT_FROM_BFP(rnd)
         default:  # JavaScript semantics
             # CVM = 6, 7 are illegal instructions
             # using a 128-bit intermediate works here because the largest type