public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug optimization/11259] New: [avr] gcc Double 'andi' missed optimization
@ 2003-06-19 23:33 chris at westnet dot com
  2003-11-11  4:23 ` [Bug target/11259] " roger at eyesopen dot com
  0 siblings, 1 reply; 5+ messages in thread
From: chris at westnet dot com @ 2003-06-19 23:33 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: [avr] gcc Double 'andi' missed optimization
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: chris@westnet.com
                CC: gcc-bugs@gcc.gnu.org

I've found what looks like a missed optimization in avr-gcc  3.3 20030512

        uint8_t Encoder;

        Encoder = (PORTD >> 4) & 12;
   0:   82 b3           in      r24, 0x12       ; 18
   2:   82 95           swap    r24
   4:   8f 70           andi    r24, 0x0F       ; 15
   6:   8c 70           andi    r24, 0x0C       ; 12

The 4 bit shift is implemented as a swap/andi , but with an explicit andi
afterwards, it seems like an obvious optimization to combine them.

Trivial example code below, compiled with:
avr-gcc -c e.c -g -O2 -mmcu=at90s8535 -o e.o
#include <avr/io.h>
#include <inttypes.h>


int8_t  test ()
{

        uint8_t Encoder;

        Encoder = (PORTD >> 4) & 12;
        return(Encoder);

}


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

end of thread, other threads:[~2008-08-22 23:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-11259-6346@http.gcc.gnu.org/bugzilla/>
2007-07-25  0:04 ` [Bug target/11259] [avr] gcc Double 'andi' missed optimization eweddington at cso dot atmel dot com
2007-11-28 22:07 ` rask at gcc dot gnu dot org
2008-08-22 21:27 ` aesok at gcc dot gnu dot org
2008-08-22 23:07 ` eric dot weddington at atmel dot com
2003-06-19 23:33 [Bug optimization/11259] New: " chris at westnet dot com
2003-11-11  4:23 ` [Bug target/11259] " roger at eyesopen dot com

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).