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 middle-end/33970] Missed optimization using unsigned char loop variable Date: Wed, 20 Jul 2011 17:48:00 -0000 [thread overview] Message-ID: <bug-33970-4-Td6yeFxSAT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-33970-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33970 Georg-Johann Lay <gjl at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |gjl at gcc dot gnu.org Resolution| |WORKSFORME Target Milestone|--- |4.7.0 Known to fail| | --- Comment #13 from Georg-Johann Lay <gjl at gcc dot gnu.org> 2011-07-20 17:47:44 UTC --- Cloased as WORKS FOR ME. Using the following test case: volatile unsigned char bar; void foo(void) { unsigned char x; for(x=0;x<128; x++) { bar = x; } } int sub2 (unsigned char); void foo2 (void) { unsigned char x; for(x=0;x<128; x++) { sub2 (x); } } void foo21 (void) { unsigned char x; for(x=0;x<128; x++) { sub2 (x+1); } } And with avr-gcc 4.7 r176517 I get the following result (-Os -mmcu=atmega8). In no case there is a 16-bit loop variable used. foo: ldi r24,lo8(0) .L5: sts bar,r24 subi r24,lo8(-(1)) cpi r24,lo8(-128) brne .L5 ret foo2: push r28 ldi r28,lo8(0) .L8: mov r24,r28 rcall sub2 subi r28,lo8(-(1)) cpi r28,lo8(-128) brne .L8 pop r28 ret foo21: push r28 ldi r28,lo8(0) .L11: subi r28,lo8(-(1)) mov r24,r28 rcall sub2 cpi r28,lo8(-128) brne .L11 pop r28 ret .ident "GCC: (GNU) 4.7.0 20110720 (experimental)"
next parent reply other threads:[~2011-07-20 17:48 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-33970-4@http.gcc.gnu.org/bugzilla/> 2011-07-20 17:48 ` gjl at gcc dot gnu.org [this message] 2007-11-01 13:44 [Bug c/33970] New: " henning dot m at insightbb dot com 2007-11-01 17:09 ` [Bug middle-end/33970] " pinskia at gcc dot gnu dot org 2007-11-01 17:28 ` eweddington at cso dot atmel dot com 2007-11-01 17:45 ` eweddington at cso dot atmel dot com 2007-11-01 17:47 ` eweddington at cso dot atmel dot com 2007-11-01 21:26 ` henning dot m at insightbb dot com 2007-11-04 23:28 ` eweddington at cso dot atmel dot com 2007-11-04 23:28 ` eweddington at cso dot atmel dot com 2007-11-05 22:48 ` wvangulik at xs4all dot nl 2007-11-06 12:37 ` henning dot m at insightbb dot com 2007-11-06 19:35 ` wvangulik at xs4all dot nl 2007-11-06 21:01 ` wvangulik at xs4all dot nl 2010-09-13 12:09 ` abnikant dot singh at atmel dot com
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-33970-4-Td6yeFxSAT@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).