public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "joakim.tjernlund at transmode dot se" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug rtl-optimization/46854] PowerPC optimization regression Date: Thu, 09 Dec 2010 18:22:00 -0000 [thread overview] Message-ID: <bug-46854-4-SMsowPmmWd@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-46854-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46854 --- Comment #3 from joakim.tjernlund at transmode dot se <joakim.tjernlund at transmode dot se> 2010-12-09 18:21:50 UTC --- (In reply to comment #2) > Note, -O2 generates mostly the code you want, except that it looks the address > of the string twice: > > Here is the code generated with a 4.4.4 based compiler (the compiler happens to > be the IBM advance toolchain, version 3.0-1) using -O2 -m32 (-O1/-O3 generate > the same code): > > test: > mr. 0,3 > mtctr 0 > beq 0,.L10 > lis 3,.LANCHOR0@ha > la 3,.LANCHOR0@l(3) > .p2align 4,,15 > .L8: > lbzu 0,1(3) > cmpwi 7,0,0 > bne 7,.L8 > bdnz .L8 > blr > .L10: > lis 3,.LANCHOR0@ha > la 3,.LANCHOR0@l(3) > blr > > The SLES 11SP1 system compiler, which is based on GCC 4.3.4 generates the same > code. > > However, the GCC 4.6 trunk seems to have regressed slightly with -O2 or -O3, in > that it does not track that the lbzu updates the pointer, but maintains its own I have seen more similar mistakes such as not using lwzu/stwu at all. Will add a copy of a mail I sent earlier about that. > copy: > > mr. 0,3 > mtctr 0 > beq- 0,.L5 > lis 3,.LANCHOR0@ha > la 3,.LANCHOR0@l(3) > .L4: > mr 9,3 > .L3: > lbzu 0,1(9) > addi 3,3,1 > cmpwi 7,0,0 > bne+ 7,.L3 > bdnz .L4 > blr > .L5: > lis 3,.LANCHOR0@ha > la 3,.LANCHOR0@l(3) > blr > > Trunk with -Os does generate the two comparisons: > > mr 9,3 > lis 3,.LANCHOR0@ha > la 3,.LANCHOR0@l(3) > b .L2 > .L5: > mr 11,3 > addi 3,3,1 > lbz 0,1(11) > cmpwi 7,0,0 > bne+ 7,.L5 > addi 9,9,-1 > .L2: > cmpwi 7,9,0 > bne+ 7,.L5 > blr > > So, there are two bugs in this. One that -Os generates larger code than -O2, > and the code regression for GCC 4.6. And gcc 4.4.4/4.4.5. I suspect this started much earlier though.
next prev parent reply other threads:[~2010-12-09 18:22 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-12-08 19:59 [Bug rtl-optimization/46854] New: " joakim.tjernlund at transmode dot se 2010-12-09 9:11 ` [Bug rtl-optimization/46854] " joakim.tjernlund at transmode dot se 2010-12-09 17:57 ` meissner at gcc dot gnu.org 2010-12-09 18:22 ` joakim.tjernlund at transmode dot se [this message] 2010-12-09 18:24 ` joakim.tjernlund at transmode dot se
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-46854-4-SMsowPmmWd@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).