Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / builtin-calling-conv.cpp
blob7020d1e0a24144074e24809de51ed82134693138
1 // RUN: %clang_cc1 -triple x86_64-linux-pc -DREDECL -emit-llvm %s -o - | FileCheck %s -check-prefix LINUX
2 // RUN: %clang_cc1 -triple spir-unknown-unknown -DREDECL -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR
3 // RUN: %clang_cc1 -triple x86_64-linux-pc -emit-llvm %s -o - | FileCheck %s -check-prefix LINUX
4 // RUN: %clang_cc1 -triple spir-unknown-unknown -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR
5 // RUN: %clang_cc1 -triple i386-windows-pc -fdefault-calling-conv=stdcall -emit-llvm %s -o - | FileCheck %s -check-prefix WIN32
7 #ifdef REDECL
8 namespace std {
9 #ifdef SPIR
10 using size_t = unsigned int;
11 #else
12 using size_t = unsigned long;
13 #endif // SPIR
14 } // namespace std
16 float __builtin_atan2f(float, float);
17 void *operator new(std::size_t);
18 #endif // REDECL
20 void foo();
22 void user() {
23 int i;
24 ::operator new(5);
25 (void)__builtin_atan2f(1.1, 2.2);
26 foo();
29 // LINUX: define{{.*}} void @_Z4userv()
30 // LINUX: call noalias noundef nonnull ptr @_Znwm
31 // LINUX: call float @atan2f
32 // LINUX: call void @_Z3foov
33 // LINUX: declare noundef nonnull ptr @_Znwm(i64 noundef)
34 // LINUX: declare float @atan2f(float noundef, float noundef)
35 // LINUX: declare void @_Z3foov()
37 // SPIR: define{{.*}} spir_func void @_Z4userv()
38 // SPIR: call spir_func noalias noundef nonnull ptr @_Znwj
39 // SPIR: call spir_func float @atan2f
40 // SPIR: call spir_func void @_Z3foov
41 // SPIR: declare spir_func noundef nonnull ptr @_Znwj(i32 noundef)
42 // SPIR: declare spir_func float @atan2f(float noundef, float noundef)
43 // SPIR: declare spir_func void @_Z3foov()
45 // Note: Windows /G options should not change the platform default calling
46 // convention of builtins.
47 // WIN32: define dso_local x86_stdcallcc void @"?user@@YGXXZ"()
48 // WIN32: call noalias noundef nonnull ptr @"??2@YAPAXI@Z"
49 // WIN32: call float @atan2f
50 // WIN32: call x86_stdcallcc void @"?foo@@YGXXZ"
51 // WIN32: declare dso_local noundef nonnull ptr @"??2@YAPAXI@Z"(
52 // WIN32: declare dso_local float @atan2f(float noundef, float noundef)
53 // WIN32: declare dso_local x86_stdcallcc void @"?foo@@YGXXZ"()