Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r77393:18c3705b8f89 Date: 2015-05-19 16:59 +0200 http://bitbucket.org/pypy/pypy/changeset/18c3705b8f89/
Log: removed annotation errors that occur when building the jit removed commented (old) code from assembler do not assign item_size to boxvector, but recreate the object instead use getter instead of direct access to boxvector (item_size,item_count) diff --git a/rpython/jit/backend/x86/assembler.py b/rpython/jit/backend/x86/assembler.py --- a/rpython/jit/backend/x86/assembler.py +++ b/rpython/jit/backend/x86/assembler.py @@ -2518,7 +2518,7 @@ elif itemsize == 4: self.mc.PMULLD(loc0, loc1) elif itemsize == 8: - self.mc.PMULDQ(loc0, loc1) + self.mc.PMULDQ(loc0, loc1) # TODO else: raise NotImplementedError("did not implement integer mul") @@ -2591,27 +2591,9 @@ elif count == 2: self.mc.MOVDDUP(resloc, loc0) - # TODO remove - #def _shuffle_by_index(self, src_loc, tmp_loc, item_type, size, index, count): - # if index == 0 and count == 1: - # return src_loc - # select = 0 - # if item_type == FLOAT: - # if size == 4: - # self.mc.MOVUPS(tmp_loc, src_loc) # TODO could be aligned if xx - # i = 0 - # while i < count: - # select |= (index+i<<(i*2)) - # i += 1 - # self.mc.SHUFPS_xxi(tmp_loc.value, tmp_loc.value, select) - # return tmp_loc - # else: - # raise NotImplementedError("shuffle by index for float64 not impl") - # else: - # raise NotImplementedError("shuffle by index for non floats") - def genop_vec_int_pack(self, op, arglocs, resloc): resultloc, sourceloc, residxloc, srcidxloc, countloc, sizeloc = arglocs + assert isinstance(resultloc, RegLoc) size = sizeloc.value srcidx = srcidxloc.value residx = residxloc.value @@ -2652,6 +2634,8 @@ def genop_vec_float_pack(self, op, arglocs, resultloc): resloc, srcloc, residxloc, srcidxloc, countloc, sizeloc = arglocs + assert isinstance(resloc, RegLoc) + assert isinstance(srcloc, RegLoc) count = countloc.value residx = residxloc.value srcidx = srcidxloc.value @@ -2701,36 +2685,6 @@ self.mc.SHUFPD_xxi(resloc.value, srcloc.value, 2) genop_vec_float_unpack = genop_vec_float_pack - #(self, op, arglocs, resloc): - # resultloc, fromloc, tmploc = arglocs - # result = op.result - # indexarg = op.getarg(2) - # countarg = op.getarg(2) - # assert isinstance(result, BoxVector) - # assert isinstance(indexarg, ConstInt) - # assert isinstance(countarg, ConstInt) - # index = indexarg.value - # count = countarg.value - # size = result.item_size - # if size == 4: - # if count == 1: - # raise NotImplementedError("pack: float single pack") - # elif count == 2: - # select = (1 << 2) # move 0 -> 0, 1 -> 1 for toloc - # if index == 0: - # # move 0 -> 2, 1 -> 3 for fromloc - # self.mc.SHUFPS_xxi(resultloc.value, fromloc.value, select | (1 << 2)) - # elif index == 2: - # # move 0 -> 2, 1 -> 3 for fromloc - # self.mc.SHUFPS_xxi(resultloc.value, fromloc.value, select | (1 << 6)) - # else: - # raise NotImplementedError("pack: only index in {0,2} supported") - # else: - # raise NotImplementedError("pack: count 3 for single float pack not supported") - # elif size == 8: - # raise NotImplementedError("pack: float double pack") - - def genop_vec_cast_float_to_singlefloat(self, op, arglocs, resloc): self.mc.CVTPD2PS(resloc, arglocs[0]) @@ -2744,14 +2698,6 @@ def genop_vec_cast_singlefloat_to_float(self, op, arglocs, resloc): loc0, tmploc, indexloc = arglocs self.mc.CVTPS2PD(resloc, arglocs[0]) - #index = indexloc.value - #if index == 0: - #else: - # assert index == 2 - # self.mc.MOVUPS(tmploc, loc0) # TODO could be aligned if xx - # select = (2<<0)|(3<<2) # move pos 2->0,3->1 - # self.mc.SHUFPS_xxi(tmploc.value, tmploc.value, select) - # self.mc.CVTPS2PD(resloc, tmploc) # expand # ________________________________________ diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py --- a/rpython/jit/backend/x86/regalloc.py +++ b/rpython/jit/backend/x86/regalloc.py @@ -1546,7 +1546,7 @@ residx = 0 assert isinstance(op.result, BoxVector) args = op.getarglist() - size = op.result.item_size + size = op.result.getsize() arglocs = [resloc, srcloc, imm(index.value), imm(0), imm(count.value), imm(size)] self.perform(op, arglocs, resloc) @@ -1562,13 +1562,13 @@ if isinstance(op.result, BoxVector): resloc = self.xrm.force_result_in_reg(op.result, op.getarg(0), args) assert isinstance(op.result, BoxVector) - size = op.result.item_size + size = op.result.getsize() else: # unpack into iX box resloc = self.force_allocate_reg(op.result, args) arg = op.getarg(0) assert isinstance(arg, BoxVector) - size = arg.item_size + size = arg.getsize() residx = 0 args = op.getarglist() arglocs = [resloc, srcloc, imm(residx), imm(index.value), imm(count.value), imm(size)] @@ -1582,8 +1582,8 @@ resloc = self.force_allocate_reg(op.result, args) vres = op.result assert isinstance(vres, BoxVector) - count = vres.item_count - size = vres.item_size + count = vres.getcount() + size = vres.getsize() self.perform(op, [srcloc, imm(size), imm(count)], resloc) def consider_vec_int_signext(self, op): @@ -1593,8 +1593,8 @@ result = op.result assert isinstance(sizearg, BoxVector) assert isinstance(result, BoxVector) - size = sizearg.item_size - tosize = result.item_size + size = sizearg.getsize() + tosize = result.getsize() self.perform(op, [resloc, imm(size), imm(tosize)], resloc) def consider_vec_box(self, op): diff --git a/rpython/jit/backend/x86/regloc.py b/rpython/jit/backend/x86/regloc.py --- a/rpython/jit/backend/x86/regloc.py +++ b/rpython/jit/backend/x86/regloc.py @@ -685,7 +685,7 @@ PSUBQ = _binaryop('PSUBQ') PSUBD = _binaryop('PSUBD') PSUBW = _binaryop('PSUBW') - PSUBQ = _binaryop('PSUBQ') + PSUBB = _binaryop('PSUBB') PMULDQ = _binaryop('PMULDQ') PMULLD = _binaryop('PMULLD') diff --git a/rpython/jit/metainterp/history.py b/rpython/jit/metainterp/history.py --- a/rpython/jit/metainterp/history.py +++ b/rpython/jit/metainterp/history.py @@ -561,6 +561,8 @@ return self.item_size def getsigned(self): return self.signed + def getcount(self): + return self.item_count def forget_value(self): raise NotImplementedError("cannot forget value of vector") diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py b/rpython/jit/metainterp/optimizeopt/vectorize.py --- a/rpython/jit/metainterp/optimizeopt/vectorize.py +++ b/rpython/jit/metainterp/optimizeopt/vectorize.py @@ -402,7 +402,6 @@ (j, vbox) = sched_data.box_to_vbox.get(arg, (-1, None)) if vbox: arg_cloned = arg.clonebox() - py.test.set_trace() cj = ConstInt(j) ci = ConstInt(1) opnum = rop.VEC_FLOAT_UNPACK @@ -568,7 +567,7 @@ return self.type != PackType.UNKNOWN_TYPE and self.size > 0 def new_vector_box(self, count): - return BoxVector(self.type, count, self.size, self.signed, self.count) + return BoxVector(self.type, count, self.size, self.signed) def record_vbox(self, vbox): if self.type == PackType.UNKNOWN_TYPE: @@ -587,13 +586,13 @@ class OpToVectorOp(object): def __init__(self, arg_ptypes, result_ptype, has_ptype=False, result_vsize_arg=-1): - self.arg_ptypes = arg_ptypes + self.arg_ptypes = list(arg_ptypes) # do not use a tuple. rpython cannot union self.result_ptype = result_ptype self.has_ptype = has_ptype self.result_vsize_arg = result_vsize_arg def has_result(self): - return self.result_ptype != None + return self.result_ptype is not None def get_result_ptype(self): return self.result_ptype @@ -731,18 +730,21 @@ ptype = tovector.get_result_ptype().clone() if tovector.has_ptype: ptype = self.pack.ptype - if ptype is not None: - if ptype.size == -1: - ptype.size = self.pack.ptype.size - vbox = self.box_vector(ptype) - else: - vbox = self.box_vector(self.pack.ptype) + count = -1 if tovector.result_vsize_arg != -1: # vec_int_signext specifies the size in bytes on the # first argument. arg = vop.getarg(tovector.result_vsize_arg) assert isinstance(arg, ConstInt) - vbox.item_size = arg.value + count = arg.value + else: + count = self.pack_ops + if ptype is not None: + if ptype.size == -1: + ptype.size = self.pack.ptype.size + vbox = ptype.new_vector_box(count) + else: + vbox = self.pack.ptype.new_vector_box(count) # vop.result = vbox i = self.pack_off @@ -754,10 +756,6 @@ i += 1 off += 1 - def box_vector(self, ptype): - """ TODO remove this? """ - return BoxVector(ptype.type, self.pack_ops, ptype.size, ptype.signed) - def vector_arg(self, vop, argidx, arg_ptype): ops = self.pack.operations _, vbox = self.box_to_vbox.get(vop.getarg(argidx), (-1, None)) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit