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]

[mips patch RFA] don't use branch-likely insns based on -mtune.


Purpose seems fairly obvious.  If you're tuning for an arch were GCC's
typical use of branch-likely insns costs 10% performance on common
benchmarks, it seems like a good thing to *NOT USE THEM*.  8-)

Tested by building a sb1-elf compiler from current srcs (had to tweak
some other things to make that build for other reasons -- more later,
maybe), then checking to see that various arch/tune options did the
right thing.



chris

2004-05-03  Chris Demetriou  <cgd@broadcom.com>

	* config/mips/mips.c (override_options): Default to no
	generation of branch-likely operations when tuning for
	CPUs where they tend to have a negative performance impact
	(e.g., SB-1).

Index: mips.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/mips/mips.c,v
retrieving revision 1.408
diff -u -p -r1.408 mips.c
--- mips.c	30 Apr 2004 16:27:27 -0000	1.408
+++ mips.c	3 May 2004 22:13:35 -0000
@@ -4681,9 +4681,10 @@ override_options (void)
 	 architecture.
 
 	 By default, we enable use of Branch Likely instructions on
-	 all architectures which support them except for MIPS32 and MIPS64
-	 (i.e., the generic MIPS32 and MIPS64 ISAs, and processors which
-	 implement them).
+	 all architectures which support them with the following
+	 exceptions: when creating MIPS32 or MIPS64 code, and when
+	 tuning for architectures where their use tends to hurt
+	 performance.
 
 	 The MIPS32 and MIPS64 architecture specifications say "Software
 	 is strongly encouraged to avoid use of Branch Likely
@@ -4691,7 +4692,9 @@ override_options (void)
 	 of the [MIPS32 and MIPS64] architecture."  Therefore, we do not
 	 issue those instructions unless instructed to do so by
 	 -mbranch-likely.  */
-      if (ISA_HAS_BRANCHLIKELY && !(ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64))
+      if (ISA_HAS_BRANCHLIKELY
+	  && !(ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64)
+	  && !(TUNE_SB1))
 	target_flags |= MASK_BRANCHLIKELY;
       else
 	target_flags &= ~MASK_BRANCHLIKELY;


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