[pypy-commit] pypy vecopt: started to bail out for some operations that cannot be implemented efficiently in SSE4.1

plan_rich noreply at buildbot.pypy.org
Tue Jun 23 16:48:29 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt
Changeset: r78266:c9e6e55b3900
Date: 2015-06-23 16:48 +0200
http://bitbucket.org/pypy/pypy/changeset/c9e6e55b3900/

Log:	started to bail out for some operations that cannot be implemented
	efficiently in SSE4.1

diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py
--- a/rpython/jit/backend/x86/assembler.py
+++ b/rpython/jit/backend/x86/assembler.py
@@ -2536,10 +2536,6 @@
                 self.mc.PHADDD(accumloc, accumloc)
                 self.mc.PEXTRD_rxi(targetloc.value, accumloc.value, 0)
                 return
-            if size == 2:
-                pass
-            if size == 1:
-                pass
 
         raise NotImplementedError("reduce sum for %s not impl." % vector_var)
 
diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py b/rpython/jit/metainterp/optimizeopt/vectorize.py
--- a/rpython/jit/metainterp/optimizeopt/vectorize.py
+++ b/rpython/jit/metainterp/optimizeopt/vectorize.py
@@ -657,6 +657,8 @@
         if packed.is_raw_array_access():
             if packed.getarg(1) == inquestion.result:
                 return True
+        if inquestion.casts_box():
+            pass
         return False
 
     def combine(self, i, j):
diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py
--- a/rpython/jit/metainterp/resoperation.py
+++ b/rpython/jit/metainterp/resoperation.py
@@ -189,6 +189,12 @@
     def returns_bool_result(self):
         return self._cls_has_bool_result
 
+    def casts_box(self):
+        return self.getopnum() == rop.INT_SIGNEXT or \
+               rop.CAST_FLOAT_TO_INT <= opnum <= rop.CAST_SINGLEFLOAT_TO_FLOAT or \
+               rop._VEC_CAST_FIRST <= opnum <= rop._VEC_CAST_LAST or \
+               rop.CAST_PTR_TO_INT == opnum or \
+               rop.CAST_INT_TO_PTR == opnum
 
 # ===================
 # Top of the hierachy
@@ -472,6 +478,7 @@
     '_VEC_ARITHMETIC_LAST',
     'VEC_FLOAT_EQ/2',
 
+    '_VEC_CAST_FIRST',
     'VEC_INT_SIGNEXT/2',
     # double -> float: v2 = cast(v1, 2) equal to v2 = (v1[0], v1[1], X, X)
     'VEC_CAST_FLOAT_TO_SINGLEFLOAT/1',
@@ -479,6 +486,7 @@
     'VEC_CAST_SINGLEFLOAT_TO_FLOAT/1',
     'VEC_CAST_FLOAT_TO_INT/1',
     'VEC_CAST_INT_TO_FLOAT/1',
+    '_VEC_CAST_LAST',
 
     'VEC_FLOAT_UNPACK/3',        # iX|fX = VEC_FLOAT_UNPACK(vX, index, item_count)
     'VEC_FLOAT_PACK/4',          # VEC_FLOAT_PACK(vX, var/const, index, item_count)
diff --git a/rpython/jit/metainterp/warmspot.py b/rpython/jit/metainterp/warmspot.py
--- a/rpython/jit/metainterp/warmspot.py
+++ b/rpython/jit/metainterp/warmspot.py
@@ -40,18 +40,21 @@
         self.vec = vec
 
     def xxx_clock_start(self):
+        if not self.vec:
+            return
         now = time.clock()
         self.t.append(now)
         debug_start("xxx-clock-start")
         debug_print("name: %s id(jdsd): %s now: %dns" % \
-                (self.name, self.unique_id, int(now*10**9)))
+                (self.name, self.unique_id, int(now)*10**9) )
         debug_stop("xxx-clock-start")
 
     def xxx_clock_stop(self, fail=False):
+        if not self.vec:
+            return
         end = time.clock()
         if len(self.t) == 0:
             return
-        assert len(self.t) == 1
         start = self.t[-1]
         if not fail:
             del self.t[-1]


More information about the pypy-commit mailing list