[Bug target/34072] New: unoptimal byte extraction.

pluto at agmk dot net gcc-bugzilla@gcc.gnu.org
Mon Nov 12 14:50:00 GMT 2007


$ cat b.cpp

unsigned char byte0( unsigned long long x ) { return x; }
unsigned char byte1( unsigned long long x ) { return ( x >> 8 ); }
unsigned char byte6( unsigned long long x ) { return ( x >> 48 ); }
unsigned char byte7( unsigned long long x ) { return ( x >> 56 ); }

$ /opt/gcc43/bin/g++ b.cpp -fomit-frame-pointer -m32 -O2 -c && objdump -dC b.o

00000000 <byte0(unsigned long long)>:
   0:   0f b6 44 24 04          movzbl 0x4(%esp),%eax
   5:   c3                      ret

00000010 <byte1(unsigned long long)>:
  10:   8b 44 24 04             mov    0x4(%esp),%eax  \
  14:   8b 54 24 08             mov    0x8(%esp),%edx   = why not movzbl
5(esp)?
  18:   0f ac d0 08             shrd   $0x8,%edx,%eax  /
  1c:   c3                      ret

00000020 <byte6(unsigned long long)>:
  20:   0f b7 44 24 0a          movzwl 0xa(%esp),%eax
  25:   c3                      ret

00000030 <byte7(unsigned long long)>:
  30:   0f b6 44 24 0b          movzbl 0xb(%esp),%eax
  35:   c3                      ret


-- 
           Summary: unoptimal byte extraction.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: ix86-gnu-linux


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



More information about the Gcc-bugs mailing list