1b7d7c448SMichele Scandale // RUN: %clang_cc1 -triple x86_64-linux-gnu -ffast-math \
2b7d7c448SMichele Scandale // RUN: -ffp-contract=fast -emit-llvm -o - %s | \
3*dd818105SMatt Arsenault // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-UNSAFE,FINITEONLY
484a9ec2fSZahira Ammarguellat
5b7d7c448SMichele Scandale // RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \
6b7d7c448SMichele Scandale // RUN: -ffp-contract=fast -emit-llvm -o - %s | \
7*dd818105SMatt Arsenault // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-UNSAFE,NOFINITEONLY
8b7d7c448SMichele Scandale
9b7d7c448SMichele Scandale // RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \
10b7d7c448SMichele Scandale // RUN: -ffp-contract=on -emit-llvm -o - %s | \
11*dd818105SMatt Arsenault // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-NOUNSAFE,NOFINITEONLY
12b7d7c448SMichele Scandale
13b7d7c448SMichele Scandale // RUN: %clang_cc1 -triple x86_64-linux-gnu -funsafe-math-optimizations \
14b7d7c448SMichele Scandale // RUN: -ffp-contract=off -emit-llvm -o - %s | \
15*dd818105SMatt Arsenault // RUN: FileCheck %s --check-prefixes=CHECK,CHECK-NOUNSAFE,NOFINITEONLY
1684a9ec2fSZahira Ammarguellat
foo(float a,float b)1784a9ec2fSZahira Ammarguellat float foo(float a, float b) {
1884a9ec2fSZahira Ammarguellat return a+b;
1984a9ec2fSZahira Ammarguellat }
2084a9ec2fSZahira Ammarguellat
21*dd818105SMatt Arsenault // FINITEONLY: define{{.*}} float @foo(float noundef nofpclass(nan inf) %{{.*}}, float noundef nofpclass(nan inf) %{{.*}}){{.*}} [[ATTRS:#[0-9]+]]
22*dd818105SMatt Arsenault // NOFINITEONLY: define{{.*}} float @foo(float noundef %{{.*}}, float noundef %{{.*}}){{.*}} [[ATTRS:#[0-9]+]]
23*dd818105SMatt Arsenault
24b7d7c448SMichele Scandale // CHECK: attributes [[ATTRS]] = {
25b7d7c448SMichele Scandale // CHECK-SAME: "approx-func-fp-math"="true"
26b7d7c448SMichele Scandale // CHECK-SAME: "no-signed-zeros-fp-math"="true"
27b7d7c448SMichele Scandale // CHECK-SAME: "no-trapping-math"="true"
28b7d7c448SMichele Scandale // CHECK-UNSAFE-SAME: "unsafe-fp-math"="true"
29b7d7c448SMichele Scandale // CHECK-NOUNSAFE-NOT: "unsafe-fp-math"="true"
30b7d7c448SMichele Scandale // CHECK-SAME: }
31