[AMDGPU][True16][CodeGen] true16 codegen pattern for v_med3_u/i16 (#121850)
[llvm-project.git] / clang / test / CodeGenCXX / module-intializer.cpp
blob318250a653a7c20292abeae988b7b93d2f626de5
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3 // RUN: cd %t
5 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.cpp \
6 // RUN: -emit-module-interface -o N.pcm
7 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.pcm -emit-llvm \
8 // RUN: -o - | FileCheck %s --check-prefix=CHECK-N
10 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp \
11 // RUN: -emit-module-interface -o O.pcm
12 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.pcm -emit-llvm \
13 // RUN: -o - | FileCheck %s --check-prefix=CHECK-O
15 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp \
16 // RUN: -emit-module-interface -o M-Part.pcm
17 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.pcm \
18 // RUN: -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-P
20 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \
21 // RUN: -fprebuilt-module-path=%t -emit-module-interface -o M.pcm
22 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.pcm -emit-llvm \
23 // RUN: -fprebuilt-module-path=%t -o - | FileCheck %s --check-prefix=CHECK-M
25 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 useM.cpp \
26 // RUN: -fprebuilt-module-path=%t -emit-llvm -o - \
27 // RUN: | FileCheck %s --check-prefix=CHECK-USE
29 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-impl.cpp \
30 // RUN: -fprebuilt-module-path=%t -emit-llvm -o - \
31 // RUN: | FileCheck %s --check-prefix=CHECK-IMPL
33 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 N.cpp -emit-llvm \
34 // RUN: -o - | FileCheck %s --check-prefix=CHECK-N
36 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 O.cpp -emit-llvm \
37 // RUN: -o - | FileCheck %s --check-prefix=CHECK-O
39 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M-Part.cpp -emit-llvm \
40 // RUN: -o - | FileCheck %s --check-prefix=CHECK-P
42 // RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++20 M.cpp \
43 // RUN: -fprebuilt-module-path=%t -emit-llvm -o - | FileCheck %s --check-prefix=CHECK-M
45 //--- N-h.h
47 struct Oink {
48 Oink(){};
51 Oink Hog;
53 //--- N.cpp
55 module;
56 #include "N-h.h"
58 export module N;
60 export struct Quack {
61 Quack(){};
64 export Quack Duck;
66 // CHECK-N: define internal void @__cxx_global_var_init
67 // CHECK-N: call {{.*}} @_ZN4OinkC1Ev
68 // CHECK-N: define internal void @__cxx_global_var_init
69 // CHECK-N: call {{.*}} @_ZNW1N5QuackC1Ev
70 // CHECK-N: define void @_ZGIW1N
71 // CHECK-N: store i8 1, ptr @_ZGIW1N__in_chrg
72 // CHECK-N: call void @__cxx_global_var_init
73 // CHECK-N: call void @__cxx_global_var_init
75 //--- O-h.h
77 struct Meow {
78 Meow(){};
81 Meow Cat;
83 //--- O.cpp
85 module;
86 #include "O-h.h"
88 export module O;
90 export struct Bark {
91 Bark(){};
94 export Bark Dog;
96 // CHECK-O: define internal void @__cxx_global_var_init
97 // CHECK-O: call {{.*}} @_ZN4MeowC2Ev
98 // CHECK-O: define internal void @__cxx_global_var_init
99 // CHECK-O: call {{.*}} @_ZNW1O4BarkC1Ev
100 // CHECK-O: define void @_ZGIW1O
101 // CHECK-O: store i8 1, ptr @_ZGIW1O__in_chrg
102 // CHECK-O: call void @__cxx_global_var_init
103 // CHECK-O: call void @__cxx_global_var_init
105 //--- P-h.h
107 struct Croak {
108 Croak(){};
111 Croak Frog;
113 //--- M-Part.cpp
115 module;
116 #include "P-h.h"
118 module M:Part;
120 struct Squawk {
121 Squawk(){};
124 Squawk parrot;
126 // CHECK-P: define internal void @__cxx_global_var_init
127 // CHECK-P: call {{.*}} @_ZN5CroakC1Ev
128 // CHECK-P: define internal void @__cxx_global_var_init
129 // CHECK-P: call {{.*}} @_ZNW1M6SquawkC1Ev
130 // CHECK-P: define void @_ZGIW1MWP4Part
131 // CHECK-P: store i8 1, ptr @_ZGIW1MWP4Part__in_chrg
132 // CHECK-P: call void @__cxx_global_var_init
133 // CHECK-P: call void @__cxx_global_var_init
135 //--- M-h.h
137 struct Moo {
138 Moo(){};
141 Moo Cow;
143 //--- M.cpp
145 module;
146 #include "M-h.h"
148 export module M;
149 import N;
150 export import O;
151 import :Part;
153 export struct Baa {
154 int x;
155 Baa(){};
156 Baa(int x) : x(x) {}
157 int getX() { return x; }
160 export Baa Sheep(10);
162 // CHECK-M: define internal void @__cxx_global_var_init
163 // CHECK-M: call {{.*}} @_ZN3MooC1Ev
164 // CHECK-M: define internal void @__cxx_global_var_init
165 // CHECK-M: call {{.*}} @_ZNW1M3BaaC1Ei
166 // CHECK-M: declare void @_ZGIW1O()
167 // CHECK-M: declare void @_ZGIW1N()
168 // CHECK-M: declare void @_ZGIW1MWP4Part()
169 // CHECK-M: define void @_ZGIW1M
170 // CHECK-M: store i8 1, ptr @_ZGIW1M__in_chrg
171 // CHECK-M: call void @_ZGIW1O()
172 // CHECK-M: call void @_ZGIW1N()
173 // CHECK-M: call void @_ZGIW1MWP4Part()
174 // CHECK-M: call void @__cxx_global_var_init
175 // CHECK-M: call void @__cxx_global_var_init
177 //--- useM.cpp
179 import M;
181 int main() {
182 return Sheep.getX();
185 // CHECK-USE: declare void @_ZGIW1M
186 // CHECK-USE: define internal void @_GLOBAL__sub_I_useM.cpp
187 // CHECK-USE: call void @_ZGIW1M()
189 //--- M-impl.cpp
191 module M;
193 int foo(int i) { return i + 1; }
195 // CHECK-IMPL: declare void @_ZGIW1M
196 // CHECK-IMPL: define internal void @_GLOBAL__sub_I_M_impl.cpp
197 // CHECK-IMPL: call void @_ZGIW1M()