[pypy-commit] pypy vecopt: works now for the int16 case

plan_rich noreply at buildbot.pypy.org
Tue Jun 9 14:18:47 CEST 2015


Author: Richard Plangger <rich at pasra.at>
Branch: vecopt
Changeset: r77990:ec09c339cc68
Date: 2015-06-09 13:55 +0200
http://bitbucket.org/pypy/pypy/changeset/ec09c339cc68/

Log:	works now for the int16 case

diff --git a/rpython/jit/metainterp/optimizeopt/schedule.py b/rpython/jit/metainterp/optimizeopt/schedule.py
--- a/rpython/jit/metainterp/optimizeopt/schedule.py
+++ b/rpython/jit/metainterp/optimizeopt/schedule.py
@@ -609,6 +609,15 @@
     rop.VEC_CAST_INT_TO_FLOAT: OpToVectorOpConv(PT_INT32_2, PT_DOUBLE_2),
 }
 
+def determine_output_type(node, input_type):
+    op = node.getoperation()
+    op2vecop = ROP_ARG_RES_VECTOR.get(op.vector, None)
+    if op2vecop is None:
+        raise NotImplementedError("missing vecop for '%s'" % (op.getopname(),))
+    if isinstance(op2vecop, OpToVectorOpConv):
+        return op2vecop.determine_output_type(op)
+    return input_type
+
 class VecScheduleData(SchedulerData):
     def __init__(self, vec_reg_size):
         self.box_to_vbox = {}
@@ -681,7 +690,11 @@
         self.accum_variable = None
         self.accum_position = -1
         self.input_type = input_type
+        if input_type:
+            self.input_type.count = len(ops)
         self.output_type = output_type
+        if output_type:
+            self.output_type.count = len(ops)
 
     def opcount(self):
         return len(self.operations)
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
@@ -547,11 +547,17 @@
                     return None
                 if origin_pack is None:
                     descr = lnode.getoperation().getdescr()
-                    input_type = PackType.by_descr(descr, self.vec_reg_size)
-                    return Pair(lnode, rnode, input_type, None)
+                    ptype = PackType.by_descr(descr, self.vec_reg_size)
+                    if lnode.getoperation().is_raw_load():
+                        # load outputs value, no input
+                        return Pair(lnode, rnode, None, ptype)
+                    else:
+                        # store only has an input
+                        return Pair(lnode, rnode, ptype, None)
                 if self.profitable_pack(lnode, rnode, origin_pack):
-                    ptype = origin_pack.output_type
-                    return Pair(lnode, rnode, ptype, ptype)
+                    input_type = origin_pack.output_type
+                    output_type = determine_output_type(lnode, input_type)
+                    return Pair(lnode, rnode, input_type, output_type)
             else:
                 if self.contains_pair(lnode, rnode):
                     return None
@@ -665,7 +671,7 @@
             var = pack.accum_variable
             pos = pack.accum_position
             # create a new vector box for the parameters
-            box = pack.input_type.new_vector_box(0)
+            box = pack.input_type.new_vector_box()
             op = ResOperation(rop.VEC_BOX, [ConstInt(0)], box)
             sched_data.invariant_oplist.append(op)
             result = box.clonebox()


More information about the pypy-commit mailing list