public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "gjl at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/41076] [avr] pessimal code for logical OR of 8-bit fields
Date: Tue, 22 Jan 2013 22:31:00 -0000 [thread overview]
Message-ID: <bug-41076-4-9y0Juh2Bk9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-41076-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41076
Georg-Johann Lay <gjl at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |REOPENED
Resolution|FIXED |
Target Milestone|4.7.1 |---
Severity|enhancement |normal
--- Comment #6 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2013-01-22 22:31:11 UTC ---
(In reply to comment #5)
> Fixed I suppose.
Unfortunately, not
extern unsigned char read8 (void);
unsigned short read16 (void)
{
unsigned char lo, hi;
hi = read8();
lo = read8();
return lo | hi << 8;
}
with 4.8.0 -S -Os the compiler needs 5 instructions (29, 37, 30, 38) for an
operation that is basically a no-op:
read16:
push r28 ; 31 pushqi1/1 [length = 1]
/* prologue: function */
/* frame size = 0 */
/* stack size = 1 */
.L__stack_usage = 1
call read8 ; 5 call_value_insn/2 [length = 2]
mov r28,r24 ; 6 movqi_insn/1 [length = 1]
call read8 ; 7 call_value_insn/2 [length = 2]
mov r18,r28 ; 28 movqi_insn/1 [length = 1]
ldi r19,0 ; 29 movqi_insn/1 [length = 1]
mov r19,r18 ; 37 *ashlhi3_const/3 [length = 2]
clr r18
or r18,r24 ; 30 iorqi3/1 [length = 1]
movw r24,r18 ; 38 *movhi/1 [length = 1]
/* epilogue start */
pop r28 ; 34 popqi [length = 1]
ret ; 35 return_from_epilogue [length = 1]
next prev parent reply other threads:[~2013-01-22 22:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-41076-4@http.gcc.gnu.org/bugzilla/>
2011-05-16 14:36 ` gjl at gcc dot gnu.org
2011-09-11 21:02 ` gjl at gcc dot gnu.org
2011-09-11 21:48 ` gjl at gcc dot gnu.org
2012-03-22 8:34 ` rguenth at gcc dot gnu.org
2012-07-02 13:53 ` rguenth at gcc dot gnu.org
2013-01-22 22:31 ` gjl at gcc dot gnu.org [this message]
2014-02-17 16:35 ` gjl at gcc dot gnu.org
2009-08-15 7:43 [Bug target/41076] New: " pb at gcc dot gnu dot org
2009-08-15 9:55 ` [Bug target/41076] " rguenth at gcc dot gnu dot org
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-41076-4-9y0Juh2Bk9@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: link
Be 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).