This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH,bionic] Add -foptimize-sincos


Bionic prior to Gingerbread doesn't support sincos*, but upstream GCC
enables sincos optimization for OPTION_BIONIC unconditionally since
4.6.  I'd like to propose a new flag -foptimize-sincos for NDK to
maintain backward compatibility.

1. For BIONIC: sincos optimization is disabled by default.  Apps built
for Gingerbread+ or AOSP platform build which uses the same compiler
as NDK, can add -foptimize-sincos to enhance performance.  (although
it's likely that only benchmarks may benefit)

2. Other C libs aren't affected.  sincos optimization is enabled for
GLIBC and disabled for othres, regardless of this flag.

====
Index: gcc/common.opt
===================================================================
--- gcc/common.opt (revision 199277)
+++ gcc/common.opt (working copy)
@@ -1591,6 +1591,10 @@
 Common Report Var(flag_optimize_sibling_calls) Optimization
 Optimize sibling and tail recursive calls

+foptimize-sincos
+Common Report Var(flag_optimize_sincos) Optimization
+Optimize calls to sin() and cos() with the same argument to sincos()
+
 fpartial-inlining
 Common Report Var(flag_partial_inlining)
 Perform partial inlining
Index: gcc/doc/invoke.texi
===================================================================
--- gcc/doc/invoke.texi (revision 199277)
+++ gcc/doc/invoke.texi (working copy)
@@ -388,7 +388,7 @@
 -fno-sched-interblock -fno-sched-spec -fno-signed-zeros @gol
 -fno-toplevel-reorder -fno-trapping-math -fno-zero-initialized-in-bss @gol
 -fomit-frame-pointer -foptimize-register-move -foptimize-sibling-calls @gol
--fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
+-foptimize-sincos -fpartial-inlining -fpeel-loops -fpredictive-commoning @gol
 -fprefetch-loop-arrays -fprofile-report @gol
 -fprofile-correction -fprofile-dir=@var{path} -fprofile-generate @gol
 -fprofile-generate=@var{path} @gol
@@ -6586,6 +6586,7 @@
 -fipa-profile @gol
 -fipa-reference @gol
 -fmerge-constants
+-foptimize-sincos @gol
 -fsplit-wide-types @gol
 -ftree-bit-ccp @gol
 -ftree-builtin-call-dce @gol
@@ -6772,6 +6773,12 @@

 Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.

+@item -foptimize-sincos
+@opindex foptimize-sincos
+Optimize calls to sin() and cos() with the same argument to sincos()
+
+Enabled at levels @option{-O}, @option{-O2}, @option{-O3}, @option{-Os}.
+
 @item -fno-inline
 @opindex fno-inline
 Do not expand any functions inline apart from those marked with
Index: gcc/config/linux.h
===================================================================
--- gcc/config/linux.h (revision 199277)
+++ gcc/config/linux.h (working copy)
@@ -102,7 +102,7 @@

 /* Whether we have sincos that follows the GNU extension.  */
 #undef TARGET_HAS_SINCOS
-#define TARGET_HAS_SINCOS (OPTION_GLIBC || OPTION_BIONIC)
+#define TARGET_HAS_SINCOS (OPTION_GLIBC || (OPTION_BIONIC &&
flag_optimize_sincos))

 /* Whether we have Bionic libc runtime */
 #undef TARGET_HAS_BIONIC


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]