1 // RUN: mlir-opt -llvm-request-c-wrappers -convert-func-to-llvm %s | FileCheck %s
3 // CHECK: llvm.func private @res_attrs_with_memref_return() -> (!llvm.struct{{.*}} {test.returnOne})
4 // CHECK-LABEL: llvm.func @_mlir_ciface_res_attrs_with_memref_return
5 // CHECK-SAME: !llvm.ptr
6 // CHECK-NOT: test.returnOne
7 func.func private @res_attrs_with_memref_return() -> (memref<f32> {test.returnOne})
9 // CHECK: llvm.func private @res_attrs_with_value_return() -> (f32 {test.returnOne = 1 : i64})
10 // CHECK-LABEL: llvm.func @_mlir_ciface_res_attrs_with_value_return
11 // CHECK-SAME: -> (f32 {test.returnOne = 1 : i64})
12 func.func private @res_attrs_with_value_return() -> (f32 {test.returnOne = 1})
14 // CHECK: llvm.func private @multiple_return() -> !llvm.struct<{{.*}}>
15 // CHECK-LABEL: llvm.func @_mlir_ciface_multiple_return
16 // CHECK-NOT: test.returnOne
17 // CHECK-NOT: test.returnTwo
18 // CHECK-NOT: test.returnThree
19 func.func private @multiple_return() -> (memref<f32> {test.returnOne = 1}, f32 {test.returnTwo = 2, test.returnThree = 3})
21 // CHECK: llvm.func private @multiple_return_missing_res_attr() -> !llvm.struct<{{.*}}>
22 // CHECK-LABEL: llvm.func @_mlir_ciface_multiple_return_missing_res_attr
23 // CHECK-NOT: test.returnOne
24 // CHECK-NOT: test.returnTwo
25 // CHECK-NOT: test.returnThree
26 func.func private @multiple_return_missing_res_attr() -> (memref<f32> {test.returnOne = 1}, i64, f32 {test.returnTwo = 2, test.returnThree = 3})
28 // CHECK: llvm.func private @one_arg_attr_no_res_attrs_with_memref_return({{.*}}) -> !llvm.struct{{.*}}
29 // CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_no_res_attrs_with_memref_return
30 // CHECK-SAME: !llvm.ptr
31 // CHECK-SAME: !llvm.ptr
32 // CHECK-SAME: {test.argOne = 1 : i64})
33 func.func private @one_arg_attr_no_res_attrs_with_memref_return(%arg0: memref<f32> {test.argOne = 1}) -> memref<f32>
35 // CHECK: llvm.func private @one_arg_attr_one_res_attr_with_memref_return({{.*}}) -> (!llvm.struct<{{.*}}> {test.returnOne = 1 : i64})
36 // CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_one_res_attr_with_memref_return
37 // CHECK-SAME: !llvm.ptr
38 // CHECK-NOT: test.returnOne
39 // CHECK-SAME: !llvm.ptr
40 // CHECK-SAME: {test.argOne = 1 : i64})
41 func.func private @one_arg_attr_one_res_attr_with_memref_return(%arg0: memref<f32> {test.argOne = 1}) -> (memref<f32> {test.returnOne = 1})
43 // CHECK: llvm.func private @one_arg_attr_one_res_attr_with_value_return({{.*}}) -> (f32 {test.returnOne = 1 : i64})
44 // CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_one_res_attr_with_value_return
45 // CHECK-SAME: !llvm.ptr
46 // CHECK-SAME: {test.argOne = 1 : i64}
47 // CHECK-SAME: -> (f32 {test.returnOne = 1 : i64})
48 func.func private @one_arg_attr_one_res_attr_with_value_return(%arg0: memref<f32> {test.argOne = 1}) -> (f32 {test.returnOne = 1})
50 // CHECK: llvm.func private @multiple_arg_attr_multiple_res_attr({{.*}}) -> !llvm.struct<{{.*}}>
51 // CHECK-LABEL: llvm.func @_mlir_ciface_multiple_arg_attr_multiple_res_attr
52 // CHECK-SAME: !llvm.ptr
53 // CHECK-NOT: test.returnOne
54 // CHECK-NOT: test.returnTwo
55 // CHECK-SAME: !llvm.ptr
56 // CHECK-SAME: {test.argZero = 0 : i64}
58 // CHECK-SAME: i32 {test.argTwo = 2 : i64})
59 func.func private @multiple_arg_attr_multiple_res_attr(%arg0: memref<f32> {test.argZero = 0}, %arg1: f32, %arg2: i32 {test.argTwo = 2}) -> (f32, memref<i32> {test.returnOne = 1}, i32 {test.returnTwo = 2})
61 // CHECK: llvm.func private @drop_linkage_attr() -> (!llvm.struct{{.*}} {test.returnOne})
62 // CHECK-LABEL: llvm.func @_mlir_ciface_drop_linkage_attr
63 // CHECK-SAME: !llvm.ptr
64 // CHECK-NOT: llvm.linkage
65 func.func private @drop_linkage_attr() -> (memref<f32> {test.returnOne}) attributes { llvm.linkage = #llvm.linkage<weak> }