54 lines · cpp
1// RUN: %clang_cc1 -triple x86_64-linux-pc -DREDECL -emit-llvm %s -o - | FileCheck %s -check-prefix LINUX2// RUN: %clang_cc1 -triple spir-unknown-unknown -DREDECL -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR3// RUN: %clang_cc1 -triple x86_64-linux-pc -emit-llvm %s -o - | FileCheck %s -check-prefix LINUX4// RUN: %clang_cc1 -triple spir-unknown-unknown -DSPIR -emit-llvm %s -o - | FileCheck %s -check-prefix SPIR5// RUN: %clang_cc1 -triple i386-windows-pc -fdefault-calling-conv=stdcall -emit-llvm %s -o - | FileCheck %s -check-prefix WIN326 7#ifdef REDECL8namespace std {9#ifdef SPIR10using size_t = unsigned int;11#else12using size_t = unsigned long;13#endif // SPIR14} // namespace std15 16float __builtin_erff(float);17void *operator new(std::size_t);18#endif // REDECL19 20void foo();21 22void user() {23 int i;24 ::operator new(5);25 (void)__builtin_erff(1.1);26 foo();27}28 29// LINUX: define{{.*}} void @_Z4userv()30// LINUX: call noalias noundef nonnull ptr @_Znwm31// LINUX: call float @erff32// LINUX: call void @_Z3foov33// LINUX: declare noundef nonnull ptr @_Znwm(i64 noundef)34// LINUX: declare float @erff(float noundef)35// LINUX: declare void @_Z3foov()36 37// SPIR: define{{.*}} spir_func void @_Z4userv()38// SPIR: call spir_func noalias noundef nonnull ptr @_Znwj39// SPIR: call spir_func float @erff40// SPIR: call spir_func void @_Z3foov41// SPIR: declare spir_func noundef nonnull ptr @_Znwj(i32 noundef)42// SPIR: declare spir_func float @erff(float noundef)43// SPIR: declare spir_func void @_Z3foov()44 45// Note: Windows /G options should not change the platform default calling46// 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 @erff50// WIN32: call x86_stdcallcc void @"?foo@@YGXXZ"51// WIN32: declare dso_local noundef nonnull ptr @"??2@YAPAXI@Z"(52// WIN32: declare dso_local float @erff(float noundef)53// WIN32: declare dso_local x86_stdcallcc void @"?foo@@YGXXZ"()54