| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// UNSUPPORTED: target={{.*}}-zos{{.*}} |
| 3 |
// RUN: %clang_cc1 -triple=x86_64 %s -emit-llvm -o - \ |
| 4 |
// RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off %s -emit-llvm -o - \ |
| 7 |
// RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s |
| 8 |
|
| 9 |
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=on %s -emit-llvm -o - \ |
| 10 |
// RUN:| FileCheck --check-prefixes CHECK,CHECK-ON %s |
| 11 |
|
| 12 |
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast %s -emit-llvm -o - \ |
| 13 |
// RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTFAST %s |
| 14 |
|
| 15 |
// RUN: %clang_cc1 -triple=x86_64 -ffast-math %s -emit-llvm -o - \ |
| 16 |
// RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s |
| 17 |
|
| 18 |
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=off %s -emit-llvm \ |
| 19 |
// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s |
| 20 |
|
| 21 |
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=on %s -emit-llvm \ |
| 22 |
// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-ONFAST %s |
| 23 |
|
| 24 |
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=fast %s -emit-llvm \ |
| 25 |
// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s |
| 26 |
|
| 27 |
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast -ffast-math %s \ |
| 28 |
// RUN: -emit-llvm \ |
| 29 |
// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s |
| 30 |
|
| 31 |
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off -fmath-errno \ |
| 32 |
// RUN: -fno-rounding-math %s -emit-llvm -o - \ |
| 33 |
// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-NOFAST %s |
| 34 |
|
| 35 |
// RUN: %clang -S -emit-llvm -fno-fast-math %s -o - \ |
| 36 |
// RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON |
| 37 |
|
| 38 |
// RUN: %clang -S -emit-llvm -ffp-contract=fast -fno-fast-math \ |
| 39 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-CONTRACTFAST |
| 40 |
|
| 41 |
// RUN: %clang -S -emit-llvm -ffp-contract=on -fno-fast-math \ |
| 42 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON |
| 43 |
|
| 44 |
// RUN: %clang -S -emit-llvm -ffp-contract=off -fno-fast-math \ |
| 45 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-OFF |
| 46 |
|
| 47 |
// RUN: %clang -S -emit-llvm -ffp-model=fast -fno-fast-math \ |
| 48 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON |
| 49 |
|
| 50 |
// RUN: %clang -S -emit-llvm -ffp-model=precise -fno-fast-math \ |
| 51 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON |
| 52 |
|
| 53 |
// RUN: %clang -S -emit-llvm -ffp-model=strict -fno-fast-math \ |
| 54 |
// RUN: -target x86_64 %s -o - | FileCheck %s \ |
| 55 |
// RUN: --check-prefixes=CHECK,CHECK-FPSC-OFF |
| 56 |
|
| 57 |
// RUN: %clang -S -emit-llvm -ffast-math -fno-fast-math \ |
| 58 |
// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON |
| 59 |
|
| 60 |
float mymuladd(float x, float y, float z) { |
| 61 |
// CHECK: define{{.*}} float @mymuladd |
| 62 |
return x * y + z; |
| 63 |
// expected-warning{{overriding '-ffp-contract=fast' option with '-ffp-contract=on'}} |
| 64 |
|
| 65 |
// CHECK-DEFAULT: load float, ptr |
| 66 |
// CHECK-DEFAULT: fmul float |
| 67 |
// CHECK-DEFAULT: load float, ptr |
| 68 |
// CHECK-DEFAULT: fadd float |
| 69 |
|
| 70 |
// CHECK-ON: load float, ptr |
| 71 |
// CHECK-ON: load float, ptr |
| 72 |
// CHECK-ON: load float, ptr |
| 73 |
// CHECK-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}}) |
| 74 |
|
| 75 |
// CHECK-CONTRACTFAST: load float, ptr |
| 76 |
// CHECK-CONTRACTFAST: load float, ptr |
| 77 |
// CHECK-CONTRACTFAST: fmul contract float |
| 78 |
// CHECK-CONTRACTFAST: load float, ptr |
| 79 |
// CHECK-CONTRACTFAST: fadd contract float |
| 80 |
|
| 81 |
// CHECK-CONTRACTOFF: load float, ptr |
| 82 |
// CHECK-CONTRACTOFF: load float, ptr |
| 83 |
// CHECK-CONTRACTOFF: fmul reassoc nnan ninf nsz arcp afn float |
| 84 |
// CHECK-CONTRACTOFF: load float, ptr |
| 85 |
// CHECK-CONTRACTOFF: fadd reassoc nnan ninf nsz arcp afn float {{.*}}, {{.*}} |
| 86 |
|
| 87 |
// CHECK-ONFAST: load float, ptr |
| 88 |
// CHECK-ONFAST: load float, ptr |
| 89 |
// CHECK-ONFAST: load float, ptr |
| 90 |
// CHECK-ONFAST: call reassoc nnan ninf nsz arcp afn float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}}) |
| 91 |
|
| 92 |
// CHECK-FASTFAST: load float, ptr |
| 93 |
// CHECK-FASTFAST: load float, ptr |
| 94 |
// CHECK-FASTFAST: fmul fast float |
| 95 |
// CHECK-FASTFAST: load float, ptr |
| 96 |
// CHECK-FASTFAST: fadd fast float {{.*}}, {{.*}} |
| 97 |
|
| 98 |
// CHECK-NOFAST: load float, ptr |
| 99 |
// CHECK-NOFAST: load float, ptr |
| 100 |
// CHECK-NOFAST: fmul float {{.*}}, {{.*}} |
| 101 |
// CHECK-NOFAST: load float, ptr |
| 102 |
// CHECK-NOFAST: fadd float {{.*}}, {{.*}} |
| 103 |
|
| 104 |
// CHECK-FPC-ON: load float, ptr |
| 105 |
// CHECK-FPC-ON: load float, ptr |
| 106 |
// CHECK-FPC-ON: load float, ptr |
| 107 |
// CHECK-FPC-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}}) |
| 108 |
|
| 109 |
// CHECK-FPC-OFF: load float, ptr |
| 110 |
// CHECK-FPC-OFF: load float, ptr |
| 111 |
// CHECK-FPC-OFF: fmul float |
| 112 |
// CHECK-FPC-OFF: load float, ptr |
| 113 |
// CHECK-FPC-OFF: fadd float {{.*}}, {{.*}} |
| 114 |
|
| 115 |
// CHECK-FFPC-OFF: load float, ptr |
| 116 |
// CHECK-FFPC-OFF: load float, ptr |
| 117 |
// CHECK-FPSC-OFF: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, {{.*}}) |
| 118 |
// CHECK-FPSC-OFF: load float, ptr |
| 119 |
// CHECK-FPSC-OFF: [[RES:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, {{.*}}) |
| 120 |
|
| 121 |
} |