[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
This revision was automatically updated to reflect the committed changes. Closed by commit rL284121: Guard flag –fdenormal-fp-math with –fno-fast-math. (authored by SjoerdMeijer). Changed prior to commit: https://reviews.llvm.org/D25479?vs=74363=74508#toc Repository: rL LLVM https://reviews.llvm.org/D25479 Files: cfe/trunk/lib/Driver/Tools.cpp cfe/trunk/test/Driver/denormal-fp-math.c Index: cfe/trunk/test/Driver/denormal-fp-math.c === --- cfe/trunk/test/Driver/denormal-fp-math.c +++ cfe/trunk/test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -4391,11 +4391,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); // Validate and pass through -fp-contract option. if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, Index: cfe/trunk/test/Driver/denormal-fp-math.c === --- cfe/trunk/test/Driver/denormal-fp-math.c +++ cfe/trunk/test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: cfe/trunk/lib/Driver/Tools.cpp === --- cfe/trunk/lib/Driver/Tools.cpp +++ cfe/trunk/lib/Driver/Tools.cpp @@ -4391,11 +4391,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, +
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
SjoerdMeijer added a comment. thanks again for reviewing. https://reviews.llvm.org/D25479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
rengolin accepted this revision. rengolin added a comment. This revision is now accepted and ready to land. LGTM, thanks! https://reviews.llvm.org/D25479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
SjoerdMeijer updated this revision to Diff 74363. SjoerdMeijer added a comment. Thanks for catching this: the logic and test have been updated. https://reviews.llvm.org/D25479 Files: lib/Driver/Tools.cpp test/Driver/denormal-fp-math.c Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); // Validate and pass through -fp-contract option. if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,12 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-unsafe-math-optimizations -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,18 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_funsafe_math_optimizations, + options::OPT_fno_unsafe_math_optimizations, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) +
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
rengolin added inline comments. Comment at: test/Driver/denormal-fp-math.c:4 // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s Please add all tests that the change is covering. https://reviews.llvm.org/D25479 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25479: Guard flag –fdenormal-fp-math with –fno-fast-math
SjoerdMeijer created this revision. SjoerdMeijer added reviewers: rengolin, jmolloy. SjoerdMeijer added a subscriber: cfe-commits. Guard the -fdenormal-fp-math with -fno-fast-math. This allows disabling the FP options with just one flag: –fno-fast-math. https://reviews.llvm.org/D25479 Files: lib/Driver/Tools.cpp test/Driver/denormal-fp-math.c Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,11 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,16 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); // Validate and pass through -fp-contract option. if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, Index: test/Driver/denormal-fp-math.c === --- test/Driver/denormal-fp-math.c +++ test/Driver/denormal-fp-math.c @@ -1,9 +1,11 @@ // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -v 2>&1 | FileCheck -check-prefix=CHECK-IEEE %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=preserve-sign -v 2>&1 | FileCheck -check-prefix=CHECK-PS %s // RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=positive-zero -v 2>&1 | FileCheck -check-prefix=CHECK-PZ %s +// RUN: %clang -### -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=ieee -fno-fast-math -v 2>&1 | FileCheck -check-prefix=CHECK-NO-UNSAFE %s // RUN: not %clang -target arm-unknown-linux-gnu -c %s -fdenormal-fp-math=foo -v 2>&1 | FileCheck -check-prefix=CHECK-INVALID %s // CHECK-IEEE: "-fdenormal-fp-math=ieee" // CHECK-PS: "-fdenormal-fp-math=preserve-sign" // CHECK-PZ: "-fdenormal-fp-math=positive-zero" +// CHECK-NO-UNSAFE-NOT: "-fdenormal-fp-math=ieee" // CHECK-INVALID: error: invalid value 'foo' in '-fdenormal-fp-math=foo' Index: lib/Driver/Tools.cpp === --- lib/Driver/Tools.cpp +++ lib/Driver/Tools.cpp @@ -4390,11 +4390,16 @@ if (ReciprocalMath) CmdArgs.push_back("-freciprocal-math"); - if (!TrappingMath) + if (!TrappingMath) CmdArgs.push_back("-fno-trapping-math"); - if (Args.hasArg(options::OPT_fdenormal_fp_math_EQ)) -Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); + + if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, + options::OPT_fno_fast_math, + options::OPT_fdenormal_fp_math_EQ)) +if (A->getOption().getID() != options::OPT_fno_fast_math && +A->getOption().getID() != options::OPT_fno_unsafe_math_optimizations) + Args.AddLastArg(CmdArgs, options::OPT_fdenormal_fp_math_EQ); // Validate and pass through -fp-contract option. if (Arg *A = Args.getLastArg(options::OPT_ffast_math, FastMathAliasOption, ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits