Author: Richard Plangger <r...@pasra.at>
Branch: vecopt
Changeset: r77203:b5b718bd459b
Date: 2015-05-07 16:54 +0200
http://bitbucket.org/pypy/pypy/changeset/b5b718bd459b/

Log:    updated test for constant expansion (test_zjit), added a test to
        test_vectorize.py that tests variable expansion, call2 with variable
        expansion works (llgraph)

diff --git a/pypy/module/micronumpy/test/test_zjit.py 
b/pypy/module/micronumpy/test/test_zjit.py
--- a/pypy/module/micronumpy/test/test_zjit.py
+++ b/pypy/module/micronumpy/test/test_zjit.py
@@ -98,16 +98,6 @@
         result = self.run("add_const")
         assert result == 29 + 3
         self.check_trace_count(1)
-        self.check_simple_loop({
-            'float_add': 1,
-            'guard_false': 1,
-            'guard_not_invalidated': 1,
-            'int_add': 3,
-            'int_ge': 1,
-            'jump': 1,
-            'raw_load': 1,
-            'raw_store': 1,
-        })
 
     def define_pow():
         return """
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py 
b/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py
--- a/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py
@@ -985,7 +985,7 @@
         ops = """
         [p0,i0]
         guard_early_exit() [p0,i0]
-        i1 = getarrayitem_raw(p0, i0, descr=floatarraydescr) # constant index
+        i1 = getarrayitem_raw(p0, i0, descr=floatarraydescr)
         i4 = int_mul(i1, 42)
         i3 = int_add(i0,1)
         i5 = int_lt(i3, 10)
@@ -1008,6 +1008,33 @@
         vopt = self.vectorize(self.parse_loop(ops),1)
         self.assert_equal(vopt.loop, self.parse_loop(opt))
 
+    def test_variable_expansion(self):
+        ops = """
+        [p0,i0,f3]
+        guard_early_exit() [p0,i0]
+        f1 = getarrayitem_raw(p0, i0, descr=floatarraydescr)
+        f4 = int_mul(f1, f3)
+        i3 = int_add(i0,1)
+        i5 = int_lt(i3, 10)
+        guard_true(i5) [p0, i0]
+        jump(p0,i3,f3)
+        """
+        opt="""
+        [p0,i0,f3]
+        guard_early_exit() [p0,i0]
+        i20 = int_add(i0, 1)
+        i30 = int_lt(i20, 10)
+        i2 = int_add(i0, 2)
+        i3 = int_lt(i2, 10)
+        guard_true(i3) [p0,i0]
+        v1 = vec_getarrayitem_raw(p0, i0, 2, descr=floatarraydescr)
+        v3 = vec_expand(f3, 2)
+        v2 = vec_int_mul(v1, v3, 2)
+        jump(p0,i2,f3)
+        """
+        vopt = self.vectorize(self.parse_loop(ops),1)
+        self.assert_equal(vopt.loop, self.parse_loop(opt))
+
     def test_element_f45_in_guard_failargs(self):
         ops = """
         [p36, i28, p9, i37, p14, f34, p12, p38, f35, p39, i40, i41, p42, i43, 
i44, i21, i4, i0, i18]
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to