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_sin_cos

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

    def test_sin_cos(self):
        def main(n):
            import math
    
            i = 1
            s = 0.0
            while i < n:
                s += math.sin(i) - math.cos(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)
                i6 = --ISINF--(f1)
                guard_false(i6, descr=...)
                f2 = call_f(ConstClass(sin), f1, descr=<Callf . f EF=0>)
                f3 = call_f(ConstClass(cos), f1, descr=<Callf . f EF=0>)
                f4 = float_sub(f2, f3)
                f5 = float_add(f0, f4)
                i7 = int_add(i0, 1)
                --TICK--
                jump(..., descr=)
            """)

pypy/module/pypyjit/test_pypy_c/test_math.py:48: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
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 0x10f86290>
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=<Guard0xf48e4ce0>)
    i56 = int_lt(i51, i30)
    guard_true(i56, descr=<Guard0xf489110c>)
    f57 = cast_int_to_float(i51)
    f59 = float_add(f57, 11235582092889474423308157442431404585112356118389416079589380072358292237843810195794279832650471001320007117491962084853674360550901038905802964414967132773610493339054092829768888725077880882465817684505312860552384417646403930092119569408801702322709406917786643639996702871154982269052209770601514008576.000000)
    i60 = float_eq(f59, f57)
    guard_false(i60, descr=<Guard0xf4891144>)
    f62 = call_f(ConstClass(sin), f57, descr=<Callf 8 f EF=0>)
    f64 = call_f(ConstClass(cos), f57, descr=<Callf 8 f EF=0>)
    f65 = float_sub(f62, f64)
    f66 = float_add(f49, f65)
    i68 = int_add(i51, 1)
    i70 = getfield_raw_i(-134812544, descr=<FieldS pypysig_long_struct_inner.c_value 0>)
    i72 = int_lt(i70, 0)
    guard_false(i72, descr=<Guard0xf48e4d08>)
    jump(p0, p1, p8, p10, i68, f66, i30, descr=TargetToken(-191566664))

Expected:
    
    i2 = int_lt(i0, i1)
    guard_true(i2, descr=...)
    guard_not_invalidated(descr=...)
    f1 = cast_int_to_float(i0)
    f1\B999 = float_add(f1, ...)
    i6 = float_eq(f1\B999, f1)
    guard_false(i6, descr=...)
    f2 = call_f(ConstClass(sin), f1, descr=<Callf . f EF=0>)
    f3 = call_f(ConstClass(cos), f1, descr=<Callf . f EF=0>)
    f4 = float_sub(f2, f3)
    f5 = float_add(f0, f4)
    i7 = 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-32 build #8482+
test: pypy/module/pypyjit/test_pypy_c/test_math.py::TestMath::()::test_sin_cos