def test_bint(self): # type: () -> None x = Var('x') y = Var('y') z = Var('z') w = Var('w') v = Var('v') u = Var('u') r = Rtl( z << iadd(x, y), w << bint(v), u << iadd(z, w) ) r1 = r.copy({}) s = r.substitution(r1, {}) s[x].set_typevar(TypeVar.singleton(i32.by(8))) s[z].set_typevar(TypeVar.singleton(i32.by(8))) # TODO: Relax this to simd=True s[v].set_typevar(TypeVar('v', '', bools=(1, 1), simd=(8, 8))) r1.cleanup_concrete_rtl() assert s is not None assert s[x].get_typevar().singleton_type() == i32.by(8) assert s[y].get_typevar().singleton_type() == i32.by(8) assert s[z].get_typevar().singleton_type() == i32.by(8) assert s[w].get_typevar().singleton_type() == i32.by(8) assert s[u].get_typevar().singleton_type() == i32.by(8) assert s[v].get_typevar().singleton_type() == b1.by(8)
def test_iadd_cin(self): # type: () -> None x = XForm( Rtl(self.v0 << iadd_cin(self.v1, self.v2, self.v3)), Rtl(self.v4 << iadd(self.v1, self.v2), self.v5 << bint(self.v3), self.v0 << iadd(self.v4, self.v5))) itype = TypeVar("t", "", ints=True, simd=(1, 1)) check_typing(x.ti, ({ self.v0: itype, self.v1: itype, self.v2: itype, self.v3: self.b1, self.v4: itype, self.v5: itype, }, []), x.symtab)
def test_iadd_cin(self): # type: () -> None x = XForm(Rtl(self.v0 << iadd_cin(self.v1, self.v2, self.v3)), Rtl( self.v4 << iadd(self.v1, self.v2), self.v5 << bint(self.v3), self.v0 << iadd(self.v4, self.v5) )) itype = TypeVar("t", "", ints=True, simd=(1, 1)) check_typing(x.ti, ({ self.v0: itype, self.v1: itype, self.v2: itype, self.v3: self.b1, self.v4: itype, self.v5: itype, }, []), x.symtab)
def test_bint(self): # type: () -> None r = Rtl(self.v4 << iadd(self.v1, self.v2), self.v5 << bint(self.v3), self.v0 << iadd(self.v4, self.v5)) ti = TypeEnv() typing = ti_rtl(r, ti) itype = TypeVar("t", "", ints=True, simd=(1, 256)) btype = TypeVar("b", "", bools=True, simd=True) # Check that self.v5 gets the same integer type as # the rest of them # TODO: Add constraint nlanes(v3) == nlanes(v1) when we # add that type constraint to bint check_typing(typing, ({ self.v1: itype, self.v2: itype, self.v4: itype, self.v5: itype, self.v3: btype, self.v0: itype, }, []))
def test_bint(self): # type: () -> None r = Rtl( self.v4 << iadd(self.v1, self.v2), self.v5 << bint(self.v3), self.v0 << iadd(self.v4, self.v5) ) ti = TypeEnv() typing = ti_rtl(r, ti) itype = TypeVar("t", "", ints=True, simd=(1, 256)) btype = TypeVar("b", "", bools=True, simd=True) # Check that self.v5 gets the same integer type as # the rest of them # TODO: Add constraint nlanes(v3) == nlanes(v1) when we # add that type constraint to bint check_typing(typing, ({ self.v1: itype, self.v2: itype, self.v4: itype, self.v5: itype, self.v3: btype, self.v0: itype, }, []))