Author: Richard Plangger <planri...@gmail.com> Branch: ppc-vsx-support Changeset: r88027:dd5a308d5427 Date: 2016-11-01 13:59 +0100 http://bitbucket.org/pypy/pypy/changeset/dd5a308d5427/
Log: translation issue, moved function in file diff --git a/rpython/jit/backend/x86/vector_ext.py b/rpython/jit/backend/x86/vector_ext.py --- a/rpython/jit/backend/x86/vector_ext.py +++ b/rpython/jit/backend/x86/vector_ext.py @@ -43,8 +43,8 @@ return "<TempVector at %s>" % (id(self),) class TempInt(TempVar): - def __init__(self): - self.type = INT + type = INT + def __repr__(self): return "<TempInt at %s>" % (id(self),) diff --git a/rpython/jit/backend/zarch/vector_ext.py b/rpython/jit/backend/zarch/vector_ext.py --- a/rpython/jit/backend/zarch/vector_ext.py +++ b/rpython/jit/backend/zarch/vector_ext.py @@ -180,6 +180,32 @@ self.regalloc_mov(scalar_loc, orig_scalar_loc) accum_info = accum_info.next() + def _accum_reduce(self, op, arg, accumloc, targetloc): + # Currently the accumulator can ONLY be 64 bit float/int + if arg.type == FLOAT: + self.mc.VX(targetloc, targetloc, targetloc) + self.mc.VPDI(targetloc, accumloc, accumloc, permi(1,0)) + if op == '+': + self.mc.VFA(targetloc, targetloc, accumloc, l.imm3, l.imm(0b1000), l.imm(0)) + return + elif op == '*': + self.mc.VFM(targetloc, targetloc, accumloc, l.imm3, l.imm(0b1000), l.imm(0)) + return + else: + assert arg.type == INT + # store the vector onto the stack, just below the stack pointer + self.mc.VLGV(r.SCRATCH, accumloc, l.addr(0), l.itemsize_to_mask(8)) + self.mc.VLGV(targetloc, accumloc, l.addr(1), l.itemsize_to_mask(8)) + if op == '+': + self.mc.AGR(targetloc, r.SCRATCH) + return + elif op == '*': + self.mc.MSGR(targetloc, r.SCRATCH) + return + not_implemented("reduce sum for %s not impl." % arg) + + + def emit_vec_int_is_true(self, op, arglocs, regalloc): assert isinstance(op, VectorOp) resloc, argloc, sizeloc = arglocs @@ -259,30 +285,6 @@ else: self.mc.VLREP(resloc, loc0, l.itemsize_to_mask(size)) - def _accum_reduce(self, op, arg, accumloc, targetloc): - # Currently the accumulator can ONLY be 64 bit float/int - if arg.type == FLOAT: - self.mc.VPDI(targetloc, accumloc, accumloc, permi(1,0)) - if op == '+': - self.mc.VFA(targetloc, targetloc, accumloc, l.imm3, l.imm(0b1000), l.imm(0)) - return - elif op == '*': - self.mc.VFM(targetloc, targetloc, accumloc, l.imm3, l.imm(0b1000), l.imm(0)) - return - else: - assert arg.type == INT - # store the vector onto the stack, just below the stack pointer - self.mc.VLGV(r.SCRATCH, accumloc, l.addr(0), l.itemsize_to_mask(8)) - self.mc.VLGV(targetloc, accumloc, l.addr(1), l.itemsize_to_mask(8)) - if op == '+': - self.mc.AGR(targetloc, r.SCRATCH) - return - elif op == '*': - self.mc.MSGR(targetloc, r.SCRATCH) - return - not_implemented("reduce sum for %s not impl." % arg) - - def emit_vec_pack_i(self, op, arglocs, regalloc): assert isinstance(op, VectorOp) resloc, vecloc, sourceloc, residxloc, srcidxloc, countloc, sizeloc = arglocs diff --git a/rpython/jit/metainterp/test/test_vector.py b/rpython/jit/metainterp/test/test_vector.py --- a/rpython/jit/metainterp/test/test_vector.py +++ b/rpython/jit/metainterp/test/test_vector.py @@ -215,9 +215,6 @@ la = data.draw(st.lists(integers, min_size=10, max_size=150)) l = len(la) lb = data.draw(st.lists(integers, min_size=l, max_size=l)) - #la = [0] * 10 - #l = 10 - #lb = [0] * 10 rawstorage = RawStorage() va = rawstorage.new(la, type) @@ -422,7 +419,8 @@ test_vec_int_sum = vec_reduce(st.integers(min_value=-2**(64-1), max_value=2**(64-1)-1), lambda a,b: lltype.intmask(lltype.intmask(a)+lltype.intmask(b)), lltype.Signed) test_vec_float_sum = vec_reduce(st.floats(), lambda a,b: a+b, rffi.DOUBLE) - test_vec_float_prod = vec_reduce(st.floats(), lambda a,b: a*b, rffi.DOUBLE) + test_vec_float_prod = vec_reduce(st.floats(min_value=-100, max_value=100, + allow_nan=False, allow_infinity=False), lambda a,b: a*b, rffi.DOUBLE) def test_constant_expand(self): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit