1 // RUN: mlir-opt -split-input-file -convert-func-to-emitc %s | FileCheck %s
3 // CHECK-LABEL: emitc.func @foo()
11 // CHECK-LABEL: emitc.func private @foo() attributes {specifiers = ["static"]}
13 func.func private @foo() {
19 // CHECK-LABEL: emitc.func @foo(%arg0: i32)
20 func.func @foo(%arg0: i32) {
21 emitc.call_opaque "bar"(%arg0) : (i32) -> ()
27 // CHECK-LABEL: emitc.func @foo(%arg0: i32) -> i32
28 // CHECK-NEXT: return %arg0 : i32
29 func.func @foo(%arg0: i32) -> i32 {
35 // CHECK-LABEL: emitc.func @foo(%arg0: i32, %arg1: i32) -> i32
36 func.func @foo(%arg0: i32, %arg1: i32) -> i32 {
37 %0 = "emitc.add" (%arg0, %arg1) : (i32, i32) -> i32
43 // CHECK-LABEL: emitc.func private @return_i32(%arg0: i32) -> i32 attributes {specifiers = ["static"]}
44 // CHECK-NEXT: return %arg0 : i32
45 func.func private @return_i32(%arg0: i32) -> i32 {
49 // CHECK-LABEL: emitc.func @call(%arg0: i32) -> i32
50 // CHECK-NEXT: %0 = call @return_i32(%arg0) : (i32) -> i32
51 // CHECK-NEXT: return %0 : i32
52 func.func @call(%arg0: i32) -> i32 {
53 %0 = call @return_i32(%arg0) : (i32) -> (i32)
59 // CHECK-LABEL: emitc.func private @return_i32(i32) -> i32 attributes {specifiers = ["extern"]}
60 func.func private @return_i32(%arg0: i32) -> i32
64 // CHECK-LABEL: emitc.func private @return_void() attributes {specifiers = ["static"]}
66 func.func private @return_void() {
70 // CHECK-LABEL: emitc.func @call()
71 // CHECK-NEXT: call @return_void() : () -> ()
74 call @return_void() : () -> ()