aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/python/dialects/llvm.py
diff options
context:
space:
mode:
Diffstat (limited to 'mlir/test/python/dialects/llvm.py')
-rw-r--r--mlir/test/python/dialects/llvm.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/mlir/test/python/dialects/llvm.py b/mlir/test/python/dialects/llvm.py
index d9ffdeb6..8ea0fdd 100644
--- a/mlir/test/python/dialects/llvm.py
+++ b/mlir/test/python/dialects/llvm.py
@@ -150,3 +150,22 @@ def testIntrinsics():
result = llvm.intr_memset(alloca, c_0, c_128, False)
# CHECK: "llvm.intr.memset"(%[[ALLOCA]], %[[CST0]], %[[CST128]]) <{isVolatile = false}> : (!llvm.ptr, i8, i32) -> ()
print(result)
+
+
+# CHECK-LABEL: testTranslateToLLVMIR
+@constructAndPrintInModule
+def testTranslateToLLVMIR():
+ with Context(), Location.unknown():
+ module = Module.parse(
+ """\
+ llvm.func @add(%arg0: i64, %arg1: i64) -> i64 {
+ %0 = llvm.add %arg0, %arg1 : i64
+ llvm.return %0 : i64
+ }
+ """
+ )
+ # CHECK: define i64 @add(i64 %0, i64 %1) {
+ # CHECK: %3 = add i64 %0, %1
+ # CHECK: ret i64 %3
+ # CHECK: }
+ print(llvm.translate_module_to_llvmir(module.operation))