Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r77865:a0cf34db417d Date: 2015-06-04 18:10 +0200 http://bitbucket.org/pypy/pypy/changeset/a0cf34db417d/
Log: adapted test_zjit to changes in micro numpy added a stub for int expansion 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 @@ -61,6 +61,8 @@ w_AttributeError = W_TypeObject("AttributeError") w_StopIteration = W_TypeObject("StopIteration") w_KeyError = W_TypeObject("KeyError") + w_SystemExit = W_TypeObject("SystemExit") + w_KeyboardInterrupt = W_TypeObject("KeyboardInterrupt") w_None = None w_bool = W_TypeObject("bool") @@ -342,8 +344,19 @@ return FloatObject(float(int(w_dtype.value))) if isinstance(w_dtype, boxes.W_Int32Box): return FloatObject(float(int(w_dtype.value))) + if isinstance(w_dtype, boxes.W_Int16Box): + return FloatObject(float(int(w_dtype.value))) + if isinstance(w_dtype, boxes.W_Int8Box): + return FloatObject(float(int(w_dtype.value))) + if isinstance(w_dtype, IntObject): + return FloatObject(float(w_dtype.intval)) + if tp is self.w_int: + if isinstance(w_dtype, FloatObject): + return IntObject(int(w_dtype.floatval)) + return w_dtype + @specialize.arg(2) def call_method(self, w_obj, s, *args): # XXX even the hacks have hacks return getattr(w_obj, 'descr_' + s)(self, *args) @@ -732,10 +745,10 @@ w_res = logical_xor.reduce(interp.space, arr, None) elif self.name == "unegative": neg = ufuncs.get(interp.space).negative - w_res = neg.call(interp.space, [arr], None, None, None) + w_res = neg.call(interp.space, [arr], None, 'unsafe', None) elif self.name == "cos": cos = ufuncs.get(interp.space).cos - w_res = cos.call(interp.space, [arr], None, None, None) + w_res = cos.call(interp.space, [arr], None, 'unsafe', None) elif self.name == "flat": w_res = arr.descr_get_flatiter(interp.space) elif self.name == "argsort": diff --git a/pypy/module/micronumpy/loop.py b/pypy/module/micronumpy/loop.py --- a/pypy/module/micronumpy/loop.py +++ b/pypy/module/micronumpy/loop.py @@ -16,7 +16,7 @@ call2_driver = jit.JitDriver( name='numpy_call2', greens=['shapelen', 'func', 'calc_dtype', 'res_dtype'], - reds='auto') + reds='auto', vectorize=True) def call2(space, shape, func, calc_dtype, w_lhs, w_rhs, out): if w_lhs.get_size() == 1: @@ -50,9 +50,9 @@ w_out = func(calc_dtype, w_left, w_right) out_iter.setitem(out_state, w_out.convert_to(space, res_dtype)) out_state = out_iter.next(out_state) - # if not set to None, the values will be loop carried, forcing - # the vectorization to unpack the vector registers at the end - # of the loop + # if not set to None, the values will be loop carried + # (for the var,var case), forcing the vectorization to unpack + # the vector registers at the end of the loop if left_iter: w_left = None if right_iter: 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 @@ -2636,6 +2636,11 @@ elif size == 8: self.mc.MOVDDUP(resloc, srcloc) + def genop_vec_int_expand(self, op, arglocs, resloc): + srcloc, sizeloc = arglocs + size = sizeloc.value + raise NotImplementedError + def genop_vec_int_pack(self, op, arglocs, resloc): resultloc, sourceloc, residxloc, srcidxloc, countloc, sizeloc = arglocs assert isinstance(resultloc, RegLoc) 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 @@ -81,6 +81,20 @@ rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[1] = y return ConstFloatLoc(adr) + def expand_int(self, var, const): + assert isinstance(var, BoxVector) + if var.getsize() == 4: + loc = self.expand_single_float(const) + else: + loc = self.expand_double_float(const) + adr = self.assembler.datablockwrapper.malloc_aligned(16, 16) + x = c.getfloatstorage() + y = longlong.ZEROF + rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[0] = x + rffi.cast(rffi.CArrayPtr(longlong.FLOATSTORAGE), adr)[1] = y + self.reg_bindings[var] = loc + return loc + def expand_float(self, var, const): assert isinstance(var, BoxVector) if var.getsize() == 4: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit