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,CHECK-UNSAFE,FINITEONLY
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,CHECK-UNSAFE,NOFINITEONLY
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,CHECK-NOUNSAFE,NOFINITEONLY
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,CHECK-NOUNSAFE,NOFINITEONLY
17 float foo(float a
, float b
) {
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]+]]
24 // CHECK: attributes [[ATTRS]] = {
25 // CHECK-SAME: "approx-func-fp-math"="true"
26 // CHECK-SAME: "no-signed-zeros-fp-math"="true"
27 // CHECK-SAME: "no-trapping-math"="true"
28 // CHECK-UNSAFE-SAME: "unsafe-fp-math"="true"
29 // CHECK-NOUNSAFE-NOT: "unsafe-fp-math"="true"