public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "olivier_maury at mentor dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/49257] New: -mfpmath=sse generates x87 instructions on 32 bits OS Date: Wed, 01 Jun 2011 13:57:00 -0000 [thread overview] Message-ID: <bug-49257-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49257 Summary: -mfpmath=sse generates x87 instructions on 32 bits OS Product: gcc Version: 4.5.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned@gcc.gnu.org ReportedBy: olivier_maury@mentor.com Created attachment 24408 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24408 simple reproducer Hi, Please find attached a simple C program that shows the issue. I compile it that way: gcc -O0 simple.c -mfpmath=sse -msse3 -o ok.exe ./ok.exe returns the correct value gcc -O0 simple.c -mfpmath=sse -msse3 -DRETURN_NAN -o nan.exe ./nan.exe returns a NAN Both exe use some gcc intrinsic that change the FP stack into mmx registers. It is expected that if I call a libc function (like printf) without restoring the stack to its original state (using emms) then I'll have a wrong behavior. But, here, because of the following assembly code: .L4: fildq 72(%esp) cmpl $0, 76(%esp) jns .L3 fldt .LC2 faddp %st, %st(1) .L3: fstpl 24(%esp) movsd 24(%esp), %xmm0 mulsd 56(%esp), %xmm0 movsd %xmm0, 40(%esp) movl 68(%esp), %eax movl 4(%eax), %edx movl (%eax), %eax movl 52(%esp), %ecx movl %eax, 16(%esp) movl %edx, 20(%esp) movq 16(%esp), %mm0 movntq %mm0, (%ecx) addl $1, 72(%esp) adcl $0, 76(%esp) .L2: cmpl $0, 76(%esp) jb .L4 cmpl $0, 76(%esp) ja .L6 cmpl $9, 72(%esp) jbe .L4 I've got a NAN why I shouldn't !? The instruction that generates that x87 code is the line (double)i * coeff; where i is an unsigned long long and coeff is a double. It works well if for instance 'i' is a long/int/unsigned int. Maybe that behavior is expected ? BR Olivier
next reply other threads:[~2011-06-01 13:57 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2011-06-01 13:57 olivier_maury at mentor dot com [this message] 2011-06-01 14:25 ` [Bug target/49257] " rguenth at gcc dot gnu.org 2011-06-01 17:58 ` ubizjak at gmail dot com 2011-06-01 18:28 ` ubizjak at gmail dot com 2011-06-01 20:53 ` ubizjak at gmail dot com 2011-06-01 20:55 ` ubizjak at gmail dot com 2011-06-06 8:44 ` rguenth at gcc dot gnu.org 2011-06-06 15:49 ` rth at gcc dot gnu.org 2011-06-06 18:34 ` ubizjak at gmail dot com 2011-06-06 19:02 ` rth at gcc dot gnu.org 2011-06-06 21:08 ` ubizjak at gmail dot com 2011-06-07 8:39 ` ubizjak at gmail dot com 2011-06-07 13:18 ` ubizjak at gmail dot com 2011-06-07 18:41 ` rth at gcc dot gnu.org 2011-06-07 23:13 ` rth at gcc dot gnu.org 2011-06-08 6:14 ` jakub at gcc dot gnu.org 2011-06-08 10:32 ` ubizjak at gmail dot com 2011-06-09 15:41 ` rth at gcc dot gnu.org 2012-01-20 11:31 ` ubizjak at gmail dot com
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=bug-49257-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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: linkBe 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).