public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/49903] New: AVR: Redundant comparisons in binary-seach switch/case expansion
@ 2011-07-29 15:01 gjl at gcc dot gnu.org
  2011-07-29 15:08 ` [Bug target/49903] [avr] Redundant comparisons in binary-search " eric.weddington at atmel dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: gjl at gcc dot gnu.org @ 2011-07-29 15:01 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: AVR: Redundant comparisons in binary-seach switch/case
                    expansion
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gjl@gcc.gnu.org
                CC: eric.weddington@atmel.com
            Target: avr


Created attachment 24864
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24864
cswitch.c: C test case

avr-gcc emits redundant comparisons like these:

cpi r24,lo8(55)     ;  22    *cmpqi/3    [length = 1]
breq .L10     ;  23    branch    [length = 1]
cpi r24,lo8(56)     ;  24    *cmpqi/3    [length = 1]
brge .L19     ;  25    branch    [length = 1]

which could just as well be

cpi r24,lo8(55)     ;  22    *cmpqi/3    [length = 1]
breq .L10     ;  23    branch    [length = 1]
brge .L19     ;  25    branch    [length = 1]

or these:

cpi r24,lo8(100)     ;  61    *cmpqi/3    [length = 1]
breq .L16     ;  62    branch    [length = 1]
cpi r24,lo8(100)     ;  63    *cmpqi/3    [length = 1]
brlt .L15     ;  64    branch    [length = 1]

which could just as well be

cpi r24,lo8(100)     ;  61    *cmpqi/3    [length = 1]
breq .L16     ;  62    branch    [length = 1]
brlt .L15     ;  64    branch    [length = 1]

This concernes signed/unsigned comparisons for QI/HI/SI

-- command line ----------------------------------------------

avr-gcc cswitch.c -dp -S -Os

-- configure -------------------------------------------------

../../gcc.gnu.org/trunk/configure --target=avr
--prefix=/home/john/gnu/install/gcc-4.7 --disable-nls --disable-shared
--enable-languages=c,c++ --with-dwarf2 --disable-lto

-- GCC  -------------------------------------------------

as of 4.7.0 trunk, r176818 from 2011-07-27


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-08-14  9:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-29 15:01 [Bug target/49903] New: AVR: Redundant comparisons in binary-seach switch/case expansion gjl at gcc dot gnu.org
2011-07-29 15:08 ` [Bug target/49903] [avr] Redundant comparisons in binary-search " eric.weddington at atmel dot com
2011-07-29 16:11 ` gjl at gcc dot gnu.org
2011-08-02  0:12 ` rth at gcc dot gnu.org
2011-08-11 17:44 ` gjl at gcc dot gnu.org
2011-08-11 17:44 ` gjl at gcc dot gnu.org
2011-08-12 23:39 ` hp at gcc dot gnu.org
2011-08-14  9:12 ` gjl at gcc dot gnu.org
2011-08-14  9:22 ` gjl 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).