aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2016-05-26 10:55:13 +0200
committerArmin Rigo <arigo@tunes.org>2016-05-26 10:55:13 +0200
commit4b18164d388413249e01733b8ee7cc0144ce24bc (patch)
treedba51771ca73751f2880742c81ef27ff63f9fc23
parenthg merge default (diff)
downloadpypy-4b18164d388413249e01733b8ee7cc0144ce24bc.tar.gz
pypy-4b18164d388413249e01733b8ee7cc0144ce24bc.tar.bz2
pypy-4b18164d388413249e01733b8ee7cc0144ce24bc.zip
Re-enable some optimizations for int_py_div and int_py_mod
-rw-r--r--rpython/jit/codewriter/jtransform.py1
-rw-r--r--rpython/jit/metainterp/optimizeopt/intbounds.py32
-rw-r--r--rpython/jit/metainterp/optimizeopt/rewrite.py43
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py56
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py181
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_schedule.py9
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_util.py14
-rw-r--r--rpython/jit/metainterp/optimizeopt/test/test_vecopt.py5
8 files changed, 159 insertions, 182 deletions
diff --git a/rpython/jit/codewriter/jtransform.py b/rpython/jit/codewriter/jtransform.py
index d1fef89e8f..87b6b27b4b 100644
--- a/rpython/jit/codewriter/jtransform.py
+++ b/rpython/jit/codewriter/jtransform.py
@@ -1922,6 +1922,7 @@ class Transformer(object):
op.result)
return self.rewrite_operation(op0)
else:
+ # int.py_div, int.udiv, int.py_mod, int.umod
opname = oopspec_name.replace('.', '_')
os = getattr(EffectInfo, 'OS_' + opname.upper())
return self._handle_oopspec_call(op, args, os,
diff --git a/rpython/jit/metainterp/optimizeopt/intbounds.py b/rpython/jit/metainterp/optimizeopt/intbounds.py
index 2e93146969..a4a9ae122a 100644
--- a/rpython/jit/metainterp/optimizeopt/intbounds.py
+++ b/rpython/jit/metainterp/optimizeopt/intbounds.py
@@ -8,6 +8,7 @@ from rpython.jit.metainterp.optimizeopt.optimizer import (Optimization, CONST_1,
from rpython.jit.metainterp.optimizeopt.util import make_dispatcher_method
from rpython.jit.metainterp.resoperation import rop, AbstractResOp
from rpython.jit.metainterp.optimizeopt import vstring
+from rpython.jit.codewriter.effectinfo import EffectInfo
from rpython.rlib.rarithmetic import intmask
def get_integer_min(is_unsigned, byte_size):
@@ -172,25 +173,40 @@ class OptIntBounds(Optimization):
if b.bounded():
r.intersect(b)
- def XXX_optimize_INT_PY_DIV(self, op):
- b1 = self.getintbound(op.getarg(0))
- b2 = self.getintbound(op.getarg(1))
+ def optimize_CALL_PURE_I(self, op):
+ # dispatch based on 'oopspecindex' to a method that handles
+ # specifically the given oopspec call.
+ effectinfo = op.getdescr().get_extra_info()
+ oopspecindex = effectinfo.oopspecindex
+ if oopspecindex == EffectInfo.OS_INT_PY_DIV:
+ self.opt_call_INT_PY_DIV(op)
+ return
+ elif oopspecindex == EffectInfo.OS_INT_PY_MOD:
+ self.opt_call_INT_PY_MOD(op)
+ return
+ self.emit_operation(op)
+
+ def opt_call_INT_PY_DIV(self, op):
+ b1 = self.getintbound(op.getarg(1))
+ b2 = self.getintbound(op.getarg(2))
self.emit_operation(op)
r = self.getintbound(op)
r.intersect(b1.py_div_bound(b2))
- def XXX_optimize_INT_PY_MOD(self, op):
- b1 = self.getintbound(op.getarg(0))
- b2 = self.getintbound(op.getarg(1))
+ def opt_call_INT_PY_MOD(self, op):
+ b1 = self.getintbound(op.getarg(1))
+ b2 = self.getintbound(op.getarg(2))
if b2.is_constant():
val = b2.getint()
if val > 0 and (val & (val-1)) == 0:
# x % power-of-two ==> x & (power-of-two - 1)
# with Python's modulo, this is valid even if 'x' is negative.
- arg1 = op.getarg(0)
+ from rpython.jit.metainterp.history import DONT_CHANGE
+ arg1 = op.getarg(1)
arg2 = ConstInt(val-1)
op = self.replace_op_with(op, rop.INT_AND,
- args=[arg1, arg2])
+ args=[arg1, arg2],
+ descr=DONT_CHANGE) # <- xxx rename?
self.emit_operation(op)
if b2.is_constant():
val = b2.getint()
diff --git a/rpython/jit/metainterp/optimizeopt/rewrite.py b/rpython/jit/metainterp/optimizeopt/rewrite.py
index 5b210ce0c7..33e8ad921a 100644
--- a/rpython/jit/metainterp/optimizeopt/rewrite.py
+++ b/rpython/jit/metainterp/optimizeopt/rewrite.py
@@ -168,13 +168,13 @@ class OptRewrite(Optimization):
break
self.emit_operation(op)
- def XXX_optimize_UINT_FLOORDIV(self, op):
- b2 = self.getintbound(op.getarg(1))
-
+ def _optimize_CALL_INT_UDIV(self, op):
+ b2 = self.getintbound(op.getarg(2))
if b2.is_constant() and b2.getint() == 1:
- self.make_equal_to(op, op.getarg(0))
- else:
- self.emit_operation(op)
+ self.make_equal_to(op, op.getarg(1))
+ self.last_emitted_operation = REMOVED
+ return True
+ return False
def optimize_INT_LSHIFT(self, op):
b1 = self.getintbound(op.getarg(0))
@@ -663,6 +663,16 @@ class OptRewrite(Optimization):
self.make_constant(op, result)
self.last_emitted_operation = REMOVED
return
+ # dispatch based on 'oopspecindex' to a method that handles
+ # specifically the given oopspec call.
+ effectinfo = op.getdescr().get_extra_info()
+ oopspecindex = effectinfo.oopspecindex
+ if oopspecindex == EffectInfo.OS_INT_UDIV:
+ if self._optimize_CALL_INT_UDIV(op):
+ return
+ elif oopspecindex == EffectInfo.OS_INT_PY_DIV:
+ if self._optimize_CALL_INT_PY_DIV(op):
+ return
self.emit_operation(op)
optimize_CALL_PURE_R = optimize_CALL_PURE_I
optimize_CALL_PURE_F = optimize_CALL_PURE_I
@@ -678,26 +688,31 @@ class OptRewrite(Optimization):
def optimize_GUARD_FUTURE_CONDITION(self, op):
self.optimizer.notice_guard_future_condition(op)
- def XXX_optimize_INT_PY_DIV(self, op):
- arg0 = op.getarg(0)
- b1 = self.getintbound(arg0)
+ def _optimize_CALL_INT_PY_DIV(self, op):
arg1 = op.getarg(1)
- b2 = self.getintbound(arg1)
+ b1 = self.getintbound(arg1)
+ arg2 = op.getarg(2)
+ b2 = self.getintbound(arg2)
if b1.is_constant() and b1.getint() == 0:
self.make_constant_int(op, 0)
- return
+ self.last_emitted_operation = REMOVED
+ return True
# This is Python's integer division: 'x // (2**shift)' can always
# be replaced with 'x >> shift', even for negative values of x
if b2.is_constant():
val = b2.getint()
if val == 1:
- self.make_equal_to(op, arg0)
- return
+ self.make_equal_to(op, arg1)
+ self.last_emitted_operation = REMOVED
+ return True
elif val > 0 and val & (val - 1) == 0: # val == 2**shift
+ from rpython.jit.metainterp.history import DONT_CHANGE
op = self.replace_op_with(op, rop.INT_RSHIFT,
- args = [op.getarg(0), ConstInt(highest_bit(val))])
+ args=[arg1, ConstInt(highest_bit(val))],
+ descr=DONT_CHANGE) # <- xxx rename?
self.emit_operation(op)
+ return True
def optimize_CAST_PTR_TO_INT(self, op):
self.optimizer.pure_reverse(op)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
index 67dea87aef..c8e67a68ad 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py
@@ -1849,14 +1849,24 @@ class BaseTestOptimizeBasic(BaseTestBasic):
ops = """
[i0]
- i1 = int_py_div(0, i0)
+ i1 = int_mul(0, i0)
jump(i1)
"""
expected = """
[i0]
jump(0)
"""
- py.test.skip("XXX re-enable")
+ self.optimize_loop(ops, expected)
+
+ ops = """
+ [i0]
+ i1 = int_mul(1, i0)
+ jump(i1)
+ """
+ expected = """
+ [i0]
+ jump(i0)
+ """
self.optimize_loop(ops, expected)
def test_fold_partially_constant_ops_ovf(self):
@@ -4643,16 +4653,31 @@ class BaseTestOptimizeBasic(BaseTestBasic):
"""
self.optimize_strunicode_loop(ops, expected)
+ def test_intdiv_bounds(self):
+ ops = """
+ [i0]
+ i2 = call_pure_i(321, i0, 3, descr=int_py_div_descr)
+ i3 = int_add_ovf(i2, 50)
+ guard_no_overflow() []
+ jump(i3)
+ """
+ expected = """
+ [i0]
+ i2 = call_i(321, i0, 3, descr=int_py_div_descr)
+ i3 = int_add(i2, 50)
+ jump(i3)
+ """
+ self.optimize_loop(ops, expected)
+
def test_intmod_bounds(self):
- py.test.skip("XXX re-enable")
ops = """
[i0, i1]
- i2 = int_py_mod(i0, 12)
+ i2 = call_pure_i(321, i0, 12, descr=int_py_mod_descr)
i3 = int_ge(i2, 12)
guard_false(i3) []
i4 = int_lt(i2, 0)
guard_false(i4) []
- i5 = int_py_mod(i1, -12)
+ i5 = call_pure_i(321, i1, -12, descr=int_py_mod_descr)
i6 = int_le(i5, -12)
guard_false(i6) []
i7 = int_gt(i5, 0)
@@ -4661,8 +4686,8 @@ class BaseTestOptimizeBasic(BaseTestBasic):
"""
expected = """
[i0, i1]
- i2 = int_py_mod(i0, 12)
- i5 = int_py_mod(i1, -12)
+ i2 = call_i(321, i0, 12, descr=int_py_mod_descr)
+ i5 = call_i(321, i1, -12, descr=int_py_mod_descr)
jump(i2, i5)
"""
self.optimize_loop(ops, expected)
@@ -4672,25 +4697,27 @@ class BaseTestOptimizeBasic(BaseTestBasic):
ops = """
[i8, i9]
i0 = escape_i()
- i2 = int_py_mod(i0, 12)
+ i2 = call_pure_i(321, i0, 12, descr=int_py_mod_descr)
i3 = int_ge(i2, 11)
guard_false(i3) []
i4 = int_lt(i2, 1)
guard_false(i4) []
i1 = escape_i()
- i5 = int_py_mod(i1, -12)
+ i5 = call_pure_i(321, i1, -12, descr=int_py_mod_descr)
i6 = int_le(i5, -11)
guard_false(i6) []
i7 = int_gt(i5, -1)
guard_false(i7) []
jump(i2, i5)
"""
- self.optimize_loop(ops, ops)
+ self.optimize_loop(ops, ops.replace('call_pure_i', 'call_i'))
- # 'n % power-of-two' can always be turned into int_and()
+ # 'n % power-of-two' can always be turned into int_and(), even
+ # if n is possibly negative. That's by we handle 'int_py_mod'
+ # and not C-like mod.
ops = """
[i0]
- i1 = int_py_mod(i0, 8)
+ i1 = call_pure_i(321, i0, 8, descr=int_py_mod_descr)
finish(i1)
"""
expected = """
@@ -4701,15 +4728,14 @@ class BaseTestOptimizeBasic(BaseTestBasic):
self.optimize_loop(ops, expected)
def test_intmod_bounds_bug1(self):
- py.test.skip("XXX re-enable")
ops = """
[i0]
- i1 = int_py_mod(i0, %d)
+ i1 = call_pure_i(321, i0, %d, descr=int_py_mod_descr)
i2 = int_eq(i1, 0)
guard_false(i2) []
finish()
""" % (-(1<<(LONG_BIT-1)),)
- self.optimize_loop(ops, ops)
+ self.optimize_loop(ops, ops.replace('call_pure_i', 'call_i'))
def test_bounded_lazy_setfield(self):
ops = """
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
index 36c2b5bbbd..f9b5532b47 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizeopt.py
@@ -3491,10 +3491,9 @@ class OptimizeOptTest(BaseTestWithUnroll):
self.optimize_loop(ops, expected)
def test_fold_partially_constant_uint_floordiv(self):
- py.test.skip("XXX re-enable")
ops = """
[i0]
- i1 = uint_floordiv(i0, 1)
+ i1 = call_pure_i(321, i0, 1, descr=int_udiv_descr)
jump(i1)
"""
expected = """
@@ -5242,20 +5241,19 @@ class OptimizeOptTest(BaseTestWithUnroll):
self.optimize_loop(ops, expected, preamble)
def test_bound_floordiv(self):
- py.test.skip("XXX re-enable")
ops = """
[i0, i1, i2]
it1 = int_ge(i1, 0)
guard_true(it1) []
it2 = int_gt(i2, 0)
guard_true(it2) []
- ix2 = int_floordiv(i0, i1)
+ ix2 = call_pure_i(321, i0, i1, descr=int_py_div_descr)
ix2t = int_ge(ix2, 0)
guard_true(ix2t) []
- ix3 = int_floordiv(i1, i0)
+ ix3 = call_pure_i(321, i1, i0, descr=int_py_div_descr)
ix3t = int_ge(ix3, 0)
guard_true(ix3t) []
- ix4 = int_floordiv(i1, i2)
+ ix4 = call_pure_i(321, i1, i2, descr=int_py_div_descr)
ix4t = int_ge(ix4, 0)
guard_true(ix4t) []
jump(i0, i1, i2)
@@ -5266,13 +5264,14 @@ class OptimizeOptTest(BaseTestWithUnroll):
guard_true(it1) []
it2 = int_gt(i2, 0)
guard_true(it2) []
- ix2 = int_floordiv(i0, i1)
+ ix2 = call_i(321, i0, i1, descr=int_py_div_descr)
ix2t = int_ge(ix2, 0)
guard_true(ix2t) []
- ix3 = int_floordiv(i1, i0)
+ ix3 = call_i(321, i1, i0, descr=int_py_div_descr)
ix3t = int_ge(ix3, 0)
guard_true(ix3t) []
- ix4 = int_floordiv(i1, i2)
+ ix4 = call_i(321, i1, i2, descr=int_py_div_descr)
+ # <== the check that ix4 is nonnegative was removed
jump(i0, i1, i2)
"""
expected = """
@@ -5316,94 +5315,38 @@ class OptimizeOptTest(BaseTestWithUnroll):
"""
self.optimize_loop(ops, expected, preamble)
- def test_division(self):
- py.test.skip("XXX re-enable")
- ops = """
- [i7, i6, i8]
- it1 = int_gt(i7, 0)
- guard_true(it1) []
- it2 = int_gt(i6, 0)
- guard_true(it2) []
- i13 = int_is_zero(i6)
- guard_false(i13) []
- i15 = int_and(i8, i6)
- i17 = int_eq(i15, -1)
- guard_false(i17) []
- i18 = int_floordiv(i7, i6)
- i19 = int_xor(i7, i6)
- i21 = int_lt(i19, 0)
- i22 = int_mod(i7, i6)
- i23 = int_is_true(i22)
- i24 = int_and(i21, i23)
- i25 = int_sub(i18, i24)
- jump(i7, i25, i8)
- """
- preamble = """
- [i7, i6, i8]
- it1 = int_gt(i7, 0)
- guard_true(it1) []
- it2 = int_gt(i6, 0)
- guard_true(it2) []
- i15 = int_and(i8, i6)
- i17 = int_eq(i15, -1)
- guard_false(i17) []
- i18 = int_floordiv(i7, i6)
- i19 = int_xor(i7, i6)
- i22 = int_mod(i7, i6)
- i23 = int_is_true(i22)
- jump(i7, i18, i8)
- """
- expected = """
- [i7, i6, i8]
- it2 = int_gt(i6, 0)
- guard_true(it2) []
- i15 = int_and(i8, i6)
- i17 = int_eq(i15, -1)
- guard_false(i17) []
- i18 = int_floordiv(i7, i6)
- i19 = int_xor(i7, i6)
- i22 = int_mod(i7, i6)
- i23 = int_is_true(i22)
- jump(i7, i18, i8)
- """
- self.optimize_loop(ops, expected, preamble)
-
def test_division_to_rshift(self):
- py.test.skip("XXX re-enable")
ops = """
[i1, i2]
- it = int_gt(i1, 0)
- guard_true(it)[]
- i3 = int_floordiv(i1, i2)
- i4 = int_floordiv(2, i2)
- i5 = int_floordiv(i1, 2)
- i6 = int_floordiv(3, i2)
- i7 = int_floordiv(i1, 3)
- i8 = int_floordiv(4, i2)
- i9 = int_floordiv(i1, 4)
- i10 = int_floordiv(i1, 0)
- i11 = int_floordiv(i1, 1)
- i12 = int_floordiv(i2, 2)
- i13 = int_floordiv(i2, 3)
- i14 = int_floordiv(i2, 4)
- jump(i5, i14)
+ i3 = call_pure_i(321, i1, i2, descr=int_py_div_descr)
+ i4 = call_pure_i(322, 2, i2, descr=int_py_div_descr)
+ i6 = call_pure_i(323, 3, i2, descr=int_py_div_descr)
+ i8 = call_pure_i(324, 4, i2, descr=int_py_div_descr)
+ i9b = call_pure_i(325, i1, -2, descr=int_py_div_descr)
+ i9c = call_pure_i(326, i1, -1, descr=int_py_div_descr)
+ i10 = call_pure_i(327, i1, 0, descr=int_py_div_descr)
+ i11 = call_pure_i(328, i1, 1, descr=int_py_div_descr)
+ i5 = call_pure_i(329, i1, 2, descr=int_py_div_descr)
+ i7 = call_pure_i(330, i1, 3, descr=int_py_div_descr)
+ i9 = call_pure_i(331, i1, 4, descr=int_py_div_descr)
+ i9d = call_pure_i(332, i1, 6, descr=int_py_div_descr)
+ jump(i5, i9)
"""
expected = """
[i1, i2]
- it = int_gt(i1, 0)
- guard_true(it)[]
- i3 = int_floordiv(i1, i2)
- i4 = int_floordiv(2, i2)
+ i3 = call_i(321, i1, i2, descr=int_py_div_descr)
+ i4 = call_i(322, 2, i2, descr=int_py_div_descr)
+ i6 = call_i(323, 3, i2, descr=int_py_div_descr)
+ i8 = call_i(324, 4, i2, descr=int_py_div_descr)
+ i9b = call_i(325, i1, -2, descr=int_py_div_descr)
+ i9c = call_i(326, i1, -1, descr=int_py_div_descr)
+ i10 = call_i(327, i1, 0, descr=int_py_div_descr)
+ # i11 = i1
i5 = int_rshift(i1, 1)
- i6 = int_floordiv(3, i2)
- i7 = int_floordiv(i1, 3)
- i8 = int_floordiv(4, i2)
+ i7 = call_i(330, i1, 3, descr=int_py_div_descr)
i9 = int_rshift(i1, 2)
- i10 = int_floordiv(i1, 0)
- i12 = int_floordiv(i2, 2)
- i13 = int_floordiv(i2, 3)
- i14 = int_floordiv(i2, 4)
- jump(i5, i14)
+ i9d = call_i(332, i1, 6, descr=int_py_div_descr)
+ jump(i5, i9)
"""
self.optimize_loop(ops, expected)
@@ -5477,10 +5420,9 @@ class OptimizeOptTest(BaseTestWithUnroll):
self.optimize_loop(ops, expected)
def test_int_div_1(self):
- py.test.skip("XXX re-enable")
ops = """
[i0]
- i1 = int_floordiv(i0, 1)
+ i1 = call_pure_i(321, i0, 1, descr=int_py_div_descr)
jump(i1)
"""
expected = """
@@ -5489,55 +5431,20 @@ class OptimizeOptTest(BaseTestWithUnroll):
"""
self.optimize_loop(ops, expected)
- def test_division_nonneg(self):
- py.test.skip("XXX re-enable")
- py.test.skip("harder")
- # this is how an app-level division turns into right now
ops = """
- [i4]
- i1 = int_ge(i4, 0)
- guard_true(i1) []
- i16 = int_floordiv(i4, 3)
- i18 = int_mul(i16, 3)
- i19 = int_sub(i4, i18)
- i21 = int_rshift(i19, %d)
- i22 = int_add(i16, i21)
- finish(i22)
- """ % (LONG_BIT-1)
- expected = """
- [i4]
- i1 = int_ge(i4, 0)
- guard_true(i1) []
- i16 = int_floordiv(i4, 3)
- finish(i16)
+ [i0]
+ i1 = call_pure_i(321, 0, i0, descr=int_py_div_descr)
+ escape_n(i1)
+ jump(i0)
"""
- self.optimize_loop(ops, expected)
-
- def test_division_by_2(self):
- py.test.skip("XXX re-enable")
- py.test.skip("harder")
- ops = """
- [i4]
- i1 = int_ge(i4, 0)
- guard_true(i1) []
- i16 = int_floordiv(i4, 2)
- i18 = int_mul(i16, 2)
- i19 = int_sub(i4, i18)
- i21 = int_rshift(i19, %d)
- i22 = int_add(i16, i21)
- finish(i22)
- """ % (LONG_BIT-1)
expected = """
- [i4]
- i1 = int_ge(i4, 0)
- guard_true(i1) []
- i16 = int_rshift(i4, 1)
- finish(i16)
+ [i0]
+ escape_n(0)
+ jump(i0)
"""
self.optimize_loop(ops, expected)
def test_division_bound_bug(self):
- py.test.skip("XXX re-enable")
ops = """
[i4]
i1 = int_ge(i4, -50)
@@ -5546,15 +5453,15 @@ class OptimizeOptTest(BaseTestWithUnroll):
guard_true(i2) []
# here, -50 <= i4 <= -40
- i5 = int_floordiv(i4, 30)
- # here, we know that that i5 == -1 (C-style handling of negatives!)
+ i5 = call_pure_i(321, i4, 30, descr=int_py_div_descr)
+ # here, we know that that i5 == -2 (Python-style handling of negatives)
escape_n(i5)
jump(i4)
"""
expected = """
[i4, i5]
- escape_n(-1)
- jump(i4, -1)
+ escape_n(-2)
+ jump(i4, -2)
"""
self.optimize_loop(ops, expected)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_schedule.py b/rpython/jit/metainterp/optimizeopt/test/test_schedule.py
index 6d8f5d04eb..ac703bfc68 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_schedule.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_schedule.py
@@ -394,12 +394,11 @@ class Test(SchedulerBaseTest, LLtypeMixin):
self.assert_equal(loop2, loop3)
def test_no_vec_impl(self):
- py.test.skip("XXX re-enable")
loop1 = self.parse_trace("""
i10 = int_and(255, i1)
i11 = int_and(255, i2)
- i12 = uint_floordiv(i10,1)
- i13 = uint_floordiv(i11,1)
+ i12 = call_pure_i(321, i10)
+ i13 = call_pure_i(321, i11)
i14 = int_and(i1, i12)
i15 = int_and(i2, i13)
""")
@@ -413,9 +412,9 @@ class Test(SchedulerBaseTest, LLtypeMixin):
v4[2xi64] = vec_pack_i(v3[2xi64], i2, 1, 1)
v5[2xi64] = vec_int_and(v1[2xi64], v4[2xi64])
i10 = vec_unpack_i(v5[2xi64], 0, 1)
- i12 = uint_floordiv(i10,1)
+ i12 = call_pure_i(321, i10)
i11 = vec_unpack_i(v5[2xi64], 1, 1)
- i13 = uint_floordiv(i11,1)
+ i13 = call_pure_i(321, i11)
v6[0xi64] = vec_i()
v7[1xi64] = vec_pack_i(v6[2xi64], i12, 0, 1)
v8[2xi64] = vec_pack_i(v7[2xi64], i13, 1, 1)
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_util.py b/rpython/jit/metainterp/optimizeopt/test/test_util.py
index e5e8aec487..09a47ae54b 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_util.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_util.py
@@ -421,6 +421,20 @@ class LLtypeMixin(object):
jvr_vtable_adr = llmemory.cast_ptr_to_adr(jit_virtual_ref_vtable)
vref_descr = cpu.sizeof(vrefinfo.JIT_VIRTUAL_REF, jit_virtual_ref_vtable)
+ FUNC = lltype.FuncType([lltype.Signed, lltype.Signed], lltype.Signed)
+ ei = EffectInfo([], [], [], [], [], [], EffectInfo.EF_CANNOT_RAISE,
+ can_invalidate=False,
+ oopspecindex=EffectInfo.OS_INT_PY_DIV)
+ int_py_div_descr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, ei)
+ ei = EffectInfo([], [], [], [], [], [], EffectInfo.EF_CANNOT_RAISE,
+ can_invalidate=False,
+ oopspecindex=EffectInfo.OS_INT_UDIV)
+ int_udiv_descr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, ei)
+ ei = EffectInfo([], [], [], [], [], [], EffectInfo.EF_CANNOT_RAISE,
+ can_invalidate=False,
+ oopspecindex=EffectInfo.OS_INT_PY_MOD)
+ int_py_mod_descr = cpu.calldescrof(FUNC, FUNC.ARGS, FUNC.RESULT, ei)
+
namespace = locals()
# ____________________________________________________________
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
index a8a58476a6..4405b5645d 100644
--- a/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
+++ b/rpython/jit/metainterp/optimizeopt/test/test_vecopt.py
@@ -659,7 +659,7 @@ class BaseTestVectorize(VecTestHelper):
assert mref1.is_adjacent_after(mref5)
def test_array_memory_ref_div(self):
- py.test.skip("XXX re-enable")
+ py.test.skip("XXX rewrite or kill this test for the new divisions")
ops = """
[p0,i0]
i1 = int_floordiv(i0,2)
@@ -722,11 +722,10 @@ class BaseTestVectorize(VecTestHelper):
assert mref == mref2
def test_array_memory_ref_diff_not_equal(self):
- py.test.skip("XXX re-enable")
ops = """
[p0,i0]
i1 = int_add(i0,4)
- i2 = int_floordiv(i1,2)
+ i2 = int_sub(i1,3) # XXX used to be "divide by 4", not sure about it
i3 = raw_load_i(p0,i2,descr=chararraydescr)
i4 = int_add(i0,2)
i5 = int_mul(i4,2)