Home - Summaries: (main) : (py3.11) : 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 0x000001f1bdfb7d70>

    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:186: in match
    return matcher.match(expected_src, **kwds)
pypy\module\pypyjit\test_pypy_c\model.py:527: in match
    self.match_loop(expected_ops, ignore_ops)
pypy\module\pypyjit\test_pypy_c\model.py:503: in match_loop
    self.match_op(op, exp_op)
pypy\module\pypyjit\test_pypy_c\model.py:420: in match_op
    self._assert(self.match_var(arg, exp_arg), "variable mismatch: %r instead of %r" % (arg, exp_arg))
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <pypy.module.pypyjit.test_pypy_c.model.OpMatcher object at 0x000001f1c1d42250>
cond = False
message = "variable mismatch: 'ConstClass(ccall_log)' instead of 'ConstClass(log)'"

    def _assert(self, cond, message):
        if not cond:
>           raise InvalidMatch(message, frame=sys._getframe(1))
E           InvalidMatch: variable mismatch: 'ConstClass(ccall_log)' instead of 'ConstClass(log)'

pypy\module\pypyjit\test_pypy_c\model.py:405: InvalidMatch
---------- Captured stdout call ----------
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Loops don't match
=================
loop id = None
("variable mismatch: 'ConstClass(ccall_log)' instead of 'ConstClass(log)'",)
<could not determine information>

Ignore ops: []
Got:
    i56 = int_lt(i51, i31)
    guard_true(i56, descr=<Guard0x23a78a36260>)
    guard_not_invalidated(descr=<Guard0x23a78a30fe0>)
    f57 = cast_int_to_float(i51)
    i59 = float_le(f57, 0.000000)
    guard_false(i59, descr=<Guard0x23a78a31040>)

	===== HERE =====
    f61 = call_f(ConstClass(ccall_log), f57, descr=<Callf 8 f EF=2>)
    f63 = call_f(ConstClass(ccall_log10), f57, descr=<Callf 8 f EF=2>)
    f64 = float_sub(f61, f63)
    f65 = float_add(f49, f64)
    i67 = int_add(i51, 1)
    i69 = getfield_raw_i(140711600789008, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i71 = int_lt(i69, 0)
    guard_false(i71, descr=<Guard0x23a78a362a8>)
    jump(p0, p1, p6, p7, p10, p12, i67, f65, i31, descr=TargetToken(2450155323488))

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-win-x86-64 build #2372+
test: pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log