Skip to content

Commit 48ad446

Browse files
author
Melanie Blower
committed
[clang][fpenv][patch] Change clang option -ffp-model=precise to select ffp-contract=on
Change the ffp-model=precise to enables -ffp-contract=on (previously -ffp-model=precise enabled -ffp-contract=fast). This is a follow-up to Andy Kaylor's comments in the llvm-dev discussion "Floating Point semantic modes". From the same email thread, I put Andy's distillation of floating point options and floating point modes into UsersManual.rst Also fixes bugs.llvm.org/show_bug.cgi?id=50222 I had to revert this a few times because of failures on the x86-64 buildbot but I think we finally have that fixed by LNT/79f2b03c51. Reviewed By: rjmccall, andrew.kaylor Differential Revision: https://reviews.llvm.org/D74436
1 parent 098984a commit 48ad446

File tree

6 files changed

+139
-58
lines changed

6 files changed

+139
-58
lines changed

clang/docs/UsersManual.rst

Lines changed: 45 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,50 @@ installed.
12601260
Controlling Floating Point Behavior
12611261
-----------------------------------
12621262

1263-
Clang provides a number of ways to control floating point behavior. The options
1264-
are listed below.
1263+
Clang provides a number of ways to control floating point behavior, including
1264+
with command line options and source pragmas. This section
1265+
describes the various floating point semantic modes and the corresponding options.
1266+
1267+
.. csv-table:: Floating Point Semantic Modes
1268+
:header: "Mode", "Values"
1269+
:widths: 15, 30, 30
1270+
1271+
"except_behavior", "{ignore, strict, may_trap}", "ffp-exception-behavior"
1272+
"fenv_access", "{off, on}", "(none)"
1273+
"rounding_mode", "{dynamic, tonearest, downward, upward, towardzero}", "frounding-math"
1274+
"contract", "{on, off, fast}", "ffp-contract"
1275+
"denormal_fp_math", "{IEEE, PreserveSign, PositiveZero}", "fdenormal-fp-math"
1276+
"denormal_fp32_math", "{IEEE, PreserveSign, PositiveZero}", "fdenormal-fp-math-fp32"
1277+
"support_math_errno", "{on, off}", "fmath-errno"
1278+
"no_honor_nans", "{on, off}", "fhonor-nans"
1279+
"no_honor_infinities", "{on, off}", "fhonor-infinities"
1280+
"no_signed_zeros", "{on, off}", "fsigned-zeros"
1281+
"allow_reciprocal", "{on, off}", "freciprocal-math"
1282+
"allow_approximate_fns", "{on, off}", "(none)"
1283+
"allow_reassociation", "{on, off}", "fassociative-math"
1284+
1285+
1286+
This table describes the option settings that correspond to the three
1287+
floating point semantic models: precise (the default), strict, and fast.
1288+
1289+
1290+
.. csv-table:: Floating Point Models
1291+
:header: "Mode", "Precise", "Strict", "Fast"
1292+
:widths: 25, 15, 15, 15
1293+
1294+
"except_behavior", "ignore", "strict", "ignore"
1295+
"fenv_access", "off", "on", "off"
1296+
"rounding_mode", "tonearest", "dynamic", "tonearest"
1297+
"contract", "on", "off", "fast"
1298+
"denormal_fp_math", "IEEE", "IEEE", "PreserveSign"
1299+
"denormal_fp32_math", "IEEE","IEEE", "PreserveSign"
1300+
"support_math_errno", "on", "on", "off"
1301+
"no_honor_nans", "off", "off", "on"
1302+
"no_honor_infinities", "off", "off", "on"
1303+
"no_signed_zeros", "off", "off", "on"
1304+
"allow_reciprocal", "off", "off", "on"
1305+
"allow_approximate_fns", "off", "off", "on"
1306+
"allow_reassociation", "off", "off", "on"
12651307

12661308
.. option:: -ffast-math
12671309

@@ -1456,7 +1498,7 @@ Note that floating-point operations performed as part of constant initialization
14561498
and ``fast``.
14571499
Details:
14581500

