Author: Justin Peel <[email protected]>
Branch: 
Changeset: r45492:1da5d7bbf8c3
Date: 2011-07-11 17:32 -0600
http://bitbucket.org/pypy/pypy/changeset/1da5d7bbf8c3/

Log:    Fixed argmin/max and added a jit test for argmin

diff --git a/pypy/module/micronumpy/interp_numarray.py 
b/pypy/module/micronumpy/interp_numarray.py
--- a/pypy/module/micronumpy/interp_numarray.py
+++ b/pypy/module/micronumpy/interp_numarray.py
@@ -179,7 +179,7 @@
 
     def _reduce_argmax_argmin_impl(function):
         reduce_driver = jit.JitDriver(greens=['signature'],
-                         reds = ['i', 'size', 'result', 'cur_best', 'self'])
+                         reds = ['i', 'size', 'result', 'self', 'cur_best'])
         def loop(self, size):
             result = 0
             cur_best = self.eval(0)
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
@@ -115,6 +115,23 @@
                            "int_lt": 1, "guard_true": 2,
                            "jump": 1})
 
+    def test_argmin(self):
+        space = self.space
+
+        def f(i):
+            ar = SingleDimArray(i)
+            j = 0
+            while j < i:
+                ar.get_concrete().storage[j] = float(j)
+                j += 1
+            return ar.descr_add(space, ar).descr_argmin(space)
+
+        result = self.meta_interp(f, [5], listops=True, backendopt=True)
+        self.check_loops({"getarrayitem_raw": 2, "float_add": 1,
+                           "float_lt": 1, "int_add": 1,
+                           "int_lt": 1, "guard_true": 2,
+                           "jump": 1})
+
     def test_all(self):
         space = self.space
 
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to