[commit: packages/integer-gmp] master: Temporary disable `mpz_gmpz_tdiv_qr_ui` to workaround #8661 (a3878d1)
git at git.haskell.org
git at git.haskell.org
Fri Jan 10 10:05:08 UTC 2014
Repository : ssh://git@git.haskell.org/integer-gmp
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/a3878d172b358b896b3c8302e58199958479d8e5/integer-gmp
>---------------------------------------------------------------
commit a3878d172b358b896b3c8302e58199958479d8e5
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Fri Jan 10 11:00:23 2014 +0100
Temporary disable `mpz_gmpz_tdiv_qr_ui` to workaround #8661
I still need to investigated, but for some reason not yet obvious to me,
commit [af2ba9c8/integer-gmp] (re #8647) seems to have triggered #8661
on linux/32
This commit disables the use of the `quotRemIntegerWord#` primop on
32bit (which seems to trigger the issue).
Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>
>---------------------------------------------------------------
a3878d172b358b896b3c8302e58199958479d8e5
GHC/Integer/Type.lhs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/GHC/Integer/Type.lhs b/GHC/Integer/Type.lhs
index 3ddbff8..1d0780a 100644
--- a/GHC/Integer/Type.lhs
+++ b/GHC/Integer/Type.lhs
@@ -221,9 +221,10 @@ Just using smartJ# in this way has good results:
{-# NOINLINE quotRemInteger #-}
quotRemInteger :: Integer -> Integer -> (# Integer, Integer #)
-quotRemInteger (S# INT_MINBOUND) b = quotRemInteger minIntAsBig b
+quotRemInteger a@(S# INT_MINBOUND) b = quotRemInteger (toBig a) b
quotRemInteger (S# i) (S# j) = case quotRemInt# i j of
(# q, r #) -> (# S# q, S# r #)
+#if SIZEOF_HSWORD == 8
quotRemInteger (J# s1 d1) (S# b) | isTrue# (b <# 0#)
= case quotRemIntegerWord# s1 d1 (int2Word# (negateInt# b)) of
(# s3, d3, s4, d4 #) -> let !q = smartJ# (negateInt# s3) d3
@@ -234,6 +235,10 @@ quotRemInteger (J# s1 d1) (S# b)
(# s3, d3, s4, d4 #) -> let !q = smartJ# s3 d3
!r = smartJ# s4 d4
in (# q, r #)
+#else
+-- temporary workaround on 32bit due to #8661
+quotRemInteger i1@(J# _ _) i2@(S# _) = quotRemInteger i1 (toBig i2)
+#endif
quotRemInteger i1@(S# _) i2@(J# _ _) = quotRemInteger (toBig i1) i2
quotRemInteger (J# s1 d1) (J# s2 d2)
= case (quotRemInteger# s1 d1 s2 d2) of
More information about the ghc-commits
mailing list