This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Failed cross: Alpha->ARM
- To: egcs at cygnus dot com
- Subject: Re: Failed cross: Alpha->ARM
- From: Richard Earnshaw <rearnsha at arm dot com>
- Date: Tue, 16 Dec 1997 17:31:31 +0000
- Cc: rearnsha at arm dot com, Stephen Williams <steve at icarus dot icarus dot com>, Dave Gilbert <gilbertd at treblig dot org>, Nick Clifton <nickc at cygnus dot com>, kenner at vlsi1 dot ultra dot nyu dot edu
- Organization: Advanced RISC Machines Ltd.
- Reply-To: egcs at cygnus dot com
gilbertd@treblig.org said:
> Hi,
> Host: Alpha Linux RedHat 5.0
> Target: ARM Linux
> Problem: Constant greater than 2^32 generated in assembler file
> Suspected cause: Converting a -1 to 2^32 and then propogating the
> value.
> ----------------------------------------------------
> Example source file:
> typedef struct {
> int a[10];
> } foo;
>
> foo* x;
> static foo y[128];
>
> int a() {
> do {
> } while (x < y + 128-1);
> };
Stephen Williams <steve@icarus.icarus.com> wrote:
> Host: Alpha Linux RedHat 5.0
> Target: ARM Linux
> Problem: Constant greater than 2^32 generated in assembler file
> Suspected cause: Converting a -1 to 2^32 and then propogating the value.
>
> Try this patch. (In spite of the name, it does apply to the egcs-1.0
> sources.) As I understand it, it does indeed mess up detecting if the
> constant that is can load in a simple instruction or requires more
> complex handling. Here is a ChangeLog and the patch itself.
>
> Mon Oct 20 08:49:16 1997 Stephen Williams <steve@icarus.com>
>
> * gcc/config/arm/arm.c: Fixed problem with 64bit hosts generating
> bogus assembler for long long constants.
>
>
First this patch doesn't fix the problem. Second it is wrong, since it
doesn't take into account assumptions elsewhere about use of HOST_WIDE_INT
when that is more than 32-bits. (The latest egcs snapshot contains the
correct fixes for this).
The patch below fixes the problem reported.
Tue Dec 16 17:13:43 1997 Richard Earnshaw (rearnsha@arm.com)
* explow.c (plus_constant_wide, case PLUS): Truncate any sum of
two integers to the width of the mode.
*** explow.c.keep Sat Dec 6 17:19:52 1997
--- explow.c Tue Dec 16 17:21:44 1997
*************** plus_constant_wide (x, c)
*** 116,122 ****
that we handle specially, such as a SYMBOL_REF. */
if (GET_CODE (XEXP (x, 1)) == CONST_INT)
! return plus_constant (XEXP (x, 0), c + INTVAL (XEXP (x, 1)));
else if (CONSTANT_P (XEXP (x, 0)))
return gen_rtx (PLUS, mode,
plus_constant (XEXP (x, 0), c),
--- 116,123 ----
that we handle specially, such as a SYMBOL_REF. */
if (GET_CODE (XEXP (x, 1)) == CONST_INT)
! return plus_constant (XEXP (x, 0), ((c + INTVAL (XEXP (x, 1)))
! & GET_MODE_MASK (mode)));
else if (CONSTANT_P (XEXP (x, 0)))
return gen_rtx (PLUS, mode,
plus_constant (XEXP (x, 0), c),