brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.2 KiB · 826ca95 Raw
99 lines · plain
1// RUN: mlir-opt -llvm-request-c-wrappers -convert-func-to-llvm %s | FileCheck %s2 3// CHECK: llvm.func @res_attrs_with_memref_return() -> (!llvm.struct{{.*}} {test.returnOne})4// CHECK-LABEL: llvm.func @_mlir_ciface_res_attrs_with_memref_return5// CHECK-NOT: test.returnOne6func.func @res_attrs_with_memref_return() -> (memref<f32> {test.returnOne}) {7  %0 = memref.alloc() : memref<f32>8  return %0 : memref<f32>9}10 11// CHECK: llvm.func @res_attrs_with_value_return() -> (f32 {test.returnOne = 1 : i64})12// CHECK-LABEL: llvm.func @_mlir_ciface_res_attrs_with_value_return13// CHECK-SAME: -> (f32 {test.returnOne = 1 : i64})14func.func @res_attrs_with_value_return() -> (f32 {test.returnOne = 1}) {15  %0 = arith.constant 1.00 : f3216  return %0 : f3217}18 19// CHECK: llvm.func @multiple_return() -> !llvm.struct<{{.*}}>20// CHECK-LABEL: llvm.func @_mlir_ciface_multiple_return21// CHECK-SAME: !llvm.ptr22// CHECK-NOT: test.returnOne23// CHECK-NOT: test.returnTwo24// CHECK-NOT: test.returnThree25func.func @multiple_return() -> (memref<f32> {test.returnOne = 1}, f32 {test.returnTwo = 2, test.returnThree = 3}) {26  %0 = memref.alloc() : memref<f32>27  %1 = arith.constant 1.00 : f3228  return %0, %1 : memref<f32>, f3229}30 31// CHECK: llvm.func @multiple_return_missing_res_attr() -> !llvm.struct<{{.*}}>32// CHECK-LABEL: llvm.func @_mlir_ciface_multiple_return_missing_res_attr33// CHECK-SAME: !llvm.ptr34// CHECK-NOT: test.returnOne35// CHECK-NOT: test.returnTwo36// CHECK-NOT: test.returnThree37func.func @multiple_return_missing_res_attr() -> (memref<f32> {test.returnOne = 1}, i64, f32 {test.returnTwo = 2, test.returnThree = 3}) {38  %0 = memref.alloc() : memref<f32>39  %1 = arith.constant 2 : i6440  %2 = arith.constant 1.00 : f3241  return %0, %1, %2 : memref<f32>, i64, f3242}43 44// CHECK: llvm.func @one_arg_attr_no_res_attrs_with_memref_return({{.*}}) -> !llvm.struct{{.*}}45// CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_no_res_attrs_with_memref_return46// CHECK-SAME: !llvm.ptr47// CHECK-SAME: !llvm.ptr48// CHECK-SAME: {test.argOne = 1 : i64})49func.func @one_arg_attr_no_res_attrs_with_memref_return(%arg0: memref<f32> {test.argOne = 1}) -> memref<f32> {50  %0 = memref.alloc() : memref<f32>51  return %0 : memref<f32>52}53 54// CHECK: llvm.func @one_arg_attr_one_res_attr_with_memref_return({{.*}}) -> (!llvm.struct<{{.*}}> {test.returnOne = 1 : i64})55// CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_one_res_attr_with_memref_return56// CHECK-SAME: !llvm.ptr57// CHECK-NOT: test.returnOne58// CHECK-SAME: !llvm.ptr59// CHECK-SAME: {test.argOne = 1 : i64})60func.func @one_arg_attr_one_res_attr_with_memref_return(%arg0: memref<f32> {test.argOne = 1}) -> (memref<f32> {test.returnOne = 1}) {61  %0 = memref.alloc() : memref<f32>62  return %0 : memref<f32>63}64 65// CHECK: llvm.func @one_arg_attr_one_res_attr_with_value_return({{.*}}) -> (f32 {test.returnOne = 1 : i64})66// CHECK-LABEL: llvm.func @_mlir_ciface_one_arg_attr_one_res_attr_with_value_return67// CHECK-SAME: !llvm.ptr68// CHECK-SAME: {test.argOne = 1 : i64})69// CHECK-SAME: -> (f32 {test.returnOne = 1 : i64})70func.func @one_arg_attr_one_res_attr_with_value_return(%arg0: memref<f32> {test.argOne = 1}) -> (f32 {test.returnOne = 1}) {71  %0 = arith.constant 1.00 : f3272  return %0 : f3273}74 75// CHECK: llvm.func @multiple_arg_attr_multiple_res_attr({{.*}}) -> !llvm.struct<{{.*}}>76// CHECK-LABEL: llvm.func @_mlir_ciface_multiple_arg_attr_multiple_res_attr77// CHECK-SAME: !llvm.ptr78// CHECK-NOT: test.returnOne79// CHECK-NOT: test.returnTwo80// CHECK-SAME: !llvm.ptr81// CHECK-SAME: {test.argZero = 0 : i64}82// CHECK-SAME: f3283// CHECK-SAME: i32 {test.argTwo = 2 : i64})84func.func @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}) {85  %0 = arith.constant 1.00 : f3286  %1 = memref.alloc() : memref<i32>87  %2 = arith.constant 2 : i3288  return %0, %1, %2 : f32, memref<i32>, i3289}90 91// CHECK: llvm.func @drop_linkage_attr() -> (!llvm.struct{{.*}} {test.returnOne})92// CHECK-LABEL: llvm.func @_mlir_ciface_drop_linkage_attr93// CHECK-SAME: !llvm.ptr94// CHECK-NOT: llvm.linkage95func.func @drop_linkage_attr() -> (memref<f32> {test.returnOne}) attributes { llvm.linkage = #llvm.linkage<external> } {96  %0 = memref.alloc() : memref<f32>97  return %0 : memref<f32>98}99