pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log
self = <pypy.module.pypyjit.test_pypy_c.test_math.TestMath object at 0x0000018e43c4f168>
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:417: 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 0x0000018e490ba480>
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:402: 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:
i55 = int_lt(i50, i29)
guard_true(i55, descr=<Guard0x22f8ae4ba48>)
guard_not_invalidated(descr=<Guard0x22f8aea8440>)
f56 = cast_int_to_float(i50)
i58 = float_le(f56, 0.000000)
guard_false(i58, descr=<Guard0x22f8aea84a0>)
===== HERE =====
f60 = call_f(ConstClass(ccall_log), f56, descr=<Callf 8 f EF=2>)
f62 = call_f(ConstClass(ccall_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(140710487320096, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
i70 = int_lt(i68, 0)
guard_false(i70, descr=<Guard0x22f8ae4ba90>)
jump(p0, p1, p8, p10, i66, f64, i29, descr=TargetToken(2403217135392))
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 #2434+
test: pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_log