* Failed cross: Alpha->ARM
@ 1997-12-15 14:19 Dave Gilbert
1997-12-15 17:19 ` Nick Clifton
1997-12-15 21:01 ` Stephen Williams
0 siblings, 2 replies; 5+ messages in thread
From: Dave Gilbert @ 1997-12-15 14:19 UTC (permalink / raw)
To: egcs
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);
};
---------------------------------------------------------------
Duff output:
rfp .req r9
sl .req r10
fp .req r11
ip .req r12
sp .req r13
lr .req r14
pc .req r15
@ GNU C version egcs-2.91.02 971206 (gcc-2.8.0) (arm-unknown-linuxaout) compiled by GNU C version 2.7.2.3.
@ options passed:
@ options enabled: -fpeephole -ffunction-cse -fkeep-static-consts
@ -freg-struct-return -fsjlj-exceptions -fcommon -fverbose-asm -fgnu-linker
@ -fargument-alias
gcc2_compiled.:
___gnu_compiled_c:
.text
.align 0
.global _a
_a:
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 1, current_function_anonymous_args = 0
mov ip, sp
stmfd sp!, {fp, ip, lr, pc}
sub fp, ip, #4
mov r0, r0 @ nop
L2:
L4:
ldr r3, L6
ldr r2, [r3, #0]
ldr r3, L6+4
cmp r2, r3
bcc L5
b L3
L5:
b L4
L7:
.align 0
L6:
.word _x
.word _y+4294972376 < Bzzt!!!!!!!!!!
L3:
L1:
ldmea fp, {fp, sp, pc}^
.comm _x, 4 @ 4
.bss
.align 0
_y:
.space 5120
Dave
* NOTE: I have had mail problems over the last few days - things may *
* have bounced *
---------------------------------------------------- Man can not live -
David Alan Gilbert - gro.gilbert @ treblig.org ---- by bread alone. He
---------------------------------------------------- needs chocolate. -
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Failed cross: Alpha->ARM
1997-12-15 14:19 Failed cross: Alpha->ARM Dave Gilbert
@ 1997-12-15 17:19 ` Nick Clifton
1997-12-15 21:01 ` Stephen Williams
1 sibling, 0 replies; 5+ messages in thread
From: Nick Clifton @ 1997-12-15 17:19 UTC (permalink / raw)
To: gilbertd; +Cc: egcs
: Date: Mon, 15 Dec 1997 21:38:19 +0000 (GMT)
: From: Dave Gilbert <gilbertd@treblig.org>
:
: 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.
: ----------------------------------------------------
: Duff output:
:
: @ GNU C version egcs-2.91.02 971206 (gcc-2.8.0) (arm-unknown-linuxaout) compiled by GNU C version 2.7.2.3.
[snip]
: L6:
: .word _x
: .word _y+4294972376 < Bzzt!!!!!!!!!!
: L3:
: L1:
Hmm, I get the right output from the coff toolchain:
[snip]
.L6:
.word _x
.word _y+5080
.L3:
.L1:
This is from:
@ GNU C version cygnus-2.91.00 971101 (gcc2-971021 experimental) (arm-acorn-coff) compiled by GNU C version 2.7-97r1.
so maybe it is a problem with the linux part of the egcs backend. I
will try creating such a toolchain and see if I can reproduce the
problem.
Cheers
Nick
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Failed cross: Alpha->ARM
1997-12-15 14:19 Failed cross: Alpha->ARM Dave Gilbert
1997-12-15 17:19 ` Nick Clifton
@ 1997-12-15 21:01 ` Stephen Williams
1997-12-16 10:08 ` Richard Earnshaw
1997-12-16 23:33 ` Jeffrey A Law
1 sibling, 2 replies; 5+ messages in thread
From: Stephen Williams @ 1997-12-15 21:01 UTC (permalink / raw)
To: egcs
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.
diff --exclude=*~ --exclude=*.orig --exclude=testsuite -Npcr
egcs-971023/gcc/config/arm/arm.c ../egcs-971023/gcc/config/arm/arm.c
*** egcs-971023/gcc/config/arm/arm.c Mon Aug 11 08:57:24 1997
--- ../egcs-971023/gcc/config/arm/arm.c Mon Oct 27 20:38:41 1997
*************** const_ok_for_arm (i)
*** 407,412 ****
--- 407,415 ----
{
unsigned HOST_WIDE_INT mask = ~0xFF;
+ if (i & ~(unsigned HOST_WIDE_INT) 0xffffffff)
+ return FALSE;
+
/* Fast return for 0 and powers of 2 */
if ((i & (i - 1)) == 0)
return TRUE;
--
Steve Williams
steve@icarus.com
steve@picturel.com
"The woods are lovely, dark and deep. But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Failed cross: Alpha->ARM
1997-12-15 21:01 ` Stephen Williams
@ 1997-12-16 10:08 ` Richard Earnshaw
1997-12-16 23:33 ` Jeffrey A Law
1 sibling, 0 replies; 5+ messages in thread
From: Richard Earnshaw @ 1997-12-16 10:08 UTC (permalink / raw)
To: egcs; +Cc: rearnsha, Stephen Williams, Dave Gilbert, Nick Clifton, kenner
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.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Failed cross: Alpha->ARM
1997-12-15 21:01 ` Stephen Williams
1997-12-16 10:08 ` Richard Earnshaw
@ 1997-12-16 23:33 ` Jeffrey A Law
1 sibling, 0 replies; 5+ messages in thread
From: Jeffrey A Law @ 1997-12-16 23:33 UTC (permalink / raw)
To: Stephen Williams; +Cc: egcs
In message < 199712160500.VAA04153@icarus.icarus.com >you write:
> 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.
Hmmm, egcs already has code in this function to try and handle this kind
of problem. Why don't you pick up the latest snapshot and see why the
code to handle this problem isn't working? That would be a big help to
us.
jeff
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~1997-12-16 23:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-12-15 14:19 Failed cross: Alpha->ARM Dave Gilbert
1997-12-15 17:19 ` Nick Clifton
1997-12-15 21:01 ` Stephen Williams
1997-12-16 10:08 ` Richard Earnshaw
1997-12-16 23:33 ` Jeffrey A Law
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).