[llvm-commits] [llvm-gcc-4.2] r108472 - in /llvm-gcc-4.2/trunk/gcc: c-cppbuiltin.c common.opt doc/llvm-gcc.1 flags.h llvm-backend.cpp opts.c tree-eh.c
Evan Cheng
evan.cheng at apple.com
Thu Jul 15 16:10:17 PDT 2010
Author: evancheng
Date: Thu Jul 15 18:10:17 2010
New Revision: 108472
URL: http://llvm.org/viewvc/llvm-project?rev=108472&view=rev
Log:
Added -fno-honor-nans (-fhonor-nans is the default) and -fno-honor-infinites (-fhonor-inifinites is the default). These allow optimizations for fp math to assume the arguments and results are not NaNs / +-Infs respectively.
-ffinite-math-only implies -fno-honor-nans and -fno-honor-infinites.
Modified:
llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c
llvm-gcc-4.2/trunk/gcc/common.opt
llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1
llvm-gcc-4.2/trunk/gcc/flags.h
llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
llvm-gcc-4.2/trunk/gcc/opts.c
llvm-gcc-4.2/trunk/gcc/tree-eh.c
Modified: llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c (original)
+++ llvm-gcc-4.2/trunk/gcc/c-cppbuiltin.c Thu Jul 15 18:10:17 2010
@@ -598,7 +598,8 @@
cpp_define (pfile, "__NO_INLINE__");
if (flag_signaling_nans)
cpp_define (pfile, "__SUPPORT_SNAN__");
- if (flag_finite_math_only)
+ /* LLVM LOCAL */
+ if (!flag_honor_infinites & !flag_honor_nans)
cpp_define (pfile, "__FINITE_MATH_ONLY__=1");
else
cpp_define (pfile, "__FINITE_MATH_ONLY__=0");
Modified: llvm-gcc-4.2/trunk/gcc/common.opt
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/common.opt?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/common.opt (original)
+++ llvm-gcc-4.2/trunk/gcc/common.opt Thu Jul 15 18:10:17 2010
@@ -537,6 +537,16 @@
Assume no NaNs or infinities are generated
; APPLE LOCAL end optimization pragmas 3124235/3420242
+; LLVM LOCAL begin
+fhonor-nans
+Common Report Var(flag_honor_nans) Init(1) PerFunc
+Assume no NaNs are generated
+
+fhonor-infinites
+Common Report Var(flag_honor_infinites) Init(1) PerFunc
+Assume no infinites are generated
+; LLVM LOCAL end
+
ffixed-
Common Joined RejectNegative
-ffixed-<register> Mark <register> as being unavailable to the compiler
Modified: llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 (original)
+++ llvm-gcc-4.2/trunk/gcc/doc/llvm-gcc.1 Thu Jul 15 18:10:17 2010
@@ -25,6 +25,14 @@
.Bl -tag -width -indent
.It Fl flto
Enables Link Time Optimization. Link Time Optimization is performed by ld(1) transparently using the LLVM optimizer. The object file generated contains intermediate LLVM bitcode instead of Mach-O objects.
+.It Fl fno-honor-nans
+Allow optimizations for floating-point arithmetic that assume that arguments and results are not NaNs.
+
+The default is -fhonor-nans.
+.It Fl fno-honor-infinites
+Allow optimizations for floating-point arithmetic that assume that arguments and results are not +-Infs.
+
+The default is -fhonor-infinites.
.It Fl O4
Enables Link Time Optimization in addition to all optimizations enabled at -O3.
.It Fl O
Modified: llvm-gcc-4.2/trunk/gcc/flags.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/flags.h?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/flags.h (original)
+++ llvm-gcc-4.2/trunk/gcc/flags.h Thu Jul 15 18:10:17 2010
@@ -284,16 +284,18 @@
x * 0 into 0, are not correct for NaN operands, and are normally
disabled for modes with NaNs. The user can ask for them to be
done anyway using the -funsafe-math-optimizations switch. */
+/* LLVM LOCAL */
#define HONOR_NANS(MODE) \
- (MODE_HAS_NANS (MODE) && !flag_finite_math_only)
+ (MODE_HAS_NANS (MODE) && flag_honor_nans)
/* Like HONOR_NANs, but true if we honor signaling NaNs (or sNaNs). */
#define HONOR_SNANS(MODE) (flag_signaling_nans && HONOR_NANS (MODE))
/* As for HONOR_NANS, but true if the mode can represent infinity and
the treatment of infinite values is important. */
+/* LLVM LOCAL */
#define HONOR_INFINITIES(MODE) \
- (MODE_HAS_INFINITIES (MODE) && !flag_finite_math_only)
+ (MODE_HAS_INFINITIES (MODE) && flag_honor_infinites)
/* Like HONOR_NANS, but true if the given mode distinguishes between
positive and negative zero, and the sign of zero is important. */
Modified: llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-backend.cpp Thu Jul 15 18:10:17 2010
@@ -411,10 +411,10 @@
Args.push_back("--time-passes");
if (fast_math_flags_set_p())
Args.push_back("--enable-unsafe-fp-math");
- if (flag_finite_math_only) {
- Args.push_back("--enable-no-nans-fp-math");
+ if (!flag_honor_infinites)
Args.push_back("--enable-no-infs-fp-math");
- }
+ if (!flag_honor_nans)
+ Args.push_back("--enable-no-nans-fp-math");
if (!flag_omit_frame_pointer)
Args.push_back("--disable-fp-elim");
if (!flag_zero_initialized_in_bss)
Modified: llvm-gcc-4.2/trunk/gcc/opts.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/opts.c?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/opts.c (original)
+++ llvm-gcc-4.2/trunk/gcc/opts.c Thu Jul 15 18:10:17 2010
@@ -1005,6 +1005,13 @@
set_fast_math_flags (value);
break;
+ /* LLVM LOCAL begin */
+ case OPT_ffinite_math_only:
+ flag_honor_infinites = !value;
+ flag_honor_nans = !value;
+ break;
+ /* LLVM LOCAL end */
+
case OPT_ffixed_:
fix_register (arg, 1, 1);
break;
@@ -1297,7 +1304,10 @@
{
flag_trapping_math = !set;
flag_unsafe_math_optimizations = set;
- flag_finite_math_only = set;
+ /* LLVM LOCAL begin */
+ flag_honor_infinites = !set;
+ flag_honor_nans = !set;
+ /* LLVM LOCAL end */
flag_errno_math = !set;
if (set)
{
@@ -1313,7 +1323,10 @@
{
return (!flag_trapping_math
&& flag_unsafe_math_optimizations
- && flag_finite_math_only
+ /* LLVM LOCAL begin */
+ && !flag_honor_infinites
+ && !flag_honor_nans
+ /* LLVM LOCAL end */
&& !flag_errno_math);
}
Modified: llvm-gcc-4.2/trunk/gcc/tree-eh.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/tree-eh.c?rev=108472&r1=108471&r2=108472&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/tree-eh.c (original)
+++ llvm-gcc-4.2/trunk/gcc/tree-eh.c Thu Jul 15 18:10:17 2010
@@ -1872,7 +1872,8 @@
fp_operation = FLOAT_TYPE_P (t);
if (fp_operation)
{
- honor_nans = flag_trapping_math && !flag_finite_math_only;
+ /* LLVM LOCAL */
+ honor_nans = flag_trapping_math && flag_honor_nans;
honor_snans = flag_signaling_nans != 0;
}
else if (INTEGRAL_TYPE_P (t) && TYPE_OVERFLOW_TRAPS (t))
More information about the llvm-commits
mailing list