Hi Samuel, 

On Friday 11 February 2005 16:38, you wrote:
> I think Intel's confusing numbering system has confused
> you.  All ix86 processors, if the expression
> x in first ix86 < x in second ix86
> holds true, then second ix86 is compatible.  The i586 is
> NOT the Pentium.  Nor is the i686.  But the i686 was one of
> the first Intel processors with built-in FPU.  If you are
> asking for Pentium, try the following switches:
> -march=pentium
> -march=pentium -mmmx # Pentium MMX
> -march=pentium2
> -march=pentium3
> -march=celron
> -march=pentium4
> -march=prescott # this will probably get you in trouble
>
> If you use any of these switches, it will add FP
> instruction calls.  -march=prescott has caused more than
> one problem elsewhere.

This is what the GCC manual says, I added the '***'s
<quote>
-mcpu=cpu-type
    Tune to cpu-type everything applicable about the generated code, except 
for the ABI and the set of available instructions. The choices for cpu-type 
are i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, 
pentium3, pentium4, prescott, nocona, k6, k6-2, k6-3, athlon, athlon-tbird, 
athlon-4, athlon-xp, athlon-mp, winchip-c6, winchip2 and c3.

    While picking a specific cpu-type will schedule things appropriately for 
that particular chip, the compiler will not generate any code that does not 
run on the i386 without the -march=cpu-type option being used. ***i586 is 
equivalent to pentium and i686 is equivalent to pentiumpro***. k6 and athlon 
are the AMD chips as opposed to the Intel ones.

-march=cpu-type
    Generate instructions for the machine type cpu-type. The choices for 
cpu-type are the same as for -mcpu. Moreover, specifying -march=cpu-type 
implies -mcpu=cpu-type.
</quote>

My experiments with setting options confirms the ***'d part, wrt the FPU 
opcodes being used : i586, pentium and pentium-mmx generate the same (non 
fpu-using) code, while i686 and pentiumpro generate the fpu-using code.

Any other hints ?

Peter

PS : please CC me since I'm not on the list. Thank you.
>
> Samuel Lauber
>
> > 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 ?

-- 
------------------------------------------------------------------------
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                   [EMAIL PROTECTED]
B-3001 Leuven Belgium                 http://www.mech.kuleuven.ac.be/pma
------------------------------------------------------------------------

Reply via email to