| 1 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math \ |
| 2 |
// RUN: -ffp-contract=fast -emit-llvm -o - %s | \ |
| 3 |
// RUN: FileCheck %s --check-prefixes=CHECK,FINITEONLY |
| 4 |
|
| 5 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \ |
| 6 |
// RUN: -ffp-contract=fast -emit-llvm -o - %s | \ |
| 7 |
// RUN: FileCheck %s --check-prefixes=CHECK,NOFINITEONLY |
| 8 |
|
| 9 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \ |
| 10 |
// RUN: -ffp-contract=on -emit-llvm -o - %s | \ |
| 11 |
// RUN: FileCheck %s --check-prefixes=CHECK,NOFINITEONLY |
| 12 |
|
| 13 |
// RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \ |
| 14 |
// RUN: -ffp-contract=off -emit-llvm -o - %s | \ |
| 15 |
// RUN: FileCheck %s --check-prefixes=CHECK,NOFINITEONLY |
| 16 |
|
| 17 |
float foo(float a, float b) { |
| 18 |
return a+b; |
| 19 |
} |
| 20 |
|
| 21 |
// FINITEONLY: define{{.*}} float @foo(float noundef nofpclass(nan inf) %{{.*}}, float noundef nofpclass(nan inf) %{{.*}}){{.*}} [[ATTRS:#[0-9]+]] |
| 22 |
// NOFINITEONLY: define{{.*}} float @foo(float noundef %{{.*}}, float noundef %{{.*}}){{.*}} [[ATTRS:#[0-9]+]] |
| 23 |
|
| 24 |
// CHECK: attributes [[ATTRS]] = { |
| 25 |
// CHECK-SAME: "no-signed-zeros-fp-math"="true" |
| 26 |
// CHECK-SAME: "no-trapping-math"="true" |
| 27 |
// CHECK-SAME: } |