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

pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log

self = <pypy.module.pypyjit.test_pypy_c.test_math.TestMath object at 0x000000000d564790>

    def test_log(self):
        def main(n):
            import math
    
            i = 1
            s = 0.0
            while i < n:
                s += math.log(i) - math.log10(i)
                i += 1
            return s
        log = self.run(main, [500])
        assert round(log.result, 6) == round(main(500), 6)
        loop, = log.loops_by_filename(self.filepath)
>       assert loop.match("""
                i2 = int_lt(i0, i1)
                guard_true(i2, descr=...)
                guard_not_invalidated(descr=...)
                f1 = cast_int_to_float(i0)
                i3 = float_le(f1, 0.0)
                guard_false(i3, descr=...)
                f2 = call_f(ConstClass(log), f1, descr=<Callf . f EF=2>)
                f3 = call_f(ConstClass(log10), f1, descr=<Callf . f EF=2>)
                f4 = float_sub(f2, f3)
                f5 = float_add(f0, f4)
                i4 = int_add(i0, 1)
                --TICK--
                jump(..., descr=...)
            """)

pypy/module/pypyjit/test_pypy_c/test_math.py:19: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x000000000cc460c8>
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=<Guard0x7f3cc9de39c0>)
    i55 = int_lt(i50, i30)
    guard_true(i55, descr=<Guard0x7f3cc9d11018>)
    f56 = cast_int_to_float(i50)
    i58 = float_le(f56, 0.000000)
    guard_false(i58, descr=<Guard0x7f3cc9d11088>)
    f60 = call_f(ConstClass(log), f56, descr=<Callf 8 f EF=2>)
    f62 = call_f(ConstClass(log10), f56, descr=<Callf 8 f EF=2>)
    f63 = float_sub(f60, f62)
    f64 = float_add(f48, f63)
    i66 = int_add(i50, 1)
    i68 = getfield_raw_i(139899122813600, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i70 = int_lt(i68, 0)
    guard_false(i70, descr=<Guard0x7f3cc9de3a10>)
    jump(p0, p1, p8, p10, i66, f64, i30, descr=TargetToken(139899060694176))

Expected:
    
    i2 = int_lt(i0, i1)
    guard_true(i2, descr=...)
    guard_not_invalidated(descr=...)
    f1 = cast_int_to_float(i0)
    i3 = float_le(f1, 0.0)
    guard_false(i3, descr=...)
    f2 = call_f(ConstClass(log), f1, descr=<Callf . f EF=2>)
    f3 = call_f(ConstClass(log10), f1, descr=<Callf . f EF=2>)
    f4 = float_sub(f2, f3)
    f5 = float_add(f0, f4)
    i4 = int_add(i0, 1)
    
    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_math.py::TestMath::()::test_log