pypy/module/pypyjit/test_pypy_c/test_intbound.py::TestIntbound::()::test_abs_branch_free
self = <pypy.module.pypyjit.test_pypy_c.test_intbound.TestIntbound object at 0x000000000d3e2480>
def test_abs_branch_free(self):
import sys
def main(start, stop):
res = 0
for i in range(start, stop):
res += abs(i) # ID: abs
return res
log = self.run(main, [-10000, 10000])
loop, = log.loops_by_filename(self.filepath)
assert loop.match_by_id('abs', """
setfield_gc(p18, i60, descr=...)
guard_not_invalidated(descr=...)
i63 = int_eq(i58, ...) # check whether it's MININT
guard_false(i63, descr=...)
i65 = int_rshift(i58, %s)
i66 = int_xor(i58, i65)
i67 = int_sub(i66, i65)
i68 = int_add_ovf(i51, i67)
guard_no_overflow(descr=...)
--TICK--
> """ % sys.maxsize.bit_length())
pypy/module/pypyjit/test_pypy_c/test_intbound.py:322:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pypy/module/pypyjit/test_pypy_c/model.py:182: in match_by_id
return matcher.match(expected_src, ignore_ops=ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:524: in match
self.match_loop(expected_ops, ignore_ops)
pypy/module/pypyjit/test_pypy_c/model.py:500: in match_loop
self.match_op(op, exp_op)
pypy/module/pypyjit/test_pypy_c/model.py:409: in match_op
self._assert(op.name == exp_opname, "operation mismatch")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x000000000a4145d0>
cond = False, message = 'operation mismatch'
def _assert(self, cond, message):
if not cond:
> raise InvalidMatch(message, frame=sys._getframe(1))
E InvalidMatch: operation mismatch
pypy/module/pypyjit/test_pypy_c/model.py:402: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = 'abs'
('operation mismatch',)
<could not determine information>
Ignore ops: []
Got:
setfield_gc(p16, i47, descr=<FieldS pypy.module.__builtin__.functional.W_IntRangeIterator.inst_current 8>)
===== HERE =====
i49 = int_eq(i44, -9223372036854775808)
guard_false(i49, descr=<Guard0x7f12f089f830>)
i52 = int_rshift(i44, 63)
i53 = int_xor(i44, i52)
i54 = int_sub(i53, i52)
i55 = int_add_ovf(i39, i54)
guard_no_overflow(descr=<Guard0x7f12f06804f0>)
i57 = getfield_raw_i(139719317195424, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i59 = int_lt(i57, 0)
guard_false(i59, descr=<Guard0x7f12f0680560>)
Expected:
setfield_gc(p18, i60, descr=...)
guard_not_invalidated(descr=...)
i63 = int_eq(i58, ...) # check whether it's MININT
guard_false(i63, descr=...)
i65 = int_rshift(i58, 63)
i66 = int_xor(i58, i65)
i67 = int_sub(i66, i65)
i68 = int_add_ovf(i51, i67)
guard_no_overflow(descr=...)
guard_not_invalidated?
ticker0 = getfield_raw_i(#, descr=<FieldS pypysig_long_struct_inner.c_value .*>)
ticker_cond0 = int_lt(ticker0, 0)
guard_false(ticker_cond0, descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_intbound.py::TestIntbound::()::test_abs_branch_free