public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jamie Prescott <jpresss@yahoo.com>
To: gcc@gcc.gnu.org
Subject: Code generation problem with optimizations enabled
Date: Tue, 12 May 2009 08:09:00 -0000	[thread overview]
Message-ID: <63944.98804.qm@web111619.mail.gq1.yahoo.com> (raw)


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



      

             reply	other threads:[~2009-05-12  6:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-12  8:09 Jamie Prescott [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=63944.98804.qm@web111619.mail.gq1.yahoo.com \
    --to=jpresss@yahoo.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).