Debian Codegraph @

clang/test/CodeGenOpenCL/relaxed-fpmath.cl

raw
1 // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s -check-prefix=NORMAL
2 // RUN: %clang_cc1 %s -emit-llvm -cl-fast-relaxed-math -o - | FileCheck %s -check-prefix=FAST
3 // RUN: %clang_cc1 %s -emit-llvm -cl-finite-math-only -o - | FileCheck %s -check-prefix=FINITE
4 // RUN: %clang_cc1 %s -emit-llvm -cl-unsafe-math-optimizations -o - | FileCheck %s -check-prefix=UNSAFE
5 // RUN: %clang_cc1 %s -emit-llvm -cl-mad-enable -o - | FileCheck %s -check-prefix=MAD
6 // RUN: %clang_cc1 %s -emit-llvm -cl-no-signed-zeros -o - | FileCheck %s -check-prefix=NOSIGNED
7
8 // Check the fp options are correct with PCH.
9 // RUN: %clang_cc1 %s -DGEN_PCH=1 -finclude-default-header -triple spir-unknown-unknown -emit-pch -o %t.pch
10 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -o - | FileCheck %s -check-prefix=NORMAL
11 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -cl-fast-relaxed-math -o - | FileCheck %s -check-prefix=FAST
12 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -cl-finite-math-only -o - | FileCheck %s -check-prefix=FINITE
13 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -cl-unsafe-math-optimizations -o - | FileCheck %s -check-prefix=UNSAFE
14 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -cl-mad-enable -o - | FileCheck %s -check-prefix=MAD
15 // RUN: %clang_cc1 %s -include-pch %t.pch -fno-validate-pch -emit-llvm -cl-no-signed-zeros -o - | FileCheck %s -check-prefix=NOSIGNED
16
17 #if !GEN_PCH
18
19 float spscalardiv(float a, float b) {
20 // CHECK: @spscalardiv(
21
22 // NORMAL: fdiv float
23 // FAST: fdiv fast float
24 // FINITE: fdiv nnan ninf float
25 // UNSAFE: fdiv reassoc nsz arcp contract afn float
26 // MAD: fdiv float
27 // NOSIGNED: fdiv nsz float
28 return a / b;
29 }
30 // CHECK: attributes
31
32 // NORMAL-NOT: "less-precise-fpmad"
33 // NORMAL-NOT: "no-infs-fp-math"
34 // NORMAL-NOT: "no-nans-fp-math"
35 // NORMAL-NOT: "no-signed-zeros-fp-math"
36 // NORMAL-NOT: "unsafe-fp-math"
37
38 // FAST: "less-precise-fpmad"="true"
39 // FAST: "no-infs-fp-math"="true"
40 // FAST: "no-nans-fp-math"="true"
41 // FAST: "no-signed-zeros-fp-math"="true"
42 // FAST: "unsafe-fp-math"="true"
43
44 // FINITE-NOT: "less-precise-fpmad"
45 // FINITE: "no-infs-fp-math"="true"
46 // FINITE: "no-nans-fp-math"="true"
47 // FINITE-NOT: "no-signed-zeros-fp-math"
48 // FINITE-NOT: "unsafe-fp-math"
49
50 // UNSAFE: "less-precise-fpmad"="true"
51 // UNSAFE-NOT: "no-infs-fp-math"
52 // UNSAFE-NOT: "no-nans-fp-math"
53 // UNSAFE: "no-signed-zeros-fp-math"="true"
54 // UNSAFE: "unsafe-fp-math"="true"
55
56 // MAD: "less-precise-fpmad"="true"
57 // MAD-NOT: "no-infs-fp-math"
58 // MAD-NOT: "no-nans-fp-math"
59 // MAD-NOT: "no-signed-zeros-fp-math"
60 // MAD-NOT: "unsafe-fp-math"
61
62 // NOSIGNED-NOT: "less-precise-fpmad"
63 // NOSIGNED-NOT: "no-infs-fp-math"
64 // NOSIGNED-NOT: "no-nans-fp-math"
65 // NOSIGNED: "no-signed-zeros-fp-math"="true"
66 // NOSIGNED-NOT: "unsafe-fp-math"
67
68 #else
69 // Undefine this to avoid putting it in the PCH.
70 #undef GEN_PCH
71 #endif