diff options
Diffstat (limited to 'rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py')
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py index ac115639fc..44189ad6af 100644 --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py @@ -5955,6 +5955,18 @@ class TestOptimizeBasic(BaseTestBasic): """ self.optimize_loop(ops, expected) + def test_int_xor_same_arg(self): + ops = """ + [i0] + i1 = int_xor(i0, i0) + jump(i1) + """ + expected = """ + [i0] + jump(0) + """ + self.optimize_loop(ops, expected) + def test_consecutive_getinteriorfields(self): py.test.skip("we want this to pass") ops = """ @@ -6304,6 +6316,74 @@ class TestOptimizeBasic(BaseTestBasic): """ self.optimize_loop(ops, expected) + def test_int_or_xor_upper(self): + ops = """ + [p0, p1] + i0 = arraylen_gc(p0, descr=arraydescr) + i2 = int_lt(i0, 17) + guard_true(i2) [] + i1 = arraylen_gc(p1, descr=arraydescr) + i3 = int_lt(i1, 17) + guard_true(i3) [] + i57 = int_or(i1, i0) + i62 = int_lt(i57, 40) + guard_true(i62) [] + """ + expected = """ + [p0, p1] + i0 = arraylen_gc(p0, descr=arraydescr) + i2 = int_lt(i0, 17) + guard_true(i2) [] + i1 = arraylen_gc(p1, descr=arraydescr) + i3 = int_lt(i1, 17) + guard_true(i3) [] + i57 = int_or(i1, i0) + """ + self.optimize_loop(ops, expected) + self.optimize_loop(ops.replace("int_or", "int_xor"), expected.replace("int_or", "int_xor")) + + def test_int_or_lower(self): + ops = """ + [i0, i1] + i2 = int_ge(i0, 17) + guard_true(i2) [] + i3 = int_ge(i1, 100) + guard_true(i3) [] + i57 = int_or(i1, i0) + i62 = int_ge(i57, 100) + guard_true(i62) [] + """ + expected = """ + [i0, i1] + i2 = int_ge(i0, 17) + guard_true(i2) [] + i3 = int_ge(i1, 100) + guard_true(i3) [] + i57 = int_or(i1, i0) + """ + self.optimize_loop(ops, expected) + + def test_int_xor_lower(self): + ops = """ + [i0, i1] + i2 = int_ge(i0, 17) + guard_true(i2) [] + i3 = int_ge(i1, 100) + guard_true(i3) [] + i57 = int_xor(i1, i0) + i62 = int_ge(i57, 0) + guard_true(i62) [] + """ + expected = """ + [i0, i1] + i2 = int_ge(i0, 17) + guard_true(i2) [] + i3 = int_ge(i1, 100) + guard_true(i3) [] + i57 = int_xor(i1, i0) + """ + self.optimize_loop(ops, expected) + def test_convert_float_bytes_to_longlong(self): ops = """ [f0, i0] |