public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/32401]  New: [PPC/Altivec] Non optimal code structure with -mabi=altivec
@ 2007-06-19 13:06 sparky at pld-linux dot org
  0 siblings, 0 replies; only message in thread
From: sparky at pld-linux dot org @ 2007-06-19 13:06 UTC (permalink / raw)
  To: gcc-bugs

With altivec enabled gcc prepares additional space on the stack. Unlike earlier
versions gcc 4.3 removes stack modification instructions if it isn't used. With
just -maltivec or with -mabi=altivec when altivec isn't used it works very
well. But with -mabi=altivec and altivec used gcc produces code with stucture
similar to one produced by eariler gcc versions with just stack modification
instructions removed. Seems like stack isn't optimized early enough.


This simple code:

void
test ( int len )
{
        if (len) {
                vector unsigned char vSetTo = {};
                asm volatile ("" : : "v" (vSetTo) ); /* do something */
        }
}


"gcc-4.3 -O2 -maltivec -mregnames test.c -S" produces:

test:
        cmpwi %cr7,%r3,0
        beqlr- %cr7
        vxor %v0,%v0,%v0
        blr


while "gcc-4.3 -O2 -maltivec -mabi=altivec -mregnames test.c -S" produces:

test:
        cmpwi %cr7,%r3,0
        beq- %cr7,.L3      # <-- should be beqlr
        vxor %v0,%v0,%v0
.L3:
        blr


The letter one has same structure as produced by earlier gcc versions, but
without stack modification instructions:

gcc 4.1.3 produces:

test:
        cmpwi %cr7,%r3,0
        stwu %r1,-16(%r1)
        vxor %v0,%v0,%v0
        beq- %cr7,.L4
.L4:
        addi %r1,%r1,16
        blr


-- 
           Summary: [PPC/Altivec] Non optimal code structure with -
                    mabi=altivec
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sparky at pld-linux dot org
 GCC build triplet: powerpc*-linux
  GCC host triplet: powerpc*-linux
GCC target triplet: powerpc*-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32401


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-06-19 13:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-19 13:06 [Bug middle-end/32401] New: [PPC/Altivec] Non optimal code structure with -mabi=altivec sparky at pld-linux dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).