public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* target/6041: x86: No inline FPU code generated even if arch says target always has FPU
@ 2002-03-22 8:46 tevessen
0 siblings, 0 replies; 2+ messages in thread
From: tevessen @ 2002-03-22 8:46 UTC (permalink / raw)
To: gcc-gnats
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2302 bytes --]
>Number: 6041
>Category: target
>Synopsis: x86: No inline FPU code generated even if arch says target always has FPU
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: pessimizes-code
>Submitter-Id: net
>Arrival-Date: Fri Mar 22 08:46:02 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Johannes Tevessen
>Release: gcc version 3.0.3
>Organization:
>Environment:
Linux 2.4.17 #4 Mon Feb 18 12:29:18 CET 2002 i686 unknown
BFD: GNU assembler version 2.11.90.0.8 (i386-redhat-linux) using BFD version 2.11.90.0.8
>Description:
The info docs say:
"`-mno-fancy-math-387'
Some 387 emulators do not support the `sin', `cos' and `sqrt'
instructions for the 387. Specify this option to avoid generating
those instructions. This option is the default on FreeBSD. As of
revision 2.6.1, these instructions are not generated unless you
also use the `-ffast-math' switch."
Well, reading this made me curious and I wrote a
simple piece of code like this:
#include <math.h>
double sindbl (double inp) {
return sin (inp);
}
gives (-march=athlon -O9):
sindbl:
pushl %ebp
movl %esp, %ebp
subl $8, %esp
leave
jmp sin
so there's actually a subfunction call to sin() generated
for something that i586/i686/athlon/k6 can easily
do with inline asm.
-ffast-math changes this:
sindbl:
pushl %ebp
movl %esp, %ebp
fldl 8(%ebp)
#APP
fsin
#NO_APP
popl %ebp
ret
The point being that i586 upto athlon always
include an FPU, so there's no need to look for
FPU software emulator support unless explicitly
wanted by the user.
Also, -ffast-math turns on some more optimizations
that may be unwanted.
And: Maybe another bug: Just adding
-mfancy-math-387 does _not_ produce inline asm
as I had expected. It _also_ calls sin() in 3.0.3,
so the docs are wrong here, too.
>How-To-Repeat:
Create any C file, #include <math.h>, use something
like sin(), compile with optimization and -march=i686
(or similar) and inspect object file or gcc -S output.
>Fix:
Make inline FPU asm instructions the default for -march
i586, i686, k6, athlon.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: target/6041: x86: No inline FPU code generated even if arch says target always has FPU
@ 2002-03-29 15:31 rth
0 siblings, 0 replies; 2+ messages in thread
From: rth @ 2002-03-29 15:31 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, rth, tevessen
Synopsis: x86: No inline FPU code generated even if arch says target always has FPU
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Fri Mar 29 15:31:39 2002
Responsible-Changed-Why:
.
State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Fri Mar 29 15:31:39 2002
State-Changed-Why:
http://gcc.gnu.org/ml/gcc-patches/2002-03/msg02001.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6041
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-03-29 23:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-22 8:46 target/6041: x86: No inline FPU code generated even if arch says target always has FPU tevessen
2002-03-29 15:31 rth
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).