def test_bound_inst_inference1(self): # Second example taken from issue #26 x = XForm( Rtl(self.v0 << iadd(self.v1, self.v2), ), Rtl(self.v3 << uextend(self.v1), self.v4 << uextend(self.v2), self.v5 << iadd.i32(self.v3, self.v4), self.v0 << ireduce(self.v5))) itype = TypeVar("t", "", ints=True, simd=True) i32t = TypeVar.singleton(i32) check_typing(x.ti, ({ self.v0: itype, self.v1: itype, self.v2: itype, self.v3: i32t, self.v4: i32t, self.v5: i32t, }, [WiderOrEq(i32t, itype)]), x.symtab)
def test_bound_inst_inference1(self): # Second example taken from issue #26 x = XForm( Rtl( self.v0 << iadd(self.v1, self.v2), ), Rtl( self.v3 << uextend(self.v1), self.v4 << uextend(self.v2), self.v5 << iadd.i32(self.v3, self.v4), self.v0 << ireduce(self.v5) )) itype = TypeVar("t", "", ints=True, simd=True) i32t = TypeVar.singleton(i32) check_typing(x.ti, ({ self.v0: itype, self.v1: itype, self.v2: itype, self.v3: i32t, self.v4: i32t, self.v5: i32t, }, [WiderOrEq(i32t, itype)]), x.symtab)
def test_elaborate_iadd_simple(self): # type: () -> None i32.by(2) # Make sure i32x2 exists. x = Var('x') y = Var('y') a = Var('a') bvx = Var('bvx') bvy = Var('bvy') bva = Var('bva') r = Rtl( a << iadd.i32(x, y), ) r.cleanup_concrete_rtl() sem = elaborate(r) exp = Rtl( bvx << prim_to_bv.i32(x), bvy << prim_to_bv.i32(y), bva << bvadd.bv32(bvx, bvy), a << prim_from_bv.i32(bva) ) exp.cleanup_concrete_rtl() assert concrete_rtls_eq(sem, exp)
def test_single_ins(self): pat = a << iadd.i32(x, y) self.assertEqual(repr(pat), "('a',) << Apply(iadd.i32, ('x', 'y'))")
def test_apply(self): i = jump(x, y) self.assertEqual(repr(i), "Apply(jump, ('x', 'y'))") i = iadd.i32(x, y) self.assertEqual(repr(i), "Apply(iadd.i32, ('x', 'y'))")