[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / builtin_float.c
blobb257854278cb601396eed9ccb2e87364ef66ea0c
1 // RUN: %clang_cc1 -emit-llvm -triple x86_64-windows-pc -o - %s | FileCheck %s --check-prefixes=CHECK,FP16
2 // RUN: %clang_cc1 -emit-llvm -triple ppc64-be -o - %s -DNO_FP16 | FileCheck %s --check-prefixes=CHECK,NOFP16
4 // test to ensure that these builtins don't do the variadic promotion of float->double.
5 void test_floats(float f1, float f2) {
6 (void)__builtin_isgreater(f1, f2);
7 // CHECK: fcmp ogt float
8 // CHECK-NEXT: zext i1
9 (void)__builtin_isgreaterequal(f1, f2);
10 // CHECK: fcmp oge float
11 // CHECK-NEXT: zext i1
12 (void)__builtin_isless(f1, f2);
13 // CHECK: fcmp olt float
14 // CHECK-NEXT: zext i1
15 (void)__builtin_islessequal(f1, f2);
16 // CHECK: fcmp ole float
17 // CHECK-NEXT: zext i1
18 (void)__builtin_islessgreater(f1, f2);
19 // CHECK: fcmp one float
20 // CHECK-NEXT: zext i1
21 (void)__builtin_isunordered(f1, f2);
22 // CHECK: fcmp uno float
23 // CHECK-NEXT: zext i1
26 void test_doubles(double d1, double f2) {
27 (void)__builtin_isgreater(d1, f2);
28 // CHECK: fcmp ogt double
29 // CHECK-NEXT: zext i1
30 (void)__builtin_isgreaterequal(d1, f2);
31 // CHECK: fcmp oge double
32 // CHECK-NEXT: zext i1
33 (void)__builtin_isless(d1, f2);
34 // CHECK: fcmp olt double
35 // CHECK-NEXT: zext i1
36 (void)__builtin_islessequal(d1, f2);
37 // CHECK: fcmp ole double
38 // CHECK-NEXT: zext i1
39 (void)__builtin_islessgreater(d1, f2);
40 // CHECK: fcmp one double
41 // CHECK-NEXT: zext i1
42 (void)__builtin_isunordered(d1, f2);
43 // CHECK: fcmp uno double
44 // CHECK-NEXT: zext i1
47 void test_half(__fp16 *H, __fp16 *H2) {
48 (void)__builtin_isgreater(*H, *H2);
49 // CHECK: fcmp ogt float
50 // CHECK-NEXT: zext i1
51 (void)__builtin_isinf(*H);
52 // NOFP16: fcmp oeq float %{{.+}}, 0x7FF
53 // FP16: fcmp oeq half %{{.+}}, 0xH7C
56 void test_mixed(double d1, float f2) {
57 (void)__builtin_isgreater(d1, f2);
58 // CHECK: fpext float {{.*}} to double
59 // CHECK-NEXT: fcmp ogt double
60 // CHECK-NEXT: zext i1
61 (void)__builtin_isgreaterequal(d1, f2);
62 // CHECK: fpext float {{.*}} to double
63 // CHECK-NEXT: fcmp oge double
64 // CHECK-NEXT: zext i1
65 (void)__builtin_isless(d1, f2);
66 // CHECK: fpext float {{.*}} to double
67 // CHECK-NEXT: fcmp olt double
68 // CHECK-NEXT: zext i1
69 (void)__builtin_islessequal(d1, f2);
70 // CHECK: fpext float {{.*}} to double
71 // CHECK-NEXT: fcmp ole double
72 // CHECK-NEXT: zext i1
73 (void)__builtin_islessgreater(d1, f2);
74 // CHECK: fpext float {{.*}} to double
75 // CHECK-NEXT: fcmp one double
76 // CHECK-NEXT: zext i1
77 (void)__builtin_isunordered(d1, f2);
78 // CHECK: fpext float {{.*}} to double
79 // CHECK-NEXT: fcmp uno double
80 // CHECK-NEXT: zext i1