1 // RUN: fir-opt --external-name-interop="append-underscore=true" %s | FileCheck %s --check-prefix=CHECK-UNDER
2 // RUN: fir-opt --external-name-interop="append-underscore=false" %s | FileCheck %s --check-prefix=CHECK-NOUNDER
3 // RUN: tco --external-name-interop="append-underscore=true" %s | FileCheck %s --check-prefix=CHECK-UNDER
4 // RUN: tco --external-name-interop="append-underscore=false" %s | FileCheck %s --check-prefix=CHECK-NOUNDER
5 // RUN: tco --external-name-interop="append-underscore=true" %s | tco --fir-to-llvm-ir | FileCheck %s --check-prefix=LLVMIR-UNDER
6 // RUN: tco --external-name-interop="append-underscore=false" %s | tco --fir-to-llvm-ir | FileCheck %s --check-prefix=LLVMIR-NOUNDER
9 %c0 = arith.constant 0 : index
10 %0 = fir.address_of(@_QCa) : !fir.ref<!fir.array<4xi8>>
11 %1 = fir.convert %0 : (!fir.ref<!fir.array<4xi8>>) -> !fir.ref<!fir.array<?xi8>>
12 %2 = fir.coordinate_of %1, %c0 : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
13 %3 = fir.convert %2 : (!fir.ref<i8>) -> !fir.ref<i32>
14 %4 = fir.address_of(@_QC) : !fir.ref<!fir.array<4xi8>>
15 %5 = fir.convert %4 : (!fir.ref<!fir.array<4xi8>>) -> !fir.ref<!fir.array<?xi8>>
16 %6 = fir.coordinate_of %5, %c0 : (!fir.ref<!fir.array<?xi8>>, index) -> !fir.ref<i8>
17 %7 = fir.convert %6 : (!fir.ref<i8>) -> !fir.ref<f32>
18 fir.call @_QPbar(%3) : (!fir.ref<i32>) -> ()
19 fir.call @_QPbar2(%7) : (!fir.ref<f32>) -> ()
22 fir.global common @_QCa(dense<0> : vector<4xi8>) : !fir.array<4xi8>
23 fir.global common @_QC(dense<0> : vector<4xi8>) : !fir.array<4xi8>
24 func.func private @_QPbar(!fir.ref<i32>)
25 func.func private @_QPbar2(!fir.ref<f32>)
27 // CHECK-UNDER: func @foo_
28 // CHECK-UNDER: %{{.*}} = fir.address_of(@a_) : !fir.ref<!fir.array<4xi8>>
29 // CHECK-UNDER: %{{.*}} = fir.address_of(@__BLNK__) : !fir.ref<!fir.array<4xi8>>
30 // CHECK-UNDER: fir.call @bar_
31 // CHECK-UNDER: fir.call @bar2_
32 // CHECK-UNDER: fir.global common @a_(dense<0> : vector<4xi8>) : !fir.array<4xi8>
33 // CHECK-UNDER: fir.global common @__BLNK__(dense<0> : vector<4xi8>) : !fir.array<4xi8>
34 // CHECK-UNDER: func private @bar_(!fir.ref<i32>)
36 // CHECK-NOUNDER: func @foo(
37 // CHECK-NOUNDER: %{{.*}} = fir.address_of(@a) : !fir.ref<!fir.array<4xi8>>
38 // CHECK-NOUNDER: %{{.*}} = fir.address_of(@__BLNK__) : !fir.ref<!fir.array<4xi8>>
39 // CHECK-NOUNDER: fir.call @bar(
40 // CHECK-NOUNDER: fir.call @bar2(
41 // CHECK-NOUNDER: fir.global common @a(dense<0> : vector<4xi8>) : !fir.array<4xi8>
42 // CHECK-NOUNDER: fir.global common @__BLNK__(dense<0> : vector<4xi8>) : !fir.array<4xi8>
43 // CHECK-NOUNDER: func private @bar(!fir.ref<i32>)
45 // LLVMIR-UNDER: %{{.*}} = llvm.mlir.addressof @a_ : !llvm.ptr<array<4 x i8>>
46 // LLVMIR-UNDER: %{{.*}} = llvm.mlir.addressof @__BLNK__ : !llvm.ptr<array<4 x i8>>
47 // LLVMIR-UNDER: llvm.call @bar_(%{{.*}}) : (!llvm.ptr<i32>) -> ()
48 // LLVMIR-UNDER: llvm.call @bar2_(%{{.*}}) : (!llvm.ptr<f32>) -> ()
50 // LLVMIR-UNDER: llvm.mlir.global common @a_(dense<0> : vector<4xi8>) {{.*}} : !llvm.array<4 x i8>
51 // LLVMIR-UNDER: llvm.mlir.global common @__BLNK__(dense<0> : vector<4xi8>) {{.*}} : !llvm.array<4 x i8>
52 // LLVMIR-UNDER: llvm.func @bar_(!llvm.ptr<i32>) attributes {sym_visibility = "private"}
53 // LLVMIR-UNDER: llvm.func @bar2_(!llvm.ptr<f32>) attributes {sym_visibility = "private"}
55 // LLVMIR-NOUNDER: %{{.*}} = llvm.mlir.addressof @a : !llvm.ptr<array<4 x i8>>
56 // LLVMIR-NOUNDER: %{{.*}} = llvm.mlir.addressof @__BLNK__ : !llvm.ptr<array<4 x i8>>
57 // LLVMIR-NOUNDER: llvm.call @bar(%{{.*}}) : (!llvm.ptr<i32>) -> ()
58 // LLVMIR-NOUNDER: llvm.call @bar2(%{{.*}}) : (!llvm.ptr<f32>) -> ()
60 // LLVMIR-NOUNDER: llvm.mlir.global common @a(dense<0> : vector<4xi8>) {{.*}} : !llvm.array<4 x i8>
61 // LLVMIR-NOUNDER: llvm.mlir.global common @__BLNK__(dense<0> : vector<4xi8>) {{.*}} : !llvm.array<4 x i8>
62 // LLVMIR-NOUNDER: llvm.func @bar(!llvm.ptr<i32>) attributes {sym_visibility = "private"}
63 // LLVMIR-NOUNDER: llvm.func @bar2(!llvm.ptr<f32>) attributes {sym_visibility = "private"}
67 func.func @_QPcallee() {
68 fir.call @_QPcallee() : () -> ()
72 func.func @_QPcaller() {
73 fir.call @_QPcallee() : () -> ()
77 // CHECK-UNDER: func @callee_
78 // CHECK-UNDER: fir.call @callee_
79 // CHECK-UNDER: func @caller_
80 // CHECK-UNDER: fir.call @callee_
82 // LLVMIR-UNDER: llvm.call @callee_() : () -> ()
83 // LLVMIR-UNDER: llvm.call @callee_() : () -> ()
85 // CHECK-NOUNDER: func @callee(
86 // CHECK-NOUNDER: fir.call @callee(
87 // CHECK-NOUNDER: func @caller(
88 // CHECK-NOUNDER: fir.call @callee(
90 // LLVMIR-NOUNDER: llvm.call @callee() : () -> ()
91 // LLVMIR-NOUNDER: llvm.call @callee() : () -> ()