On Fri, May 17, 2013 at 4:40 AM, Bill Schmidt <wschm...@linux.vnet.ibm.com> wrote: > This removes two degradations in CPU2006 for 32-bit PowerPC due to lost > vectorization opportunities. Previously, GCC treated malloc'd arrays as > only guaranteeing 4-byte alignment, even though the glibc implementation > guarantees 8-byte alignment. This raises the guarantee to 8 bytes, > which is sufficient to permit the missed vectorization opportunities. > > The guarantee for 64-bit PowerPC should be raised to 16-byte alignment, > but doing so currently exposes a latent bug that degrades a 64-bit > benchmark. I have therefore not included that change at this time, but > added a FIXME recording the information. > > Bootstrapped and tested on powerpc64-unknown-linux-gnu with no new > regressions. Verified that SPEC CPU2006 degradations are fixed with no > new degradations. Ok for trunk? Also, do you want any backports?
You say this is because glibc guarantees such alignment - shouldn't this be guarded by a proper check then? Probably AIX guarantees similar alignment but there are also embedded elf/newlib targets, no? Btw, the #define should possibly move to config/linux.h guarded by OPTION_GLIBC? Richard. > Thanks, > Bill > > > 2013-05-16 Bill Schmidt <wschm...@linux.vnet.ibm.com> > > * config/rs6000/rs6000.h (MALLOC_ABI_ALIGNMENT): New #define. > > > Index: gcc/config/rs6000/rs6000.h > =================================================================== > --- gcc/config/rs6000/rs6000.h (revision 198998) > +++ gcc/config/rs6000/rs6000.h (working copy) > @@ -2297,6 +2297,13 @@ extern char rs6000_reg_names[][8]; /* register > nam > /* How to align the given loop. */ > #define LOOP_ALIGN(LABEL) rs6000_loop_align(LABEL) > > +/* Alignment guaranteed by __builtin_malloc. */ > +/* FIXME: 128-bit alignment is guaranteed by glibc for TARGET_64BIT. > + However, specifying the stronger guarantee currently leads to > + a regression in SPEC CPU2006 437.leslie3d. The stronger > + guarantee should be implemented here once that's fixed. */ > +#define MALLOC_ABI_ALIGNMENT (64) > + > /* Pick up the return address upon entry to a procedure. Used for > dwarf2 unwind information. This also enables the table driven > mechanism. */ > >