[Bug c/35295] New: 64-bit host cross compile to 32-bit target differs from 32-bit host cross compile to 32-bit target

benny at ammitzboell-consult dot dk gcc-bugzilla@gcc.gnu.org
Fri Feb 22 14:19:00 GMT 2008


We are cross-compiling to a 32-bit ARM target from both 32-bit and 64-bit PCs.
The  gcc cross-compiler toolchain (3.4.6) generates valid code in both cases,
but the generated code is larger when a 64-bit host is used. We have tracked
this down to the following:

1) The RTL is using 64-bit (on the 64-bit host) to represent constants that is
calculated as part of the code-generation. Perhaps because print-rtl.c is using
HOST_WIDE_INT_xxx in some places. Surely any kind of constant number even in
high level RTL should be using the *target* int size and not the host?
2) The 64-bit constants are treated as such and thus generates more assembler
instructions to deal with the 64-bit number on the 32-bit target.

We have fixed the toolchain with a workaround where "-m32" is used to compile
the entire toolchain as 32-bit, but I think the correct solution would be to
ensure that constants used in the RTL are represented using the target format
in stead of the host.

As far as I can see from the code (print-rtl.c) the problem is still there in
gcc 4.2.3.


-- 
           Summary: 64-bit host cross compile to 32-bit target differs from
                    32-bit host cross compile to 32-bit target
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: benny at ammitzboell-consult dot dk
 GCC build triplet: i686-pc-linux-gnu / x86_64-unknown-linux-gnu
  GCC host triplet: i686-pc-linux-gnu / x86_64-unknown-linux-gnu
GCC target triplet: arm-uclinux-elf


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



More information about the Gcc-bugs mailing list