[pypy-svn] r71683 - in pypy/trunk/pypy/jit: backend/x86 metainterp/test

fijal at codespeak.net fijal at codespeak.net
Wed Mar 3 02:07:05 CET 2010


Author: fijal
Date: Wed Mar  3 02:07:04 2010
New Revision: 71683

Modified:
   pypy/trunk/pypy/jit/backend/x86/assembler.py
   pypy/trunk/pypy/jit/backend/x86/regalloc.py
   pypy/trunk/pypy/jit/metainterp/test/test_executor.py
Log:
implement uint_floordiv


Modified: pypy/trunk/pypy/jit/backend/x86/assembler.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/assembler.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/assembler.py	Wed Mar  3 02:07:04 2010
@@ -718,6 +718,11 @@
 
     genop_int_floordiv = genop_int_mod
 
+    def genop_uint_floordiv(self, op, arglocs, resloc):
+        self.mc.MOV(edx, eax)
+        self.mc.SAR(edx, imm(31))
+        self.mc.IDIV(ecx)
+
     def genop_new_with_vtable(self, op, arglocs, result_loc):
         assert result_loc is eax
         loc_vtable = arglocs[-1]

Modified: pypy/trunk/pypy/jit/backend/x86/regalloc.py
==============================================================================
--- pypy/trunk/pypy/jit/backend/x86/regalloc.py	(original)
+++ pypy/trunk/pypy/jit/backend/x86/regalloc.py	Wed Mar  3 02:07:04 2010
@@ -510,6 +510,7 @@
     def consider_int_floordiv(self, op):
         self._consider_int_div_or_mod(op, eax, edx)
         self.Perform(op, [eax, ecx], eax)
+    consider_uint_floordiv = consider_int_mod
 
     def _consider_compop(self, op, guard_op):
         vx = op.args[0]

Modified: pypy/trunk/pypy/jit/metainterp/test/test_executor.py
==============================================================================
--- pypy/trunk/pypy/jit/metainterp/test/test_executor.py	(original)
+++ pypy/trunk/pypy/jit/metainterp/test/test_executor.py	Wed Mar  3 02:07:04 2010
@@ -130,7 +130,9 @@
                           (3, 3, 0)]),
         (rop.UINT_RSHIFT, [(-1, 4, intmask(r_uint(-1) >> r_uint(4))),
                            ( 1, 4, intmask(r_uint(1) >> r_uint(4))),
-                           ( 3, 3, 0)])
+                           ( 3, 3, 0)]),
+        (rop.UINT_FLOORDIV, [(4, 3, intmask(r_uint(4) / r_uint(3))),
+                             (1, -1, intmask(r_uint(1) / r_uint(-1)))])
         ]:
         for x, y, z in testcases:
             yield opnum, [x, y], z



More information about the Pypy-commit mailing list