Author: Richard Plangger <[email protected]>
Branch: vecopt-merge
Changeset: r79923:66ad64b27bdb
Date: 2015-10-01 20:27 +0200
http://bitbucket.org/pypy/pypy/changeset/66ad64b27bdb/
Log: unpacking just one element now generates a scalar variable
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
@@ -477,6 +477,11 @@
return self.getopnum() == rop.LABEL
def is_vector(self):
+ if self.getopnum() in (rop.VEC_UNPACK_I, rop.VEC_UNPACK_F):
+ arg = self.getarg(2)
+ from rpython.jit.metainterp.history import ConstInt
+ assert isinstance(arg, ConstInt)
+ return arg.value > 1
return self.vector == -2
def returns_void(self):
diff --git a/rpython/jit/metainterp/test/test_resoperation.py
b/rpython/jit/metainterp/test/test_resoperation.py
--- a/rpython/jit/metainterp/test/test_resoperation.py
+++ b/rpython/jit/metainterp/test/test_resoperation.py
@@ -107,6 +107,12 @@
if 'cast_to' in kwargs:
assert op.cast_to() == kwargs['cast_to']
+def test_unpack_1():
+ op = rop.ResOperation(rop.rop.VEC_UNPACK_I, [rop.InputArgVector(),
ConstInt(0), ConstInt(1)])
+ assert (op.type, op.datatype, op.bytesize, op.is_vector()) == ('i', 'i',
8, False)
+ op = rop.ResOperation(rop.rop.VEC_UNPACK_I, [rop.InputArgVector(),
ConstInt(0), ConstInt(2)])
+ assert (op.type, op.datatype, op.bytesize, op.is_vector()) == ('i', 'i',
8, True)
+
def test_types():
op = rop.ResOperation(rop.rop.INT_ADD, [ConstInt(0),ConstInt(1)])
assert op.type == 'i'
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit