This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
GCC 3.3.5: -march=i586 does not use all pentium FPU instructions
- From: Peter Soetens <peter dot soetens at mech dot kuleuven dot ac dot be>
- To: gcc at gcc dot gnu dot org
- Date: Fri, 11 Feb 2005 14:01:28 +0100
- Subject: GCC 3.3.5: -march=i586 does not use all pentium FPU instructions
- Organization: KU Leuven
- Reply-to: peter dot soetens at mech dot kuleuven dot ac dot be
I was wondering why the above gcc parameter does not enable the use of the
fst/fld opcodes for pentium processors, while -march=i686 does. The Intel
manuals specifically say that they can be used across all pentium processors.
Example :
$ gcc -g -c -mcpu=i586 mdouble.cpp -o mdouble.o
$ objdump -dS -M intel mdouble.o
<...>
void foo()
{
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: 83 ec 10 sub esp,0x10
double d;
double a;
d = 3.0;
6: b8 00 00 00 00 mov eax,0x0
b: ba 00 00 08 40 mov edx,0x40080000
10: 89 45 f8 mov DWORD PTR [ebp-8],eax
13: 89 55 fc mov DWORD PTR [ebp-4],edx
a = d;
16: 8b 45 f8 mov eax,DWORD PTR [ebp-8]
19: 8b 55 fc mov edx,DWORD PTR [ebp-4]
1c: 89 45 f0 mov DWORD PTR [ebp-16],eax
1f: 89 55 f4 mov DWORD PTR [ebp-12],edx
}
22: c9 leave
23: c3 ret
While :
$ gcc -g -c -mcpu=i686 mdouble.cpp -o mdouble.o
$ objdump -dS -M intel mdouble.o
<...>
void foo()
{
0: 55 push ebp
1: 89 e5 mov ebp,esp
3: 83 ec 10 sub esp,0x10
double d;
double a;
d = 3.0;
6: dd 05 00 00 00 00 fld ds:0x0
c: dd 5d f8 fstp QWORD PTR [ebp-8]
a = d;
f: dd 45 f8 fld QWORD PTR [ebp-8]
12: dd 5d f0 fstp QWORD PTR [ebp-16]
}
15: c9 leave
16: c3 ret
FLD and FSTP are available on all pentium processors.
Is there a chance, for other reasons, that my code will not run on a pentium
if I use -march=i686 ?
Thanks for any help on this,
Peter
--
------------------------------------------------------------------------
Peter Soetens, Research Assistant http://www.orocos.org
Katholieke Universiteit Leuven
Division Production Engineering, tel. +32 16 322773
Machine Design and Automation fax. +32 16 322987
Celestijnenlaan 300B peter.soetens@mech.kuleuven.ac.be
B-3001 Leuven Belgium http://www.mech.kuleuven.ac.be/pma
------------------------------------------------------------------------