Hi!
I have this little code that drives me crazy about the code generation (GCC
4.3.3).
extern double tle_mk_inf(int);
double tle_exp(double dval)
{
if (dval == 0.0)
return 0.0;
if (dval > 10000)
return tle_mk_inf(1);
return -1.2;
}
If I compiled it with -O2 or -O3, the insn output is missing an 'fcmp'
('cmpdf'), like you can see below:
$LC0:
long 0
long 0
$LC1:
long 0
long 1086556160
$LC2:
long 858993459
long -1074580685
_tle_exp:
push FP
mov SP,FP
push r8
fpush x8
lea $LC0,r8
ldr.f r8,x8
fcmp x0,x8
jz $L4
lea $LC1,r8
ldr.f r8,x8
<<<<<< MISSING 'fcmp x0,x8'
ja $L5
lea $LC2,r8
ldr.f r8,x8
$L4:
fdmov x8,x0
fpop x8
pop r8
mov FP,SP
pop FP
ret
$L5:
mov 1,r0
call _tle_mk_inf
fpop x8
pop r8
mov FP,SP
pop FP
ret
If I disable the optimizations, everything is fine and the 'fcmp' is there.
Even with optimizations enabled, the RTL dump shows the missing 'cmpdf' present
and correctly recognized. It being:
(define_insn "cmpdf"
[(set (cc0)
(compare (match_operand:DF 0 "fullreg_operand" "x")
(match_operand:DF 1 "fullreg_operand" "x")))]
""
"fcmp\t%0,%1"
[
(set_attr "length" "3")
(set_attr "cc" "compare")
]
)
Any hints?
- Jamie