diff --git a/clang/docs/UsersManual.rst b/clang/docs/UsersManual.rst --- a/clang/docs/UsersManual.rst +++ b/clang/docs/UsersManual.rst @@ -1345,9 +1345,9 @@ Defaults to ``-fno-finite-math``. -.. _opt_frounding-math: +.. _opt_fexperimental-rounding-math: -**-f[no-]rounding-math** +**-f[no-]experimental-rounding-math** Force floating-point operations to honor the dynamically-set rounding mode by default. @@ -1355,8 +1355,8 @@ Note that floating-point operations performed as part of constant initialization are formally performed prior to the start of the program and are therefore not subject to the current rounding mode. This includes the initialization of global variables and local ``static`` variables. Floating-point operations in these contexts will be rounded using ``FE_TONEAREST``. -- The option ``-fno-rounding-math`` allows the compiler to assume that the rounding mode is set to ``FE_TONEAREST``. This is the default. -- The option ``-frounding-math`` forces the compiler to honor the dynamically-set rounding mode. This prevents optimizations which might affect results if the rounding mode changes or is different from the default; for example, it prevents floating-point operations from being reordered across most calls and prevents constant-folding when the result is not exactly representable. +- The option ``-fno-experimental-rounding-math`` allows the compiler to assume that the rounding mode is set to ``FE_TONEAREST``. This is the default. +- The option ``-fexperimental-rounding-math`` forces the compiler to honor the dynamically-set rounding mode. This prevents optimizations which might affect results if the rounding mode changes or is different from the default; for example, it prevents floating-point operations from being reordered across most calls and prevents constant-folding when the result is not exactly representable. .. option:: -ffp-model= @@ -1367,7 +1367,7 @@ Details: * ``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. - * ``strict`` Enables ``-frounding-math`` and ``-ffp-exception-behavior=strict``, and disables contractions (FMA). All of the ``-ffast-math`` enablements are disabled. + * ``strict`` Enables ``-fexperimental-rounding-math`` and ``-ffp-exception-behavior=strict``, and disables contractions (FMA). All of the ``-ffast-math`` enablements are disabled. * ``fast`` Behaves identically to specifying both ``-ffast-math`` and ``ffp-contract=fast`` Note: If your command line specifies multiple instances diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td --- a/clang/include/clang/Basic/DiagnosticDriverKinds.td +++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -441,10 +441,6 @@ "-fexperimental-isel support is incomplete for this architecture at the current optimization level">, InGroup; -def warn_drv_experimental_fp_control_incomplete_opt : Warning< - "Support for floating point control option %0 is incomplete and experimental">, - InGroup; - def warn_drv_moutline_unsupported_opt : Warning< "The '%0' architecture does not support -moutline; flag ignored">, InGroup; diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -1137,9 +1137,6 @@ // Warning for the experimental-isel options. def ExperimentalISel : DiagGroup<"experimental-isel">; -// Warning for the experimental float control options. -def ExperimentalFloatControl : DiagGroup<"experimental-float-control">; - // A warning group specifically for warnings related to function // multiversioning. def FunctionMultiVersioning : DiagGroup<"function-multiversion">; diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td --- a/clang/include/clang/Driver/Options.td +++ b/clang/include/clang/Driver/Options.td @@ -1158,8 +1158,8 @@ // This option was originally misspelt "infinites" [sic]. def : Flag<["-"], "fhonor-infinites">, Alias; def : Flag<["-"], "fno-honor-infinites">, Alias; -def frounding_math : Flag<["-"], "frounding-math">, Group, Flags<[CC1Option]>; -def fno_rounding_math : Flag<["-"], "fno-rounding-math">, Group, Flags<[CC1Option]>; +def frounding_math : Flag<["-"], "fexperimental-rounding-math">, Group, Flags<[CC1Option]>; +def fno_rounding_math : Flag<["-"], "fno-experimental-rounding-math">, Group, Flags<[CC1Option]>; def ftrapping_math : Flag<["-"], "ftrapping-math">, Group, Flags<[CC1Option]>; def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group, Flags<[CC1Option]>; def ffp_contract : Joined<["-"], "ffp-contract=">, Group, @@ -3252,6 +3252,7 @@ defm regs_graph : BooleanFFlag<"regs-graph">, Group; defm rename_registers : BooleanFFlag<"rename-registers">, Group; defm ripa : BooleanFFlag<"ripa">, Group; +defm ignored_rounding_math : BooleanFFlag<"rounding-math">, Group; defm schedule_insns : BooleanFFlag<"schedule-insns">, Group; defm schedule_insns2 : BooleanFFlag<"schedule-insns2">, Group; defm see : BooleanFFlag<"see">, Group; diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp --- a/clang/lib/Driver/ToolChains/Clang.cpp +++ b/clang/lib/Driver/ToolChains/Clang.cpp @@ -2456,15 +2456,7 @@ switch (optID) { default: break; - case options::OPT_frounding_math: - case options::OPT_ftrapping_math: - case options::OPT_ffp_exception_behavior_EQ: - D.Diag(clang::diag::warn_drv_experimental_fp_control_incomplete_opt) - << A->getOption().getName(); - break; case options::OPT_ffp_model_EQ: { - D.Diag(clang::diag::warn_drv_experimental_fp_control_incomplete_opt) - << A->getOption().getName(); // If -ffp-model= is seen, reset to fno-fast-math HonorINFs = true; HonorNaNs = true; @@ -2735,10 +2727,10 @@ CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + FPContract)); if (!RoundingFPMath) - CmdArgs.push_back(Args.MakeArgString("-fno-rounding-math")); + CmdArgs.push_back(Args.MakeArgString("-fno-experimental-rounding-math")); if (RoundingFPMath && RoundingMathPresent) - CmdArgs.push_back(Args.MakeArgString("-frounding-math")); + CmdArgs.push_back(Args.MakeArgString("-fexperimental-rounding-math")); if (!FPExceptionBehavior.empty()) CmdArgs.push_back(Args.MakeArgString("-ffp-exception-behavior=" + diff --git a/clang/test/CodeGen/fpconstrained.c b/clang/test/CodeGen/fpconstrained.c --- a/clang/test/CodeGen/fpconstrained.c +++ b/clang/test/CodeGen/fpconstrained.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -ftrapping-math -frounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT +// RUN: %clang_cc1 -ftrapping-math -fexperimental-rounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT // RUN: %clang_cc1 -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE // RUN: %clang_cc1 -ffast-math -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST // RUN: %clang_cc1 -ffast-math -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST diff --git a/clang/test/CodeGen/fpconstrained.cpp b/clang/test/CodeGen/fpconstrained.cpp --- a/clang/test/CodeGen/fpconstrained.cpp +++ b/clang/test/CodeGen/fpconstrained.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -x c++ -ftrapping-math -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT +// RUN: %clang_cc1 -x c++ -ftrapping-math -fexceptions -fcxx-exceptions -fexperimental-rounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT // RUN: %clang_cc1 -x c++ -ffp-contract=fast -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c --- a/clang/test/Driver/clang_f_opts.c +++ b/clang/test/Driver/clang_f_opts.c @@ -201,10 +201,10 @@ // CHECK-EXTENDED-IDENTIFIERS-NOT: "-fextended-identifiers" // CHECK-NO-EXTENDED-IDENTIFIERS: error: unsupported option '-fno-extended-identifiers' -// RUN: %clang -### -S -frounding-math %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH %s +// RUN: %clang -### -S -fexperimental-rounding-math %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH %s // CHECK-ROUNDING-MATH: "-cc1" -// CHECK-ROUNDING-MATH: "-frounding-math" -// CHECK-ROUNDING-MATH-NOT: "-fno-rounding-math" +// CHECK-ROUNDING-MATH: "-fexperimental-rounding-math" +// CHECK-ROUNDING-MATH-NOT: "-fno-experimental-rounding-math" // RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH-NOT %s // RUN: %clang -### -S -ffp-model=imprecise %s 2>&1 | FileCheck -check-prefix=CHECK-FPMODEL %s // CHECK-FPMODEL: unsupported argument 'imprecise' to option 'ffp-model=' @@ -257,6 +257,7 @@ // RUN: -fprofile-correction -fno-profile-correction \ // RUN: -fprofile-values -fno-profile-values \ // RUN: -frounding-math -fno-rounding-math \ +// RUN: -fexperimental-rounding-math -fno-experimental-rounding-math \ // RUN: -fsee -fno-see \ // RUN: -ftracer -fno-tracer \ // RUN: -funroll-all-loops -fno-unroll-all-loops \ @@ -339,6 +340,7 @@ // RUN: -fprefetch-loop-arrays \ // RUN: -fprofile-correction \ // RUN: -fprofile-values \ +// RUN: -frounding-math \ // RUN: -fschedule-insns \ // RUN: -fsignaling-nans \ // RUN: -fstrength-reduce \ @@ -403,6 +405,7 @@ // CHECK-WARNING-DAG: optimization flag '-fprefetch-loop-arrays' is not supported // CHECK-WARNING-DAG: optimization flag '-fprofile-correction' is not supported // CHECK-WARNING-DAG: optimization flag '-fprofile-values' is not supported +// CHECK-WARNING-DAG: optimization flag '-frounding-math' is not supported // CHECK-WARNING-DAG: optimization flag '-fschedule-insns' is not supported // CHECK-WARNING-DAG: optimization flag '-fsignaling-nans' is not supported // CHECK-WARNING-DAG: optimization flag '-fstrength-reduce' is not supported diff --git a/clang/test/Driver/fp-model.c b/clang/test/Driver/fp-model.c --- a/clang/test/Driver/fp-model.c +++ b/clang/test/Driver/fp-model.c @@ -43,9 +43,9 @@ // RUN: | FileCheck --check-prefix=WARN9 %s // WARN9: warning: overriding '-ffp-model=strict' option with '-fno-honor-nans' [-Woverriding-t-option] -// RUN: %clang -### -ffp-model=strict -fno-rounding-math -c %s 2>&1 \ +// RUN: %clang -### -ffp-model=strict -fno-experimental-rounding-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARNa %s -// WARNa: warning: overriding '-ffp-model=strict' option with '-fno-rounding-math' [-Woverriding-t-option] +// WARNa: warning: overriding '-ffp-model=strict' option with '-fno-experimental-rounding-math' [-Woverriding-t-option] // RUN: %clang -### -ffp-model=strict -fno-signed-zeros -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=WARNb %s @@ -70,12 +70,12 @@ // RUN: %clang -### -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NOROUND %s // CHECK-NOROUND: "-cc1" -// CHECK-NOROUND: "-fno-rounding-math" +// CHECK-NOROUND: "-fno-experimental-rounding-math" -// RUN: %clang -### -frounding-math -c %s 2>&1 \ +// RUN: %clang -### -fexperimental-rounding-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-ROUND --implicit-check-not ffp-exception-behavior=strict %s // CHECK-ROUND: "-cc1" -// CHECK-ROUND: "-frounding-math" +// CHECK-ROUND: "-fexperimental-rounding-math" // RUN: %clang -### -ftrapping-math -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-TRAP %s @@ -93,7 +93,7 @@ // CHECK-FPM-FAST: "-mreassociate" // CHECK-FPM-FAST: "-freciprocal-math" // CHECK-FPM-FAST: "-ffp-contract=fast" -// CHECK-FPM-FAST: "-fno-rounding-math" +// CHECK-FPM-FAST: "-fno-experimental-rounding-math" // CHECK-FPM-FAST: "-ffast-math" // CHECK-FPM-FAST: "-ffinite-math-only" @@ -101,37 +101,37 @@ // RUN: | FileCheck --check-prefix=CHECK-FPM-PRECISE %s // CHECK-FPM-PRECISE: "-cc1" // CHECK-FPM-PRECISE: "-ffp-contract=fast" -// CHECK-FPM-PRECISE: "-fno-rounding-math" +// CHECK-FPM-PRECISE: "-fno-experimental-rounding-math" // RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FPM-STRICT %s // CHECK-FPM-STRICT: "-cc1" // CHECK-FPM-STRICT: "-ftrapping-math" -// CHECK-FPM-STRICT: "-frounding-math" +// CHECK-FPM-STRICT: "-fexperimental-rounding-math" // CHECK-FPM-STRICT: "-ffp-exception-behavior=strict" // RUN: %clang -### -nostdinc -ftrapping-math -ffp-exception-behavior=ignore -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-TRAP-IGNORE %s // CHECK-TRAP-IGNORE: "-cc1" -// CHECK-TRAP-IGNORE: "-fno-rounding-math" +// CHECK-TRAP-IGNORE: "-fno-experimental-rounding-math" // CHECK-TRAP-IGNORE: "-ffp-exception-behavior=ignore" // RUN: %clang -### -nostdinc -ffp-exception-behavior=strict -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FEB-STRICT %s // CHECK-FEB-STRICT: "-cc1" -// CHECK-FEB-STRICT: "-fno-rounding-math" +// CHECK-FEB-STRICT: "-fno-experimental-rounding-math" // CHECK-FEB-STRICT: "-ffp-exception-behavior=strict" // RUN: %clang -### -nostdinc -ffp-exception-behavior=maytrap -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FEB-MAYTRAP %s // CHECK-FEB-MAYTRAP: "-cc1" -// CHECK-FEB-MAYTRAP: "-fno-rounding-math" +// CHECK-FEB-MAYTRAP: "-fno-experimental-rounding-math" // CHECK-FEB-MAYTRAP: "-ffp-exception-behavior=maytrap" // RUN: %clang -### -nostdinc -ffp-exception-behavior=ignore -c %s 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-FEB-IGNORE %s // CHECK-FEB-IGNORE: "-cc1" -// CHECK-FEB-IGNORE: "-fno-rounding-math" +// CHECK-FEB-IGNORE: "-fno-experimental-rounding-math" // CHECK-FEB-IGNORE: "-ffp-exception-behavior=ignore"