public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/36770]  New: PowerPC generated PTR code ineffiency
@ 2008-07-09 14:57 gunnar at greyhound-data dot com
  2008-07-09 18:23 ` [Bug middle-end/36770] " pinskia at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: gunnar at greyhound-data dot com @ 2008-07-09 14:57 UTC (permalink / raw)
  To: gcc-bugs

GCC fails to generate efficient code for basic pointer operations.

Please have a look at this example:
***
test.c:
register int * src asm("r15");

int test( ){
  src[1]=src[0];
  src++;
}

main(){
}

***

compile the above with gcc -S -O3 test.c

shows us the following ASM output:

test:
        mr 9,15
        addi 15,15,4
        lwz 0,0(9)
        stw 0,4(9)
        blr

compile with gcc -S -Os test.c
Gives this output
test:
        mr 9,15
        addi 15,15,4
        lwz 0,0(9)
        stw 0,4(9)
        blr


As you can see both -O3 and -Os produce the same output.
The generated output is far from optimal.

GCC generates for the simple pointer operation this code:
        mr 9,15
        addi 15,15,4
        lwz 0,0(9)
        stw 0,4(9)

But GCC should rather generate this:
        lwz 0,0(15)
        stwu 0,4(15)


Two of the four instructions are unneeded.
We've here code with literally thousands of unneeded instructions generated
like this.


I very much hope that this information is helpful to you and that you can fix
this.

Many thanks in advance

Gunnar von Boehn


-- 
           Summary: PowerPC generated PTR code ineffiency
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gunnar at greyhound-data dot com
 GCC build triplet: powerpc64-unknown-linux-gnu
  GCC host triplet: powerpc64-unknown-linux-gnu
GCC target triplet: powerpc64-unknown-linux-gnu


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


^ permalink raw reply	[flat|nested] 7+ messages in thread
[parent not found: <bug-36770-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-12-24 23:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-09 14:57 [Bug c/36770] New: PowerPC generated PTR code ineffiency gunnar at greyhound-data dot com
2008-07-09 18:23 ` [Bug middle-end/36770] " pinskia at gcc dot gnu dot org
2008-07-10  9:19 ` [Bug middle-end/36770] PowerPC generated PTR code inefficiency gunnar at greyhound-data dot com
2008-07-11 11:56 ` [Bug middle-end/36770] PowerPC missed autoincrement opportunity bonzini at gnu dot org
2008-07-18 13:42 ` bonzini at gnu dot org
2008-07-18 14:14 ` bonzini at gnu dot org
     [not found] <bug-36770-4@http.gcc.gnu.org/bugzilla/>
2013-12-24 23:13 ` steven at gcc dot gnu.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).