This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
pr26180.c
- From: Andreas Geißler <setjem at googlemail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 14 Nov 2012 14:37:30 +0100
- Subject: pr26180.c
Hi.
I need your help again. I wrote my own backend for the gcc-4.6.2 and
it works nearly perfectly. But there is a problem with the test case
pr26180.c.
In this special case the register (r8), which is used for the
comparison, is not loaded. And i don't get why.
C-Code (pr26180.c):
...
x2 = ((x > 0)? (x): -(x));
...
Wrong translated assembler code:
...
;x > 0?
cmpi.l r8,-2147483648 <- r8 is not used in the hole function
and so it is not initialized with x
jmp C,_L2
xori.l r8,-1
addi.l r8,1
_L2:
...
If i only change the comparison integer from 0 to 1 all works fine:
C-Code:
...
x2 = (x > 1 ? x : (-x));
...
Translated assembler code:
...
;load r8
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
;x > 1?
cmpi.l r8,-1
jmpn N,_L2
;x2 = -x
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
xori.l r8,-1
addi.l r8,1
jmp T,_L3
_L2:
;x2 = x
mov.l r8,fp
addi.l r8,4
mov.l r9,r8
ldr.l r8,r9
_L3:
...
So i you would like to ask you, which special pattern (machine
description pattern (*.md))
is related to "x2 = ((x > 0)? (x): -(x));" or where should i search the problem.