summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen/builtin_float.c
blob: b97cf1be348f188bf8beb70fb210f0cdb01f7530 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s

// test to ensure that these builtins don't do the variadic promotion of float->double.
void test_floats(float f1, float f2) {
  (void)__builtin_isgreater(f1, f2);
  // CHECK: fcmp ogt float
  // CHECK-NEXT: zext i1
  (void)__builtin_isgreaterequal(f1, f2);
  // CHECK: fcmp oge float
  // CHECK-NEXT: zext i1
  (void)__builtin_isless(f1, f2);
  // CHECK: fcmp olt float
  // CHECK-NEXT: zext i1
  (void)__builtin_islessequal(f1, f2);
  // CHECK: fcmp ole float
  // CHECK-NEXT: zext i1
  (void)__builtin_islessgreater(f1, f2);
  // CHECK: fcmp one float
  // CHECK-NEXT: zext i1
  (void)__builtin_isunordered(f1, f2);
  // CHECK: fcmp uno float
  // CHECK-NEXT: zext i1
}

void test_doubles(double d1, double f2) {
  (void)__builtin_isgreater(d1, f2);
  // CHECK: fcmp ogt double
  // CHECK-NEXT: zext i1
  (void)__builtin_isgreaterequal(d1, f2);
  // CHECK: fcmp oge double
  // CHECK-NEXT: zext i1
  (void)__builtin_isless(d1, f2);
  // CHECK: fcmp olt double
  // CHECK-NEXT: zext i1
  (void)__builtin_islessequal(d1, f2);
  // CHECK: fcmp ole double
  // CHECK-NEXT: zext i1
  (void)__builtin_islessgreater(d1, f2);
  // CHECK: fcmp one double
  // CHECK-NEXT: zext i1
  (void)__builtin_isunordered(d1, f2);
  // CHECK: fcmp uno double
  // CHECK-NEXT: zext i1
}

void test_mixed(double d1, float f2) {
  (void)__builtin_isgreater(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp ogt double
  // CHECK-NEXT: zext i1
  (void)__builtin_isgreaterequal(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp oge double
  // CHECK-NEXT: zext i1
  (void)__builtin_isless(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp olt double
  // CHECK-NEXT: zext i1
  (void)__builtin_islessequal(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp ole double
  // CHECK-NEXT: zext i1
  (void)__builtin_islessgreater(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp one double
  // CHECK-NEXT: zext i1
  (void)__builtin_isunordered(d1, f2);
  // CHECK: fpext float {{.*}} to double
  // CHECK-NEXT: fcmp uno double
  // CHECK-NEXT: zext i1
}
OpenPOWER on IntegriCloud