Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r78029:fa11cb002cc1 Date: 2015-06-11 11:35 +0200 http://bitbucket.org/pypy/pypy/changeset/fa11cb002cc1/
Log: added llgraph impl for reduce (+,-,*)n diff --git a/rpython/jit/backend/llgraph/runner.py b/rpython/jit/backend/llgraph/runner.py --- a/rpython/jit/backend/llgraph/runner.py +++ b/rpython/jit/backend/llgraph/runner.py @@ -3,7 +3,7 @@ from rpython.jit.backend.llgraph import support from rpython.jit.backend.llsupport import symbolic from rpython.jit.metainterp.history import AbstractDescr -from rpython.jit.metainterp.history import Const, getkind +from rpython.jit.metainterp.history import Const, getkind, BoxVectorAccum from rpython.jit.metainterp.history import INT, REF, FLOAT, VOID, VECTOR from rpython.jit.metainterp.resoperation import rop from rpython.jit.metainterp.optimizeopt import intbounds @@ -862,6 +862,17 @@ value = self.env[box] else: value = None + if isinstance(box, BoxVectorAccum): + if box.operator == '+': + value = sum(value) + elif box.operator == '-': + def sub(acc, x): return acc - x + value = reduce(sub, value, 0) + elif box.operator == '*': + def prod(acc, x): return acc * x + value = reduce(prod, value, 1) + else: + raise NotImplementedError values.append(value) if hasattr(descr, '_llgraph_bridge'): target = (descr._llgraph_bridge, -1) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit