Home - Summaries: (main) : (py3.11) : (py3.12) : Everything - Nightly builds - Benchmarks - RPython - Builders - About

pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_int_base_16

self = <pypy.module.pypyjit.test_pypy_c.test_string.TestString object at 0x0000000006d26fe0>

    def test_int_base_16(self):
        def main(n):
            i = 1
            while i < n:
                digits = '0123456789'
                i += int(digits[i % len(digits)], 16)
            return i
    
        log = self.run(main, [1100], import_site=True)
        assert log.result == main(1100)
        loop, = log.loops_by_filename(self.filepath)
        if sys.maxint > 2**32:
            args = (63, -3689348814741910323, 3)
        else:
            args = (31, -858993459, 3)
        assert loop.match("""
                i11 = int_lt(i6, i7)
                guard_true(i11, descr=...)
                guard_not_invalidated(descr=...)
                i13 = int_eq(i6, %d)         # value provided below
    
                # "mod 10" block:
                i79 = int_rshift(i6, %d)
                i80 = int_xor(i6, i79)
                i82 = uint_mul_high(i80, %d)
                i84 = uint_rshift(i82, %d)
                i85 = int_xor(i84, i79)
                i87 = int_mul(i85, 10)
                i19 = int_sub(i6, i87)
    
                i85 = int_add(i19, 1)   # not used
                p25 = newstr(1)
                i23 = strgetitem(ConstPtr(ptr92), i19)
                strsetitem(p25, 0, i23)
                i107 = call_i(ConstClass(string_to_int), p25, 16, 1, 1, 0, 1, descr=<Calli . riiiii EF=4>)
                guard_no_exception(descr=...)
                i95 = int_add_ovf(i6, i107)
                guard_no_overflow(descr=...)
                --TICK--
                jump(..., descr=...)
>           """ % ((-sys.maxint-1,)+args))

pypy/module/pypyjit/test_pypy_c/test_string.py:127: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pypy/module/pypyjit/test_pypy_c/model.py:177: in match
    return matcher.match(expected_src, **kwds)
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 0x00000000087de6e8>
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 = None
('operation mismatch',)
<could not determine information>

Ignore ops: []
Got:

	===== HERE =====
    guard_not_invalidated(descr=<Guard0x7f6064d48840>)
    i63 = int_lt(i58, i30)
    guard_true(i63, descr=<Guard0x7f6064d4ee58>)
    i65 = int_eq(i58, -9223372036854775808)
    i67 = int_rshift(i58, 63)
    i68 = int_xor(i58, i67)
    i70 = uint_mul_high(i68, -3689348814741910323)
    i72 = uint_rshift(i70, 3)
    i73 = int_xor(i72, i67)
    i75 = int_mul(i73, 10)
    i76 = int_sub(i58, i75)
    i78 = int_add(i76, 1)
    p79 = newstr(1)
    i81 = strgetitem(ConstPtr(ptr80), i76)
    strsetitem(p79, 0, i81)
    i88 = call_i(ConstClass(string_to_int), p79, 16, 1, 1, 0, 1, descr=<Calli 8 riiiii EF=4>)
    guard_no_exception(descr=<Guard0x7f6064d48890>)
    i89 = int_add_ovf(i58, i88)
    guard_no_overflow(descr=<Guard0x7f6064d4ee90>)
    i91 = getfield_raw_i(140052047137440, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i93 = int_lt(i91, 0)
    guard_false(i93, descr=<Guard0x7f6064d4ef00>)
    jump(p0, p1, p8, i89, i30, descr=TargetToken(140051985269216))

Expected:
    
    i11 = int_lt(i6, i7)
    guard_true(i11, descr=...)
    guard_not_invalidated(descr=...)
    i13 = int_eq(i6, -9223372036854775808)         # value provided below
    
    # "mod 10" block:
    i79 = int_rshift(i6, 63)
    i80 = int_xor(i6, i79)
    i82 = uint_mul_high(i80, -3689348814741910323)
    i84 = uint_rshift(i82, 3)
    i85 = int_xor(i84, i79)
    i87 = int_mul(i85, 10)
    i19 = int_sub(i6, i87)
    
    i85 = int_add(i19, 1)   # not used
    p25 = newstr(1)
    i23 = strgetitem(ConstPtr(ptr92), i19)
    strsetitem(p25, 0, i23)
    i107 = call_i(ConstClass(string_to_int), p25, 16, 1, 1, 0, 1, descr=<Calli . riiiii EF=4>)
    guard_no_exception(descr=...)
    i95 = int_add_ovf(i6, i107)
    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=...)
    
    jump(..., descr=...)
builder: pypy-c-jit-linux-x86-64 build #11971+
test: pypy/module/pypyjit/test_pypy_c/test_string.py::TestString::()::test_int_base_16