[pypy-commit] pypy ppc-vsx-support: remove the flags on the cpu, and push them down to the object in the field vector_ext (saved on the cpu). simplifies the vector extension handling

plan_rich pypy.commits at gmail.com
Wed Jul 6 15:01:27 EDT 2016


Author: Richard Plangger <planrichi at gmail.com>
Branch: ppc-vsx-support
Changeset: r85590:7dd9c13d12f8
Date: 2016-07-06 21:00 +0200
http://bitbucket.org/pypy/pypy/changeset/7dd9c13d12f8/

Log:	remove the flags on the cpu, and push them down to the object in the
	field vector_ext (saved on the cpu). simplifies the vector extension
	handling

diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py
--- a/rpython/jit/backend/llgraph/runner.py
+++ b/rpython/jit/backend/llgraph/runner.py
@@ -327,10 +327,8 @@
     supports_guard_gc_type = True
     translate_support_code = False
     is_llgraph = True
-    vector_extension = True
-    vector_register_size = 16 # in bytes
-    vector_horizontal_operations = True
-    vector_pack_slots = True
+    vector_ext = VectorExt()
+    vector_ext.enable(16, accum=True)
 
     def __init__(self, rtyper, stats=None, *ignored_args, **kwds):
         model.AbstractCPU.__init__(self)
diff --git a/rpython/jit/backend/llsupport/llmodel.py b/rpython/jit/backend/llsupport/llmodel.py
--- a/rpython/jit/backend/llsupport/llmodel.py
+++ b/rpython/jit/backend/llsupport/llmodel.py
@@ -36,10 +36,6 @@
     load_supported_factors = (1,)
 
     vector_ext = None
-    vector_extension = False
-    vector_register_size = 0 # in bytes
-    vector_horizontal_operations = False
-    vector_pack_slots = False
 
     def __init__(self, rtyper, stats, opts, translate_support_code=False,
                  gcdescr=None):
diff --git a/rpython/jit/backend/llsupport/vector_ext.py b/rpython/jit/backend/llsupport/vector_ext.py
--- a/rpython/jit/backend/llsupport/vector_ext.py
+++ b/rpython/jit/backend/llsupport/vector_ext.py
@@ -6,6 +6,7 @@
 from rpython.jit.metainterp.resoperation import rop
 from rpython.jit.metainterp.optimizeopt.schedule import (forwarded_vecinfo,
         failnbail_transformation)
+from rpython.jit.metainterp.jitexc import NotAVectorizeableLoop
 
 class TypeRestrict(object):
     ANY_TYPE = '\x00'
@@ -190,6 +191,25 @@
 
 class VectorExt(object):
 
+    def __init__(self):
+        self._enabled = False
+        self.register_size = 0 # in bytes
+        self.horizontal_operations = False
+
+    def enable(self, vec_size, accum=False):
+        self._enabled = vec_size != 0
+        self.register_size = vec_size
+        self.horizontal_operations = accum
+
+    def is_enabled(self):
+        return self._enabled
+
+    def vec_size(self):
+        return self.register_size
+
+    def supports_accumulation(self):
+        return self.horizontal_operations
+
     # note that the following definition is x86 arch specific
     TR_MAPPING = {
         rop.VEC_INT_ADD:            OR_MSTF_I,
diff --git a/rpython/jit/backend/ppc/runner.py b/rpython/jit/backend/ppc/runner.py
--- a/rpython/jit/backend/ppc/runner.py
+++ b/rpython/jit/backend/ppc/runner.py
@@ -13,9 +13,6 @@
 class PPC_CPU(AbstractLLCPU):
 
     vector_ext = AltiVectorExt()
-    vector_extension = False # may be set to true in setup
-    vector_register_size = 16
-    vector_horizontal_operations = False
 
     supports_floats = True
     # missing: supports_singlefloats
@@ -49,8 +46,7 @@
     def setup_once(self):
         self.assembler.setup_once()
         if detect_vsx():
-            self.vector_extension = True
-            self.vector_horizontal_operations = True
+            self.vector_ext.enable(16, accum=True)
             self.assembler.setup_once_vector()
 
     @rgc.no_release_gil


More information about the pypy-commit mailing list