This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH,rs6000] don't overalign strings when optimizing for size
- From: Nathan Froyd <froydnj at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: dje at watson dot ibm dot com
- Date: Fri, 22 Feb 2008 12:15:53 -0800
- Subject: [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))