whoops pseudocode for divwe / divde checking wrong half of result
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 22 Sep 2020 10:51:20 +0000 (11:51 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Tue, 22 Sep 2020 10:52:02 +0000 (11:52 +0100)
must check the *upper* half which of course is inverted numbering
in PowerISA sigh

openpower/isa/fixedarith.mdwn

index fe3350fed551dd01ae915b4aff3609b4a2b7efa0..7a03aff4676c28c8d78e1aafa545cbeee4a783c9 100644 (file)
@@ -444,8 +444,8 @@ Pseudo-code:
         overflow <- 1
     else
         result <- DIVS(dividend, divisor)
-        if (result[32:63] = 0) then
-            RT[32:63] <- result[0:31]
+        if (result[0:31] = 0) then
+            RT[32:63] <- result[32:63]
             RT[0:31] <- undefined[0:31]
             overflow <- 0
         else
@@ -476,7 +476,7 @@ Pseudo-code:
     else
         result <- dividend /  divisor
         if (RA) < (RB) then
-            RT[32:63] <- result[0:31]
+            RT[32:63] <- result[32:63]
             RT[0:31] <- undefined[0:31]
             overflow <- 0
         else
@@ -719,8 +719,8 @@ Pseudo-code:
         overflow <- 1
     else
         result <- DIVS(dividend, divisor)
-        if result[64:127] = 0x0000_0000_0000_0000 then
-            RT <- result[63:127]
+        if result[0:64] = 0x0000_0000_0000_0000 then
+            RT <- result[0:63]
             overflow <- 0
         else
             overflow <- 1
@@ -750,7 +750,7 @@ Pseudo-code:
     else
         result <- dividend /  divisor
         if (RA) < (RB) then
-            RT <- result[63:127]
+            RT <- result[0:63]
             overflow <- 0
         else
             overflow <- 1