Clang Project

clang_source_code/test/CodeGenCXX/builtin-calling-conv.cpp
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
6#ifdef REDECL
7namespace std {
8#ifdef SPIR
9using size_t = unsigned int;
10#else
11using size_t = unsigned long;
12#endif // SPIR
13} // namespace std
14
15float __builtin_atan2f(float, float);
16void *operator new(std::size_t);
17#endif // REDECL
18
19void foo();
20
21void user() {
22  int i;
23  ::operator new(5);
24  (void)__builtin_atan2f(1.1, 2.2);
25  foo();
26}
27
28// LINUX: define void @_Z4userv()
29// LINUX: call i8* @_Znwm
30// LINUX: call float @atan2f
31// LINUX: call void @_Z3foov
32// LINUX: declare noalias i8* @_Znwm(i64)
33// LINUX: declare float @atan2f(float, float)
34// LINUX: declare void @_Z3foov()
35
36// SPIR: define spir_func void @_Z4userv()
37// SPIR: call spir_func i8* @_Znwj
38// SPIR: call spir_func float @atan2f
39// SPIR: call spir_func void @_Z3foov
40// SPIR: declare spir_func noalias i8* @_Znwj(i32)
41// SPIR: declare spir_func float @atan2f(float, float)
42// SPIR: declare spir_func void @_Z3foov()
43