fix div spec
authorJacob Lifshay <programmerjake@gmail.com>
Wed, 7 Oct 2020 03:58:20 +0000 (20:58 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Wed, 7 Oct 2020 03:58:56 +0000 (20:58 -0700)
openpower/isa/fixedarith.mdwn

index 480db87fabeedbb7b2bad4e80df31998a5c98e28..121a743b47fe31b37471889d66838cd87f0f5693 100644 (file)
@@ -440,7 +440,9 @@ Pseudo-code:
 
     dividend[0:63] <- (RA)[32:63] || [0]*32
     divisor[0:63] <- EXTS64((RB)[32:63])
-    if (divisor = 0x0000_0000_0000_0000) then
+    if (((dividend = 0x8000_0000_0000_0000) &
+         (divisor = 0xffff_ffff_ffff_ffff)) |
+         (divisor = 0x0000_0000_0000_0000)) then
         overflow <- 1
     else
         result <- DIVS(dividend, divisor)
@@ -713,14 +715,17 @@ XO-Form
 
 Pseudo-code:
 
-    dividend[0:127] <-  (RA) || [0]*64
-    divisor[0:127] <- [0]*64 || (RB)
-    if divisor = [0]*128 then
+    dividend[0:127] <- (RA) || [0]*64
+    divisor[0:127] <- EXTS128((RB))
+    if (((dividend = 0x8000_0000_0000_0000_0000_0000_0000_0000) &
+         (divisor = 0xffff_ffff_ffff_ffff_ffff_ffff_ffff_ffff)) |
+         (divisor = 0x0000_0000_0000_0000_0000_0000_0000_0000)) then
         overflow <- 1
     else
         result <- DIVS(dividend, divisor)
-        if result[0:63] = 0x0000_0000_0000_0000 then
-            RT <- result[0:63]
+        result64[0:127] <- EXTS128(result[64:127])
+        if (result64 = result) then
+            RT <- result[64:127]
             overflow <- 0
         else
             overflow <- 1
@@ -748,9 +753,9 @@ Pseudo-code:
     if divisor = [0]*128 then
         overflow <- 1
     else
-        result <- dividend /  divisor
-        if (RA) < (RB) then
-            RT <- result[0:63]
+        result <- dividend / divisor
+        if (RA) <u (RB) then
+            RT <- result[64:127]
             overflow <- 0
         else
             overflow <- 1