This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c/3429: GCC-2.95.3 on target arc-elf32 generates bad code.
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/3429: GCC-2.95.3 on target arc-elf32 generates bad code.
- From: francisco dot blasco at ds2 dot es
- Date: 26 Jun 2001 17:15:25 -0000
- Reply-To: francisco dot blasco at ds2 dot es
>Number: 3429
>Category: c
>Synopsis: GCC-2.95.3 on target arc-elf32 generates bad code.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jun 26 10:16:02 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: francisco.blasco@ds2.es
>Release: gcc-2.95.3
>Organization:
>Environment:
>Description:
If you compiles GCC-2.95.3 for arc-elf32 target, it appears to work nicely.
But when you use the cross-compiler ans tries to compile next code:
int ll(int k)
{
return k<0?1234:0;
}
It generates bad assembler code:
.cpu base
__gnu_compiled_c:
.section .text
.align 4
.global ll
.type ll,@function
ll:
; BEGIN PROLOGUE ; vars= 0, regs= 0, args= 0, extra= 0
st %fp,[%sp]
mov %fp,%sp
; END PROLOGUE
sub.f 0,%r0,0
mov %r0,1234
mov.gt %r0,0 <<<<<<<<<<< BAD!!!!!!!!!
; EPILOGUE
j.d %blink
ld.a %fp,[%sp,0]
.Lfe1:
.size ll,.Lfe1-ll
.ident "GCC: (GNU) 2.95.3 20010315 (release)"
The instruction "mov.gt %r0, 0" must be "mov.ge %r0, 0".
>How-To-Repeat:
arc-elf32-gcc -S -O2 -o - kk3.c
>Fix:
I don't know. I learned to do some modifications to the arc.md file to add
some new intructions, but I don't know where I must search.
I can try to fix it, but I believe I don't know enough the gcc code.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="kk3.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="kk3.c"
aW50IGxsKGludCBrKQp7CiAgcmV0dXJuIGs8MD8xMjM0OjA7Cn0K