Example #1
0
 def test_vselect_vsplits_vconcats(self):
     # type: () -> None
     r = Rtl(
             self.v3 << vselect(self.v0, self.v1, self.v2),
             (self.v4, self.v5) << vsplit(self.v3),
             (self.v6, self.v7) << vsplit(self.v4),
             self.v8 << vconcat(self.v3, self.v3),
             self.v9 << vconcat(self.v8, self.v8),
     )
     ti = TypeEnv()
     typing = ti_rtl(r, ti)
     t = TypeVar("t", "", ints=True, bools=True, floats=True,
                 simd=(4, 64))
     check_typing(typing, ({
         self.v0: t.as_bool(),
         self.v1: t,
         self.v2: t,
         self.v3: t,
         self.v4: t.half_vector(),
         self.v5: t.half_vector(),
         self.v6: t.half_vector().half_vector(),
         self.v7: t.half_vector().half_vector(),
         self.v8: t.double_vector(),
         self.v9: t.double_vector().double_vector(),
     }, []))
Example #2
0
 def test_vselect_vsplits_vconcats(self):
     # type: () -> None
     r = Rtl(
             self.v3 << vselect(self.v0, self.v1, self.v2),
             (self.v4, self.v5) << vsplit(self.v3),
             (self.v6, self.v7) << vsplit(self.v4),
             self.v8 << vconcat(self.v3, self.v3),
             self.v9 << vconcat(self.v8, self.v8),
     )
     ti = TypeEnv()
     typing = ti_rtl(r, ti)
     t = TypeVar("t", "", ints=True, bools=True, floats=True,
                 simd=(4, 64))
     check_typing(typing, ({
         self.v0: t.as_bool(),
         self.v1: t,
         self.v2: t,
         self.v3: t,
         self.v4: t.half_vector(),
         self.v5: t.half_vector(),
         self.v6: t.half_vector().half_vector(),
         self.v7: t.half_vector().half_vector(),
         self.v8: t.double_vector(),
         self.v9: t.double_vector().double_vector(),
     }, []))
Example #3
0
    def test_lanes_check(self):
        # type: () -> None
        x = XForm(Rtl(self.v0 << copy(self.v1)),
                  Rtl((self.v2, self.v3) << vsplit(self.v1),
                      self.v0 << vconcat(self.v2, self.v3)))

        WideVec = TypeSet(lanes=(2, 256), ints=(8, 64), floats=(32, 64),
                          bools=(1, 64))
        self.check_yo_check(x, typeset_check(self.v1, WideVec))
Example #4
0
 def test_bad_rtl1(self):
     # type: () -> None
     r = Rtl(
             (self.v0, self.v1) << vsplit(self.v2),
             self.v3 << vconcat(self.v0, self.v2),
     )
     ti = TypeEnv()
     self.assertEqual(ti_rtl(r, ti),
                      "On line 1: fail ti on `typeof_v2` <: `1`: " +
                      "Error: empty type created when unifying " +
                      "`typeof_v2` and `half_vector(typeof_v2)`")
Example #5
0
 def test_bad_rtl1(self):
     # type: () -> None
     r = Rtl(
         (self.v0, self.v1) << vsplit(self.v2),
         self.v3 << vconcat(self.v0, self.v2),
     )
     ti = TypeEnv()
     self.assertEqual(
         ti_rtl(r, ti), "On line 1: fail ti on `typeof_v2` <: `1`: " +
         "Error: empty type created when unifying " +
         "`typeof_v2` and `half_vector(typeof_v2)`")
Example #6
0
    def test_lanes_check(self):
        # type: () -> None
        x = XForm(
            Rtl(self.v0 << copy(self.v1)),
            Rtl((self.v2, self.v3) << vsplit(self.v1),
                self.v0 << vconcat(self.v2, self.v3)))

        WideVec = TypeSet(lanes=(2, 256),
                          ints=(8, 64),
                          floats=(32, 64),
                          bools=(1, 64))
        self.check_yo_check(x, typeset_check(self.v1, WideVec))