rupprecht created this revision. rupprecht added reviewers: mibintc, chandlerc, echristo, rjmccall, kpn, erichkeane, rsmith, andrew.w.kaylor. Herald added a project: clang. Herald added a subscriber: cfe-commits.
D62731 <https://reviews.llvm.org/D62731> implements an incomplete/experimental version of rounding math, but since the flag doesn't have "experimental" in the name, the feedback that it is experimental is in the form of -Wexperimental-float-control. Since this flag is already being accepted as a gcc compatability arg, put the current implementation being `-f[no-]experimental-rounding-math` instead, and allow `-frounding-math` as an ignored arg. Because "experimental" is now in the flag name, remove the warning -- it's now clear that the feature is incomplete/experimental when invoking it. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D71635 Files: clang/docs/UsersManual.rst clang/include/clang/Basic/DiagnosticDriverKinds.td clang/include/clang/Basic/DiagnosticGroups.td clang/include/clang/Driver/Options.td clang/lib/Driver/ToolChains/Clang.cpp clang/test/CodeGen/fpconstrained.c clang/test/CodeGen/fpconstrained.cpp clang/test/Driver/clang_f_opts.c clang/test/Driver/fp-model.c
Index: clang/test/Driver/fp-model.c =================================================================== --- clang/test/Driver/fp-model.c +++ 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" Index: clang/test/Driver/clang_f_opts.c =================================================================== --- clang/test/Driver/clang_f_opts.c +++ 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 Index: clang/test/CodeGen/fpconstrained.cpp =================================================================== --- clang/test/CodeGen/fpconstrained.cpp +++ 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 Index: clang/test/CodeGen/fpconstrained.c =================================================================== --- clang/test/CodeGen/fpconstrained.c +++ 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 Index: clang/lib/Driver/ToolChains/Clang.cpp =================================================================== --- clang/lib/Driver/ToolChains/Clang.cpp +++ 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=" + Index: clang/include/clang/Driver/Options.td =================================================================== --- clang/include/clang/Driver/Options.td +++ clang/include/clang/Driver/Options.td @@ -1158,8 +1158,8 @@ // This option was originally misspelt "infinites" [sic]. def : Flag<["-"], "fhonor-infinites">, Alias<fhonor_infinities>; def : Flag<["-"], "fno-honor-infinites">, Alias<fno_honor_infinities>; -def frounding_math : Flag<["-"], "frounding-math">, Group<f_Group>, Flags<[CC1Option]>; -def fno_rounding_math : Flag<["-"], "fno-rounding-math">, Group<f_Group>, Flags<[CC1Option]>; +def frounding_math : Flag<["-"], "fexperimental-rounding-math">, Group<f_Group>, Flags<[CC1Option]>; +def fno_rounding_math : Flag<["-"], "fno-experimental-rounding-math">, Group<f_Group>, Flags<[CC1Option]>; def ftrapping_math : Flag<["-"], "ftrapping-math">, Group<f_Group>, Flags<[CC1Option]>; def fno_trapping_math : Flag<["-"], "fno-trapping-math">, Group<f_Group>, Flags<[CC1Option]>; def ffp_contract : Joined<["-"], "ffp-contract=">, Group<f_Group>, @@ -3252,6 +3252,7 @@ defm regs_graph : BooleanFFlag<"regs-graph">, Group<clang_ignored_f_Group>; defm rename_registers : BooleanFFlag<"rename-registers">, Group<clang_ignored_gcc_optimization_f_Group>; defm ripa : BooleanFFlag<"ripa">, Group<clang_ignored_f_Group>; +defm ignored_rounding_math : BooleanFFlag<"rounding-math">, Group<clang_ignored_gcc_optimization_f_Group>; defm schedule_insns : BooleanFFlag<"schedule-insns">, Group<clang_ignored_gcc_optimization_f_Group>; defm schedule_insns2 : BooleanFFlag<"schedule-insns2">, Group<clang_ignored_gcc_optimization_f_Group>; defm see : BooleanFFlag<"see">, Group<clang_ignored_f_Group>; Index: clang/include/clang/Basic/DiagnosticGroups.td =================================================================== --- clang/include/clang/Basic/DiagnosticGroups.td +++ 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">; Index: clang/include/clang/Basic/DiagnosticDriverKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticDriverKinds.td +++ clang/include/clang/Basic/DiagnosticDriverKinds.td @@ -441,10 +441,6 @@ "-fexperimental-isel support is incomplete for this architecture at the current optimization level">, InGroup<ExperimentalISel>; -def warn_drv_experimental_fp_control_incomplete_opt : Warning< - "Support for floating point control option %0 is incomplete and experimental">, - InGroup<ExperimentalFloatControl>; - def warn_drv_moutline_unsupported_opt : Warning< "The '%0' architecture does not support -moutline; flag ignored">, InGroup<OptionIgnored>; Index: clang/docs/UsersManual.rst =================================================================== --- clang/docs/UsersManual.rst +++ 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=<value> @@ -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
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits