[pypy-commit] pypy remove-raisingops: (untested) check the call(div) => uint_mul_high replacement

arigo pypy.commits at gmail.com
Fri May 27 14:45:12 EDT 2016


Author: Armin Rigo <arigo at tunes.org>
Branch: remove-raisingops
Changeset: r84734:3e61de65d2dc
Date: 2016-05-27 20:32 +0200
http://bitbucket.org/pypy/pypy/changeset/3e61de65d2dc/

Log:	(untested) check the call(div) => uint_mul_high replacement

diff --git a/pypy/module/pypyjit/test_pypy_c/test_shift.py b/pypy/module/pypyjit/test_pypy_c/test_shift.py
--- a/pypy/module/pypyjit/test_pypy_c/test_shift.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_shift.py
@@ -49,7 +49,8 @@
             while a < 300:
                 res1 = a/b     # ID: div
                 res2 = a/2     # ID: shift
-                res += res1 + res2
+                res3 = a/11    # ID: mul
+                res += res1 + res2 + res3
                 a += 1
             return res
         #
@@ -65,6 +66,17 @@
         assert loop.match_by_id('shift', """
             i1 = int_rshift(i2, 1)
         """)
+        if sys.maxint > 2**32:
+            args = (63, -5030930201920786804, 3)
+        else:
+            args = (31, -1171354717, 3)
+        assert loop.match_by_id('mul', """
+            i2 = int_rshift(i1, %d)
+            i3 = int_xor(i1, i2)
+            i4 = uint_mul_high(i3, %d)
+            i5 = uint_rshift(i4, %d)
+            i6 = int_xor(i5, i2)
+        """ % args)
 
     def test_division_to_rshift_allcases(self):
         """


More information about the pypy-commit mailing list