Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r78331:12de4acb3b37 Date: 2015-06-27 18:54 +0200 http://bitbucket.org/pypy/pypy/changeset/12de4acb3b37/
Log: all & any (but not any casting from float) execute correctly 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 @@ -545,7 +545,7 @@ def define_any_int(): return """ - a = astype([0,0,0,0,256,65537,0,0,0,0,0],int16) + a = astype([0,0,0,0,256,0,0,0,0,0,0],int16) any(a) """ @@ -567,20 +567,20 @@ any(a) """ - def test_float_any(self): + def test_any_float(self): result = self.run("float_any") assert int(result) == 1 self.check_vectorized(2, 2) - def test_float32_any(self): + def test_any_float32(self): result = self.run("float32_any") assert int(result) == 1 self.check_vectorized(1, 1) def test_any(self): - result = self.run("float_any") + result = self.run("any") assert int(result) == 1 - self.check_vectorized(1, 1) + self.check_vectorized(2, 1) def test_any_int(self): result = self.run("any_int") @@ -618,12 +618,12 @@ all(a) """ - def test_float_all(self): + def test_all_float(self): result = self.run("float_all") assert int(result) == 1 - self.check_vectorized(2, 2) + self.check_vectorized(1, 1) - def test_float_all(self): + def test_all_float32(self): result = self.run("float32_all") assert int(result) == 1 self.check_vectorized(2, 2) 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 @@ -1644,7 +1644,7 @@ self.mc.MOVD32_xr(resloc.value, eax.value) self.mc.PUNPCKLDQ_xx(resloc.value, loc1.value) - def genop_guard_vector_arg(self, guard_op, loc): + def _guard_vector_arg(self, guard_op, loc, zero=False): arg = guard_op.getarg(0) assert isinstance(arg, BoxVector) size = arg.item_size @@ -1653,16 +1653,18 @@ self.mc.PXOR(temp, temp) # if the vector is not fully packed blend 1s if not arg.fully_packed(self.cpu.vector_register_size): - self.mc.PCMPEQQ(temp, temp) # fill with ones + if not zero: + self.mc.PCMPEQQ(temp, temp) # fill with ones select = 0 bits_used = (arg.item_count * arg.item_size * 8) index = bits_used // 16 while index < 8: select |= (1 << index) index += 1 - self.mc.PBLENDW_xxi(loc, temp, select) + self.mc.PBLENDW_xxi(loc.value, temp.value, select) # reset to zeros - self.mc.PXOR(temp, temp) + if not zero: + self.mc.PXOR(temp, temp) self.mc.PCMPEQ(size, loc, temp) self.mc.PCMPEQQ(temp, temp) @@ -1671,8 +1673,8 @@ def genop_guard_guard_true(self, ign_1, guard_op, guard_token, locs, ign_2): loc = locs[0] if loc.is_xmm: - self.genop_guard_vector_arg(guard_op, loc) - self.implement_guard(guard_token, 'Z') + self._guard_vector_arg(guard_op, loc, zero=False) + self.implement_guard(guard_token, 'NZ') else: self.mc.TEST(loc, loc) self.implement_guard(guard_token, 'Z') @@ -1753,7 +1755,7 @@ def genop_guard_guard_false(self, ign_1, guard_op, guard_token, locs, ign_2): loc = locs[0] if loc.is_xmm: - self.genop_guard_vector_arg(guard_op, loc) + self._guard_vector_arg(guard_op, loc, zero=True) self.implement_guard(guard_token, 'Z') else: self.mc.TEST(loc, loc) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit