122 lines · c
1// REQUIRES: x86-registered-target2// UNSUPPORTED: target={{.*}}-zos{{.*}}3// RUN: %clang_cc1 -triple=x86_64 %s -emit-llvm -o - \4// RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s5 6// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off %s -emit-llvm -o - \7// RUN:| FileCheck --check-prefixes CHECK,CHECK-DEFAULT %s8 9// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=on %s -emit-llvm -o - \10// RUN:| FileCheck --check-prefixes CHECK,CHECK-ON %s11 12// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast %s -emit-llvm -o - \13// RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTFAST %s14 15// RUN: %clang_cc1 -triple=x86_64 -ffast-math %s -emit-llvm -o - \16// RUN:| FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s17 18// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=off %s -emit-llvm \19// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-CONTRACTOFF %s20 21// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=on %s -emit-llvm \22// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-ONFAST %s23 24// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=fast %s -emit-llvm \25// RUN: -o - | FileCheck --check-prefixes CHECK,CHECK-FASTFAST %s26 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 %s30 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 %s34 35// RUN: %clang -S -emit-llvm -fno-fast-math %s -o - \36// RUN: | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON37 38// RUN: %clang -S -emit-llvm -ffp-contract=fast -fno-fast-math \39// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-CONTRACTFAST40 41// RUN: %clang -S -emit-llvm -ffp-contract=on -fno-fast-math \42// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON43 44// RUN: %clang -S -emit-llvm -ffp-contract=off -fno-fast-math \45// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-OFF46 47// RUN: %clang -S -emit-llvm -ffp-model=fast -fno-fast-math \48// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON49 50// RUN: %clang -S -emit-llvm -ffp-model=precise -fno-fast-math \51// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON52 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-OFF56 57// RUN: %clang -S -emit-llvm -ffast-math -fno-fast-math \58// RUN: %s -o - | FileCheck %s --check-prefixes=CHECK,CHECK-FPC-ON59 60float mymuladd(float x, float y, float z) {61 // CHECK: define{{.*}} float @mymuladd62 return x * y + z;63 // expected-warning{{overriding '-ffp-contract=fast' option with '-ffp-contract=on'}}64 65 // CHECK-DEFAULT: load float, ptr66 // CHECK-DEFAULT: fmul float67 // CHECK-DEFAULT: load float, ptr68 // CHECK-DEFAULT: fadd float69 70 // CHECK-ON: load float, ptr71 // CHECK-ON: load float, ptr72 // CHECK-ON: load float, ptr73 // CHECK-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})74 75 // CHECK-CONTRACTFAST: load float, ptr76 // CHECK-CONTRACTFAST: load float, ptr77 // CHECK-CONTRACTFAST: fmul contract float78 // CHECK-CONTRACTFAST: load float, ptr79 // CHECK-CONTRACTFAST: fadd contract float80 81 // CHECK-CONTRACTOFF: load float, ptr82 // CHECK-CONTRACTOFF: load float, ptr83 // CHECK-CONTRACTOFF: fmul reassoc nnan ninf nsz arcp afn float84 // CHECK-CONTRACTOFF: load float, ptr85 // CHECK-CONTRACTOFF: fadd reassoc nnan ninf nsz arcp afn float {{.*}}, {{.*}}86 87 // CHECK-ONFAST: load float, ptr88 // CHECK-ONFAST: load float, ptr89 // CHECK-ONFAST: load float, ptr90 // CHECK-ONFAST: call reassoc nnan ninf nsz arcp afn float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})91 92 // CHECK-FASTFAST: load float, ptr93 // CHECK-FASTFAST: load float, ptr94 // CHECK-FASTFAST: fmul fast float95 // CHECK-FASTFAST: load float, ptr96 // CHECK-FASTFAST: fadd fast float {{.*}}, {{.*}}97 98 // CHECK-NOFAST: load float, ptr99 // CHECK-NOFAST: load float, ptr100 // CHECK-NOFAST: fmul float {{.*}}, {{.*}}101 // CHECK-NOFAST: load float, ptr102 // CHECK-NOFAST: fadd float {{.*}}, {{.*}}103 104 // CHECK-FPC-ON: load float, ptr105 // CHECK-FPC-ON: load float, ptr106 // CHECK-FPC-ON: load float, ptr107 // CHECK-FPC-ON: call float @llvm.fmuladd.f32(float {{.*}}, float {{.*}}, float {{.*}})108 109 // CHECK-FPC-OFF: load float, ptr110 // CHECK-FPC-OFF: load float, ptr111 // CHECK-FPC-OFF: fmul float112 // CHECK-FPC-OFF: load float, ptr113 // CHECK-FPC-OFF: fadd float {{.*}}, {{.*}}114 115 // CHECK-FFPC-OFF: load float, ptr116 // CHECK-FFPC-OFF: load float, ptr117 // CHECK-FPSC-OFF: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, {{.*}})118 // CHECK-FPSC-OFF: load float, ptr119 // CHECK-FPSC-OFF: [[RES:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, {{.*}})120 121}122