Author: Brian Kearns <[email protected]>
Branch:
Changeset: r74846:f907c020762a
Date: 2014-12-05 16:48 -0500
http://bitbucket.org/pypy/pypy/changeset/f907c020762a/
Log: add test_zjit for reduce_cumulative
diff --git a/pypy/module/micronumpy/compile.py
b/pypy/module/micronumpy/compile.py
--- a/pypy/module/micronumpy/compile.py
+++ b/pypy/module/micronumpy/compile.py
@@ -34,8 +34,8 @@
SINGLE_ARG_FUNCTIONS = ["sum", "prod", "max", "min", "all", "any",
- "unegative", "flat", "tostring","count_nonzero",
- "argsort"]
+ "unegative", "flat", "tostring", "count_nonzero",
+ "argsort", "cumsum"]
TWO_ARG_FUNCTIONS = ["dot", 'take', 'searchsorted']
TWO_ARG_FUNCTIONS_OR_NONE = ['view', 'astype']
THREE_ARG_FUNCTIONS = ['where']
@@ -559,6 +559,8 @@
w_res = arr.descr_any(interp.space)
elif self.name == "all":
w_res = arr.descr_all(interp.space)
+ elif self.name == "cumsum":
+ w_res = arr.descr_cumsum(interp.space)
elif self.name == "unegative":
neg = ufuncs.get(interp.space).negative
w_res = neg.call(interp.space, [arr])
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
@@ -183,6 +183,28 @@
'raw_load': 1,
})
+ def define_cumsum():
+ return """
+ a = |30|
+ b = cumsum(a)
+ b -> 5
+ """
+
+ def test_cumsum(self):
+ result = self.run("cumsum")
+ assert result == 15
+ self.check_trace_count(1)
+ self.check_simple_loop({
+ 'float_add': 1,
+ 'guard_false': 1,
+ 'guard_not_invalidated': 1,
+ 'int_add': 4,
+ 'int_ge': 1,
+ 'jump': 1,
+ 'raw_load': 1,
+ 'raw_store': 1,
+ })
+
def define_axissum():
return """
a = [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
@@ -218,7 +240,7 @@
'getfield_gc': 5,
'getfield_gc_pure': 51,
'guard_class': 3,
- 'guard_false': 12,
+ 'guard_false': 13,
'guard_nonnull': 11,
'guard_nonnull_class': 3,
'guard_not_invalidated': 2,
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit