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,rs6000] don't overalign strings when optimizing for size


This patch is inspired by Richard Earnshaw's similar patch for ARM:

  http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01219.html

The only twist is that we respect TARGET_STRICT_ALIGN; trying a naive
application of Richard's patch made the code bigger on E500.  We win by
about 0.6% on CSiBE with -mcpu=603 -Os.

Tested on powerpc-linux-gnuspe and powerpc-linux-gnu.  OK to commit?

-Nathan

gcc/
2008-02-22  Nathan Froyd  <froydnj@codesourcery.com>

	* config/rs6000/rs6000.h (CONSTANT_ALIGNMENT): Don't overalign
	strings when optimizing for size, unless the target cares about
	alignment.

Index: config/rs6000/rs6000.h
===================================================================
--- config/rs6000/rs6000.h	(revision 132550)
+++ config/rs6000/rs6000.h	(working copy)
@@ -596,6 +596,7 @@ extern enum rs6000_nop_insertion rs6000_
    Make vector constants quadword aligned.  */
 #define CONSTANT_ALIGNMENT(EXP, ALIGN)                           \
   (TREE_CODE (EXP) == STRING_CST	                         \
+   && (TARGET_STRICT_ALIGN || !optimize_size)                    \
    && (ALIGN) < BITS_PER_WORD                                    \
    ? BITS_PER_WORD                                               \
    : (ALIGN))


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