def testSelectOp(self):
     self.setUp()
     with self.module.function_context("foo", [self.boolType],
                                       [self.i32Type]) as fun:
         a = E.constant_int(42, 32)
         b = E.constant_int(0, 32)
         E.ret([E.select(fun.arg(0), a, b)])
         printWithCurrentFunctionName(str(fun))
Esempio n. 2
0
    def testSelectOp(self):
        with self.module.function_context("foo", [self.boolType],
                                          [self.i32Type]) as fun:
            a = E.constant_int(42, 32)
            b = E.constant_int(0, 32)
            E.ret([E.select(fun.arg(0), a, b)])

        code = str(fun)
        self.assertIn("%0 = select %arg0, %c42_i32, %c0_i32 : i32", code)