1459-
* ``precise`` Disables optimizations that are not value-safe on floating-point data, although FP contraction (FMA) is enabled (``-ffp-contract=fast``). This is the default behavior.
1501+
* ``precise`` Disables optimizations that are not value-safe on floating-point data, although FP contraction (FMA) is enabled (``-ffp-contract=on``). This is the default behavior.
14601502
* ``strict`` Enables ``-frounding-math`` and ``-ffp-exception-behavior=strict``, and disables contractions (FMA). All of the ``-ffast-math`` enablements are disabled. Enables ``STDC FENV_ACCESS``: by default ``FENV_ACCESS`` is disabled. This option setting behaves as though ``#pragma STDC FENV_ACESS ON`` appeared at the top of the source file.
14611503
* ``fast`` Behaves identically to specifying both ``-ffast-math`` and ``ffp-contract=fast``
14621504

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
26382638

26392639
llvm::DenormalMode DenormalFPMath = DefaultDenormalFPMath;
26402640
llvm::DenormalMode DenormalFP32Math = DefaultDenormalFP32Math;
2641-
StringRef FPContract = "";
2641+
StringRef FPContract = "on";
26422642
bool StrictFPModel = false;
26432643

26442644

@@ -2663,7 +2663,7 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
26632663
ReciprocalMath = false;
26642664
SignedZeros = true;
26652665
// -fno_fast_math restores default denormal and fpcontract handling
2666-
FPContract = "";
2666+
FPContract = "on";
26672667
DenormalFPMath = llvm::DenormalMode::getIEEE();
26682668

