[pypy-svn] pypy jit-longlong: Re-enable llong_eq and llong_ne.

arigo commits-noreply at bitbucket.org
Fri Jan 14 16:12:53 CET 2011


Author: Armin Rigo <arigo at tunes.org>
Branch: jit-longlong
Changeset: r40679:58ed58cb25ea
Date: 2011-01-14 16:12 +0100
http://bitbucket.org/pypy/pypy/changeset/58ed58cb25ea/

Log:	Re-enable llong_eq and llong_ne.

diff --git a/pypy/jit/backend/x86/assembler.py b/pypy/jit/backend/x86/assembler.py
--- a/pypy/jit/backend/x86/assembler.py
+++ b/pypy/jit/backend/x86/assembler.py
@@ -1156,8 +1156,8 @@
 
     def genop_llong_eq(self, op, arglocs, resloc):
         loc1, loc2, locxtmp = arglocs
-        self.mc.MOVSD_xx(locxtmp.value, loc1.value)
-        self.mc.PCMPEQD_xx(locxtmp.value, loc2.value)
+        self.mc.MOVSD(locxtmp, loc1)
+        self.mc.PCMPEQD(locxtmp, loc2)
         self.mc.PMOVMSKB_rx(resloc.value, locxtmp.value)
         # Now the lower 8 bits of resloc contain 0x00, 0x0F, 0xF0 or 0xFF
         # depending on the result of the comparison of each of the two
@@ -1169,8 +1169,8 @@
 
     def genop_llong_ne(self, op, arglocs, resloc):
         loc1, loc2, locxtmp = arglocs
-        self.mc.MOVSD_xx(locxtmp.value, loc1.value)
-        self.mc.PCMPEQD_xx(locxtmp.value, loc2.value)
+        self.mc.MOVSD(locxtmp, loc1)
+        self.mc.PCMPEQD(locxtmp, loc2)
         self.mc.PMOVMSKB_rx(resloc.value, locxtmp.value)
         # Now the lower 8 bits of resloc contain 0x00, 0x0F, 0xF0 or 0xFF
         # depending on the result of the comparison of each of the two

diff --git a/pypy/jit/backend/x86/regloc.py b/pypy/jit/backend/x86/regloc.py
--- a/pypy/jit/backend/x86/regloc.py
+++ b/pypy/jit/backend/x86/regloc.py
@@ -516,6 +516,7 @@
     PAND  = _binaryop('PAND')
     POR   = _binaryop('POR')
     PXOR  = _binaryop('PXOR')
+    PCMPEQD = _binaryop('PCMPEQD')
 
     CALL = _relative_unaryop('CALL')
     JMP = _relative_unaryop('JMP')

diff --git a/pypy/jit/backend/x86/regalloc.py b/pypy/jit/backend/x86/regalloc.py
--- a/pypy/jit/backend/x86/regalloc.py
+++ b/pypy/jit/backend/x86/regalloc.py
@@ -237,13 +237,13 @@
             return self.rm.force_allocate_reg(var, forbidden_vars,
                                               selected_reg, need_lower_byte)
 
-    def load_xmm_aligned_16_bytes(self, var):
+    def load_xmm_aligned_16_bytes(self, var, forbidden_vars=[]):
         # Load 'var' in a register; but if it is a constant, we can return
         # a 16-bytes-aligned ConstFloatLoc.
         if isinstance(var, Const):
             return self.xrm.convert_to_imm_16bytes_align(var)
         else:
-            return self.xrm.make_sure_var_in_reg(var)
+            return self.xrm.make_sure_var_in_reg(var, forbidden_vars)
 
     def _compute_loop_consts(self, inputargs, jump, looptoken):
         if jump.getopnum() != rop.JUMP or jump.getdescr() is not looptoken:
@@ -664,14 +664,13 @@
         self.PerformLLong(op, [loc0, loc1], loc0)
         self.xrm.possibly_free_vars(args)
 
-    def _consider_llong_eq_xx(self, op):
-        # (also handles llong_ne.)
+    def _consider_llong_eq_ne_xx(self, op):
         # must force both arguments into xmm registers, because we don't
-        # know if they will be suitably aligned
+        # know if they will be suitably aligned.  Exception: if they are
+        # constants, we can ask them to be aligned to 16 bytes.
         args = [op.getarg(1), op.getarg(2)]
-        XXXXX
-        loc1 = self.xrm.make_sure_var_in_reg(args[0], imm_fine=False)
-        loc2 = self.xrm.make_sure_var_in_reg(args[1], args, imm_fine=False)
+        loc1 = self.load_xmm_aligned_16_bytes(args[0])
+        loc2 = self.load_xmm_aligned_16_bytes(args[1], args)
         tmpxvar = TempBox()
         loc3 = self.xrm.force_allocate_reg(tmpxvar, args)
         self.xrm.possibly_free_var(tmpxvar)
@@ -808,9 +807,9 @@
                     return self._consider_llong_from_int(op)
                 if oopspecindex == EffectInfo.OS_LLONG_FROM_TWO_INTS:
                     return self._consider_llong_from_two_ints(op)
-                #if (oopspecindex == EffectInfo.OS_LLONG_EQ or
-                #    oopspecindex == EffectInfo.OS_LLONG_NE):
-                #    return self._consider_llong_eq_xx(op)
+                if (oopspecindex == EffectInfo.OS_LLONG_EQ or
+                    oopspecindex == EffectInfo.OS_LLONG_NE):
+                    return self._consider_llong_eq_ne_xx(op)
                 if oopspecindex == EffectInfo.OS_LLONG_LT:
                     if self._maybe_consider_llong_lt(op):
                         return


More information about the Pypy-commit mailing list