| 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 -menable-no-infs -menable-no-nans -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 -menable-no-infs -menable-no-nans -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 |
|
| 37 |
// FAST: "less-precise-fpmad"="true" |
| 38 |
// FAST: "no-infs-fp-math"="true" |
| 39 |
// FAST: "no-nans-fp-math"="true" |
| 40 |
// FAST: "no-signed-zeros-fp-math"="true" |
| 41 |
|
| 42 |
// FINITE-NOT: "less-precise-fpmad" |
| 43 |
// FINITE: "no-infs-fp-math"="true" |
| 44 |
// FINITE: "no-nans-fp-math"="true" |
| 45 |
// FINITE-NOT: "no-signed-zeros-fp-math" |
| 46 |
|
| 47 |
// UNSAFE: "less-precise-fpmad"="true" |
| 48 |
// UNSAFE-NOT: "no-infs-fp-math" |
| 49 |
// UNSAFE-NOT: "no-nans-fp-math" |
| 50 |
// UNSAFE: "no-signed-zeros-fp-math"="true" |
| 51 |
|
| 52 |
// MAD: "less-precise-fpmad"="true" |
| 53 |
// MAD-NOT: "no-infs-fp-math" |
| 54 |
// MAD-NOT: "no-nans-fp-math" |
| 55 |
// MAD-NOT: "no-signed-zeros-fp-math" |
| 56 |
|
| 57 |
// NOSIGNED-NOT: "less-precise-fpmad" |
| 58 |
// NOSIGNED-NOT: "no-infs-fp-math" |
| 59 |
// NOSIGNED-NOT: "no-nans-fp-math" |
| 60 |
// NOSIGNED: "no-signed-zeros-fp-math"="true" |
| 61 |
|
| 62 |
#else |
| 63 |
// Undefine this to avoid putting it in the PCH. |
| 64 |
#undef GEN_PCH |
| 65 |
#endif |