26692669
// FIXME: The target may have picked a non-IEEE default mode here based on
@@ -2683,20 +2683,18 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
26832683
// ffp-model= is a Driver option, it is entirely rewritten into more
26842684
// granular options before being passed into cc1.
26852685
// Use the gcc option in the switch below.
2686-
if (!FPModel.empty() && !FPModel.equals(Val)) {
2686+
if (!FPModel.empty() && !FPModel.equals(Val))
26872687
D.Diag(clang::diag::warn_drv_overriding_flag_option)
26882688
<< Args.MakeArgString("-ffp-model=" + FPModel)
26892689
<< Args.MakeArgString("-ffp-model=" + Val);
2690-
FPContract = "";
2691-
}
26922690
if (Val.equals("fast")) {
26932691
optID = options::OPT_ffast_math;
26942692
FPModel = Val;
2695-
FPContract = "fast";
2693+
FPContract = Val;
26962694
} else if (Val.equals("precise")) {
26972695
optID = options::OPT_ffp_contract;
26982696
FPModel = Val;
2699-
FPContract = "fast";
2697+
FPContract = "on";
27002698
PreciseFPModel = true;
27012699
} else if (Val.equals("strict")) {
27022700
StrictFPModel = true;
@@ -2782,9 +2780,11 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
27822780
case options::OPT_ffp_contract: {
27832781
StringRef Val = A->getValue();
27842782
if (PreciseFPModel) {
2785-
// -ffp-model=precise enables ffp-contract=fast as a side effect
2786-
// the FPContract value has already been set to a string literal
2787-
// and the Val string isn't a pertinent value.
2783+
// When -ffp-model=precise is seen on the command line,
2784+
// the boolean PreciseFPModel is set to true which indicates
2785+
// "the current option is actually PreciseFPModel". The optID
2786+
// is changed to OPT_ffp_contract and FPContract is set to "on".
2787+
// the argument Val string is "precise": it shouldn't be checked.
27882788
;
27892789
} else if (Val.equals("fast") || Val.equals("on") || Val.equals("off"))
27902790
FPContract = Val;
@@ -2882,18 +2882,17 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
28822882
// -fno_fast_math restores default denormal and fpcontract handling
28832883
DenormalFPMath = DefaultDenormalFPMath;
28842884
DenormalFP32Math = llvm::DenormalMode::getIEEE();
2885-
FPContract = "";
2885+
FPContract = "on";
28862886
break;
28872887
}
28882888
if (StrictFPModel) {
28892889
// If -ffp-model=strict has been specified on command line but
28902890
// subsequent options conflict then emit warning diagnostic.
2891-
if (HonorINFs && HonorNaNs &&
2892-
!AssociativeMath && !ReciprocalMath &&
2893-
SignedZeros && TrappingMath && RoundingFPMath &&
2894-
(FPContract.equals("off") || FPContract.empty()) &&
2895-
DenormalFPMath == llvm::DenormalMode::getIEEE() &&
2896-
DenormalFP32Math == llvm::DenormalMode::getIEEE())
2891+
if (HonorINFs && HonorNaNs && !AssociativeMath && !ReciprocalMath &&
2892+
SignedZeros && TrappingMath && RoundingFPMath &&
2893+
DenormalFPMath == llvm::DenormalMode::getIEEE() &&
2894+
DenormalFP32Math == llvm::DenormalMode::getIEEE() &&
2895+
FPContract.equals("off"))
28972896
// OK: Current Arg doesn't conflict with -ffp-model=strict
28982897
;
28992898
else {
Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,46 @@
1-
// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - %s | FileCheck %s
1+
// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - %s | FileCheck --check-prefix=CHECK-FMADD %s
22
// REQUIRES: aarch64-registered-target
33

44
float fma_test1(float a, float b, float c) {
5-
// CHECK: fmadd
6-
float x = a * b;
7-
float y = x + c;
8-
return y;
5+
// CHECK-FMADD: fmadd
6+
float x = a * b;
7+
float y = x + c;
8+
return y;
9+
}
10+
11+
// RUN: %clang_cc1 -triple=x86_64 %s -emit-llvm -o - \
12+
// RUN:| FileCheck --check-prefix=CHECK-DEFAULT %s
13+
//
14+
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=off %s -emit-llvm -o - \
15+
// RUN:| FileCheck --check-prefix=CHECK-DEFAULT %s
16+
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=on %s -emit-llvm -o - \
17+
// RUN:| FileCheck --check-prefix=CHECK-ON %s
18+
// RUN: %clang_cc1 -triple=x86_64 -ffp-contract=fast %s -emit-llvm -o - \
19+
// RUN:| FileCheck --check-prefix=CHECK-CONTRACTFAST %s
20+
//
21+
// RUN: %clang_cc1 -triple=x86_64 -ffast-math %s -emit-llvm -o - \
22+
// RUN:| FileCheck --check-prefix=CHECK-DEFAULTFAST %s
23+
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=off %s -emit-llvm -o - \
24+
// RUN:| FileCheck --check-prefix=CHECK-DEFAULTFAST %s
25+
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=on %s -emit-llvm -o - \
26+
// RUN:| FileCheck --check-prefix=CHECK-ONFAST %s
27+
// RUN: %clang_cc1 -triple=x86_64 -ffast-math -ffp-contract=fast %s -emit-llvm -o - \
28+
// RUN:| FileCheck --check-prefix=CHECK-FASTFAST %s
29+
float mymuladd( float x, float y, float z ) {
30+
return x * y + z;
31+
// CHECK-DEFAULT: = fmul float
32+
// CHECK-DEFAULT: = fadd float
33+
34+
// CHECK-ON: = call float @llvm.fmuladd.f32
35+
36+
// CHECK-CONTRACTFAST: = fmul contract float
37+
// CHECK-CONTRACTFAST: = fadd contract float
38+
39+
// CHECK-DEFAULTFAST: = fmul reassoc nnan ninf nsz arcp afn float
40+
// CHECK-DEFAULTFAST: = fadd reassoc nnan ninf nsz arcp afn float
41+
42+
// CHECK-ONFAST: = call reassoc nnan ninf nsz arcp afn float @llvm.fmuladd.f32
43+
44+
// CHECK-FASTFAST: = fmul fast float
45+
// CHECK-FASTFAST: = fadd fast float
946
}

clang/test/CodeGen/ppc-emmintrin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
// REQUIRES: powerpc-registered-target
33

44
// RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
5-
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
5+
// RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
66
// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
7-
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
7+
// RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
88

99
// CHECK-BE-DAG: @_mm_movemask_pd.perm_mask = internal constant <4 x i32> <i32 -2139062144, i32 -2139062144, i32 -2139062144, i32 -2139078656>, align 16
1010
// CHECK-BE-DAG: @_mm_shuffle_epi32.permute_selectors = internal constant [4 x i32] [i32 66051, i32 67438087, i32 134810123, i32 202182159], align 4

clang/test/CodeGen/ppc-xmmintrin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// REQUIRES: powerpc-registered-target
33

44
// RUN: %clang -S -emit-llvm -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
5-
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
5+
// RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-BE
66
// RUN: %clang -x c++ -fsyntax-only -target powerpc64-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
77
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns
88
// RUN: %clang -S -emit-llvm -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
9-
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
9+
// RUN: -ffp-contract=off -fno-discard-value-names -mllvm -disable-llvm-optzns -o - | llvm-cxxfilt -n | FileCheck %s --check-prefixes=CHECK,CHECK-LE
1010
// RUN: %clang -x c++ -fsyntax-only -target powerpc64le-unknown-linux-gnu -mcpu=pwr8 -ffreestanding -DNO_WARN_X86_INTRINSICS %s \
1111
// RUN: -fno-discard-value-names -mllvm -disable-llvm-optzns
1212

clang/test/Driver/fp-model.c

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,90 @@
11
// Test that incompatible combinations of -ffp-model= options
22
// and other floating point options get a warning diagnostic.
3-
//
4-
// REQUIRES: clang-driver
53

6-
// RUN: %clang -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \
4+
// RUN: %clang -target x86_64 -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \
75
// RUN: | FileCheck --check-prefix=WARN %s
86
// WARN: warning: overriding '-ffp-model=fast' option with '-ffp-contract=off' [-Woverriding-t-option]
97

10-
// RUN: %clang -### -ffp-model=fast -ffp-contract=on -c %s 2>&1 \
8+
// RUN: %clang -target x86_64 -### -ffp-model=fast -ffp-contract=on -c %s 2>&1 \
119
// RUN: | FileCheck --check-prefix=WARN1 %s
1210
// WARN1: warning: overriding '-ffp-model=fast' option with '-ffp-contract=on' [-Woverriding-t-option]
1311

14-
// RUN: %clang -### -ffp-model=strict -fassociative-math -c %s 2>&1 \
12+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fassociative-math -c %s 2>&1 \
1513
// RUN: | FileCheck --check-prefix=WARN2 %s
1614
// WARN2: warning: overriding '-ffp-model=strict' option with '-fassociative-math' [-Woverriding-t-option]
1715

18-
// RUN: %clang -### -ffp-model=strict -ffast-math -c %s 2>&1 \
16+
// RUN: %clang -target x86_64 -### -ffp-model=strict -ffast-math -c %s 2>&1 \
1917
// RUN: | FileCheck --check-prefix=WARN3 %s
2018
// WARN3: warning: overriding '-ffp-model=strict' option with '-ffast-math' [-Woverriding-t-option]
2119

22-
// RUN: %clang -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \
20+
// RUN: %clang -target x86_64 -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \
2321
// RUN: | FileCheck --check-prefix=WARN4 %s
2422
// WARN4: warning: overriding '-ffp-model=strict' option with '-ffinite-math-only' [-Woverriding-t-option]
2523

26-
// RUN: %clang -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
24+
// RUN: %clang -target x86_64 -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
2725
// RUN: | FileCheck --check-prefix=WARN5 %s
2826
// WARN5: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
2927

30-
// RUN: %clang -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
28+
// RUN: %clang -target x86_64 -### -ffp-model=strict -ffp-contract=fast -c %s 2>&1 \
29+
// RUN: | FileCheck --check-prefix=WARN6 %s
30+
// WARN6: warning: overriding '-ffp-model=strict' option with '-ffp-contract=fast' [-Woverriding-t-option]
31+
32+
// RUN: %clang -target x86_64 -### -ffp-model=strict -ffp-contract=on -c %s 2>&1 \
3133
// RUN: | FileCheck --check-prefix=WARN7 %s
3234
// WARN7: warning: overriding '-ffp-model=strict' option with '-ffp-contract=on' [-Woverriding-t-option]
3335

34-
// RUN: %clang -### -ffp-model=strict -fno-honor-infinities -c %s 2>&1 \
36+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fno-honor-infinities -c %s 2>&1 \
3537
// RUN: | FileCheck --check-prefix=WARN8 %s
3638
// WARN8: warning: overriding '-ffp-model=strict' option with '-fno-honor-infinities' [-Woverriding-t-option]
3739

38-
// RUN: %clang -### -ffp-model=strict -fno-honor-nans -c %s 2>&1 \
40+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fno-honor-nans -c %s 2>&1 \
3941
// RUN: | FileCheck --check-prefix=WARN9 %s
4042
// WARN9: warning: overriding '-ffp-model=strict' option with '-fno-honor-nans' [-Woverriding-t-option]
4143

42-
// RUN: %clang -### -ffp-model=strict -fno-rounding-math -c %s 2>&1 \
44+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fno-rounding-math -c %s 2>&1 \
4345
// RUN: | FileCheck --check-prefix=WARNa %s
4446
// WARNa: warning: overriding '-ffp-model=strict' option with '-fno-rounding-math' [-Woverriding-t-option]
4547

46-
// RUN: %clang -### -ffp-model=strict -fno-signed-zeros -c %s 2>&1 \
48+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fno-signed-zeros -c %s 2>&1 \
4749
// RUN: | FileCheck --check-prefix=WARNb %s
4850
// WARNb: warning: overriding '-ffp-model=strict' option with '-fno-signed-zeros' [-Woverriding-t-option]
4951

50-
// RUN: %clang -### -ffp-model=strict -fno-trapping-math -c %s 2>&1 \
52+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fno-trapping-math -c %s 2>&1 \
5153
// RUN: | FileCheck --check-prefix=WARNc %s
5254
// WARNc: warning: overriding '-ffp-model=strict' option with '-fno-trapping-math' [-Woverriding-t-option]
5355

54-
// RUN: %clang -### -ffp-model=strict -freciprocal-math -c %s 2>&1 \
56+
// RUN: %clang -target x86_64 -### -ffp-model=strict -freciprocal-math -c %s 2>&1 \
5557
// RUN: | FileCheck --check-prefix=WARNd %s
5658
// WARNd: warning: overriding '-ffp-model=strict' option with '-freciprocal-math' [-Woverriding-t-option]
5759

58-
// RUN: %clang -### -ffp-model=strict -funsafe-math-optimizations -c %s 2>&1 \
60+
// RUN: %clang -target x86_64 -### -ffp-model=strict -funsafe-math-optimizations -c %s 2>&1 \
5961
// RUN: | FileCheck --check-prefix=WARNe %s
6062
// WARNe: warning: overriding '-ffp-model=strict' option with '-funsafe-math-optimizations' [-Woverriding-t-option]
6163

62-
// RUN: %clang -### -ffp-model=strict -Ofast -c %s 2>&1 \
64+
// RUN: %clang -target x86_64 -### -ffp-model=strict -Ofast -c %s 2>&1 \
6365
// RUN: | FileCheck --check-prefix=WARNf %s
6466
// WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option]
6567

66-
// RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
68+
// RUN: %clang -target x86_64 -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
6769
// RUN: | FileCheck --check-prefix=WARN10 %s
6870
// WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option]
6971

70-
// RUN: %clang -### -c %s 2>&1 \
72+
// RUN: %clang -target x86_64 -### -c %s 2>&1 \
7173
// RUN: | FileCheck --check-prefix=CHECK-NOROUND %s
7274
// CHECK-NOROUND: "-cc1"
7375
// CHECK-NOROUND: "-fno-rounding-math"
7476

75-
// RUN: %clang -### -frounding-math -c %s 2>&1 \
77+
// RUN: %clang -target x86_64 -### -frounding-math -c %s 2>&1 \
7678
// RUN: | FileCheck --check-prefix=CHECK-ROUND --implicit-check-not ffp-exception-behavior=strict %s
7779
// CHECK-ROUND: "-cc1"
7880
// CHECK-ROUND: "-frounding-math"
7981

80-
// RUN: %clang -### -ftrapping-math -c %s 2>&1 \
82+
// RUN: %clang -target x86_64 -### -ftrapping-math -c %s 2>&1 \
8183
// RUN: | FileCheck --check-prefix=CHECK-TRAP %s
8284
// CHECK-TRAP: "-cc1"
8385
// CHECK-TRAP: "-ffp-exception-behavior=strict"
8486

85-
// RUN: %clang -### -nostdinc -ffp-model=fast -c %s 2>&1 \
87+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-model=fast -c %s 2>&1 \
8688
// RUN: | FileCheck --check-prefix=CHECK-FPM-FAST %s
8789
// CHECK-FPM-FAST: "-cc1"
8890
// CHECK-FPM-FAST: "-menable-no-infs"
@@ -96,34 +98,35 @@
9698
// CHECK-FPM-FAST: "-ffast-math"
9799
// CHECK-FPM-FAST: "-ffinite-math-only"
98100

99-
// RUN: %clang -### -nostdinc -ffp-model=precise -c %s 2>&1 \
101+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-model=precise -c %s 2>&1 \
100102
// RUN: | FileCheck --check-prefix=CHECK-FPM-PRECISE %s
101103
// CHECK-FPM-PRECISE: "-cc1"
102-
// CHECK-FPM-PRECISE: "-ffp-contract=fast"
104+
// CHECK-FPM-PRECISE: "-ffp-contract=on"
103105
// CHECK-FPM-PRECISE: "-fno-rounding-math"
104106

105-
// RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
107+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-model=strict -c %s 2>&1 \
106108
// RUN: | FileCheck --check-prefix=CHECK-FPM-STRICT %s
107109
// CHECK-FPM-STRICT: "-cc1"
110+
// CHECK-FPM-STRICT: "-fmath-errno"
111+
// CHECK-FPM-STRICT: "-ffp-contract=off"
108112
// CHECK-FPM-STRICT: "-frounding-math"
109113
// CHECK-FPM-STRICT: "-ffp-exception-behavior=strict"
110114

111115

112-
// RUN: %clang -### -nostdinc -ffp-exception-behavior=strict -c %s 2>&1 \
116+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-exception-behavior=strict -c %s 2>&1 \
113117
// RUN: | FileCheck --check-prefix=CHECK-FEB-STRICT %s
114118
// CHECK-FEB-STRICT: "-cc1"
115119
// CHECK-FEB-STRICT: "-fno-rounding-math"
116120
// CHECK-FEB-STRICT: "-ffp-exception-behavior=strict"
117121

118-
// RUN: %clang -### -nostdinc -ffp-exception-behavior=maytrap -c %s 2>&1 \
122+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-exception-behavior=maytrap -c %s 2>&1 \
119123
// RUN: | FileCheck --check-prefix=CHECK-FEB-MAYTRAP %s
120124
// CHECK-FEB-MAYTRAP: "-cc1"
121125
// CHECK-FEB-MAYTRAP: "-fno-rounding-math"
122126
// CHECK-FEB-MAYTRAP: "-ffp-exception-behavior=maytrap"
123127

124-
// RUN: %clang -### -nostdinc -ffp-exception-behavior=ignore -c %s 2>&1 \
128+
// RUN: %clang -target x86_64 -### -nostdinc -ffp-exception-behavior=ignore -c %s 2>&1 \
125129
// RUN: | FileCheck --check-prefix=CHECK-FEB-IGNORE %s
126130
// CHECK-FEB-IGNORE: "-cc1"
127131
// CHECK-FEB-IGNORE: "-fno-rounding-math"
128132
// CHECK-FEB-IGNORE: "-ffp-exception-behavior=ignore"
129-

0 commit comments

Comments
 (0)