HelpText<"Specify which frame pointers to retain.">, Values<"all,non-leaf,none">,
NormalizedValuesScope<"CodeGenOptions::FramePointerKind">, NormalizedValues<["All", "NonLeaf", "None"]>,
MarshallingInfoEnum<CodeGenOpts<"FramePointer">, "None">;
-def mreassociate : Flag<["-"], "mreassociate">,
- HelpText<"Allow reassociation transformations for floating-point instructions">,
- MarshallingInfoFlag<LangOpts<"AllowFPReassoc">>, ImpliedByAnyOf<[funsafe_math_optimizations.KeyPath]>;
def mabi_EQ_ieeelongdouble : Flag<["-"], "mabi=ieeelongdouble">,
HelpText<"Use IEEE 754 quadruple-precision for long double">,
MarshallingInfoFlag<LangOpts<"PPCIEEELongDouble">>;
let Flags = [CC1Option, FC1Option, NoDriverOption] in {
+def mreassociate : Flag<["-"], "mreassociate">,
+ HelpText<"Allow reassociation transformations for floating-point instructions">,
+ MarshallingInfoFlag<LangOpts<"AllowFPReassoc">>, ImpliedByAnyOf<[funsafe_math_optimizations.KeyPath]>;
def menable_no_nans : Flag<["-"], "menable-no-nans">,
HelpText<"Allow optimization to assume there are no NaNs.">,
MarshallingInfoFlag<LangOpts<"NoHonorNaNs">>, ImpliedByAnyOf<[ffinite_math_only.KeyPath]>;
bool HonorNaNs = true;
bool ApproxFunc = false;
bool SignedZeros = true;
+ bool AssociativeMath = false;
if (const Arg *A = Args.getLastArg(options::OPT_ffp_contract)) {
const StringRef Val = A->getValue();
case options::OPT_fno_signed_zeros:
SignedZeros = false;
break;
+ case options::OPT_fassociative_math:
+ AssociativeMath = true;
+ break;
+ case options::OPT_fno_associative_math:
+ AssociativeMath = false;
+ break;
}
// If we handled this option claim it
if (!SignedZeros)
CmdArgs.push_back("-fno-signed-zeros");
+
+ if (AssociativeMath && !SignedZeros)
+ CmdArgs.push_back("-mreassociate");
}
void Flang::ConstructJob(Compilation &C, const JobAction &JA,
LANGOPT(ApproxFunc, 1, false)
/// Allow optimizations that ignore the sign of floating point zeros
LANGOPT(NoSignedZeros, 1, false)
+/// Allow reassociation transformations for floating-point instructions
+LANGOPT(AssociativeMath, 1, false)
#undef LANGOPT
#undef ENUM_LANGOPT
opts.NoSignedZeros = true;
}
+ if (const llvm::opt::Arg *a =
+ args.getLastArg(clang::driver::options::OPT_mreassociate)) {
+ diags.Report(diagUnimplemented) << a->getOption().getName();
+ opts.AssociativeMath = true;
+ }
+
return true;
}
! HELP-FC1-NEXT: -mmlir <value> Additional arguments to forward to MLIR's option processing
! HELP-FC1-NEXT: -module-dir <dir> Put MODULE files in <dir>
! HELP-FC1-NEXT: -module-suffix <suffix> Use <suffix> as the suffix for module files (the default value is `.mod`)
+! HELP-FC1-NEXT: -mreassociate Allow reassociation transformations for floating-point instructions
! HELP-FC1-NEXT: -mrelocation-model <value>
! HELP-FC1-NEXT: The relocation model to use
! HELP-FC1-NEXT: -nocpp Disable predefined and command line preprocessor macros
! RUN: -menable-no-nans \
! RUN: -fapprox-func \
! RUN: -fno-signed-zeros \
+! RUN: -mreassociate \
! RUN: %s 2>&1 | FileCheck %s
! CHECK: ffp-contract= is not currently implemented
! CHECK: menable-no-infs is not currently implemented
! CHECK: menable-no-nans is not currently implemented
! CHECK: fapprox-func is not currently implemented
! CHECK: fno-signed-zeros is not currently implemented
+! CHECK: mreassociate is not currently implemented
! RUN: -fno-honor-nans \
! RUN: -fapprox-func \
! RUN: -fno-signed-zeros \
+! RUN: -fassociative-math \
! RUN: -mllvm -print-before-all\
! RUN: -P \
! RUN: | FileCheck %s
! CHECK: "-menable-no-nans"
! CHECK: "-fapprox-func"
! CHECK: "-fno-signed-zeros"
+! CHECK: "-mreassociate"
! CHECK: "-fconvert=little-endian"
! CHECK: "-mllvm" "-print-before-all"