public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Code generation problem with optimizations enabled
@ 2009-05-12  8:09 Jamie Prescott
  2009-05-12  8:31 ` Jamie Prescott
  0 siblings, 1 reply; 7+ messages in thread
From: Jamie Prescott @ 2009-05-12  8:09 UTC (permalink / raw)
  To: gcc


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



      

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-05-14  1:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-12  8:09 Code generation problem with optimizations enabled Jamie Prescott
2009-05-12  8:31 ` Jamie Prescott
2009-05-12  9:28   ` Paolo Bonzini
2009-05-12 16:39     ` Jamie Prescott
2009-05-14  3:54       ` Jim Wilson
2009-05-14 11:14         ` Jamie Prescott
2009-05-12 17:54     ` Jamie Prescott

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).