diff options
Diffstat (limited to 'rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py')
-rw-r--r-- | rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py index 4daf55065d..ac115639fc 100644 --- a/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_optimizebasic.py @@ -6325,3 +6325,81 @@ class TestOptimizeBasic(BaseTestBasic): escape_i(i0) """ self.optimize_loop(ops, expected) + + def test_int_invert(self): + ops = """ + [p0] + i1 = arraylen_gc(p0, descr=arraydescr) # known >= 0 + i2 = int_invert(i1) + i3 = int_lt(i2, 0) + guard_true(i3) [] + """ + expected = """ + [p0] + i1 = arraylen_gc(p0, descr=arraydescr) # known >= 0 + i2 = int_invert(i1) + """ + self.optimize_loop(ops, expected) + + def test_int_invert_invert(self): + ops = """ + [i1] + i2 = int_invert(i1) + i3 = int_invert(i2) + escape_i(i3) + """ + expected = """ + [i1] + i2 = int_invert(i1) + escape_i(i1) + """ + self.optimize_loop(ops, expected) + + def test_int_invert_postprocess(self): + ops = """ + [i1] + i2 = int_invert(i1) + i3 = int_lt(i2, 0) + guard_true(i3) [] + i4 = int_ge(i1, 0) + guard_true(i4) [] + """ + expected = """ + [i1] + i2 = int_invert(i1) + i3 = int_lt(i2, 0) + guard_true(i3) [] + """ + self.optimize_loop(ops, expected) + + def test_int_neg(self): + ops = """ + [p0] + i1 = arraylen_gc(p0, descr=arraydescr) # known >= 0 + i2 = int_neg(i1) + i3 = int_le(i2, 0) + guard_true(i3) [] + """ + expected = """ + [p0] + i1 = arraylen_gc(p0, descr=arraydescr) # known >= 0 + i2 = int_neg(i1) + """ + self.optimize_loop(ops, expected) + + def test_int_neg_postprocess(self): + ops = """ + [i1] + i2 = int_neg(i1) + i3 = int_le(i2, 0) + guard_true(i3) [] + i4 = int_ge(i1, 0) + guard_true(i4) [] + """ + expected = """ + [i1] + i2 = int_neg(i1) + i3 = int_le(i2, 0) + guard_true(i3) [] + """ + self.optimize_loop(ops, expected) |