Clang Project

clang_source_code/test/CodeGen/libcalls-complex.c
1// RUN: %clang_cc1 -fno-builtin -emit-llvm -o - %s -triple i386-unknown-unknown | FileCheck -check-prefix CHECK-YES %s
2// RUN: %clang_cc1 -fno-builtin-crealf -fno-builtin-creal -fno-builtin-creall \
3// RUN:  -fno-builtin-cimagf  -fno-builtin-cimag -fno-builtin-cimagl -emit-llvm \
4// RUN:  -o - %s -triple i386-unknown-unknown | FileCheck -check-prefix CHECK-YES %s
5// RUN: %clang_cc1 -emit-llvm -o - %s -triple i386-unknown-unknown | FileCheck -check-prefix CHECK-NO %s
6
7extern float crealf(float _Complex);
8extern double creal(double _Complex);
9extern long double creall(long double _Complex);
10
11extern float cimagf(float _Complex);
12extern double cimag(double _Complex);
13extern long double cimagl(long double _Complex);
14
15double test_creal(double _Complex z) {
16  return creal(z);
17  // CHECK-NO-NOT: call double @creal
18  // CHECK-YES: call double @creal
19}
20
21long double test_creall(double _Complex z) {
22  return creall(z);
23  // CHECK-NO-NOT: call x86_fp80 @creall
24  // CHECK-YES: call x86_fp80 @creall
25}
26
27float test_crealf(double _Complex z) {
28  return crealf(z);
29  // CHECK-NO-NOT: call float @crealf
30  // CHECK-YES: call float @crealf
31}
32
33double test_cimag(double _Complex z) {
34  return cimag(z);
35  // CHECK-NO-NOT: call double @cimag
36  // CHECK-YES: call double @cimag
37}
38
39long double test_cimagl(double _Complex z) {
40  return cimagl(z);
41  // CHECK-NO-NOT: call x86_fp80 @cimagl
42  // CHECK-YES: call x86_fp80 @cimagl
43}
44
45float test_cimagf(double _Complex z) {
46  return cimagf(z);
47  // CHECK-NO-NOT: call float @cimagf
48  // CHECK-YES: call float @cimagf
49}
50