This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/47556] New: x86: fails to take advantage of high-byte addressing mode


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

           Summary: x86: fails to take advantage of high-byte addressing
                    mode
           Product: gcc
           Version: 4.5.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jeremy@goop.org


Created attachment 23188
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23188
Preprocessed file

When comparing two bytes in a 16-bit value, gcc introduces an unnecessary temp
register rather than just directly comparing the two byte halves.

In the attached source, the code generated for

  if (inc.head == inc.tail)
   goto out;

is
        movzbl  %ah, %edx
        cmpb    %al, %dl

rather than simply
        cmpb %ah, %al

If it did, then the code would be identical to the hand-written asm it is
intended to replace.

I'm compiling with "gcc -S -O2 -Wall halfreg-codegen.i"

The gcc version is the standard Fedora 14 package:
$ gcc -v
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.5.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla
--enable-bootstrap --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-gnu-unique-object
--enable-linker-build-id
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada,lto --enable-plugin
--enable-java-awt=gtk --disable-dssi
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre
--enable-libgcj-multifile --enable-java-maintainer-mode
--with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib
--with-ppl --with-cloog --with-tune=generic --with-arch_32=i686
--build=x86_64-redhat-linux
Thread model: posix
gcc version 4.5.1 20100924 (Red Hat 4.5.1-4) (GCC) 

$ rpm -q gcc
gcc-4.5.1-4.fc14.x86_64


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]