GCC question i386-redhat-linux i686-pc-linux-gnu, what's the difference?

GCC question i386-redhat-linux i686-pc-linux-gnu, what's the difference?

Post by Rob Ha » Thu, 10 Jan 2002 09:33:33



This is a newbie question regarding the installation of the gcc
compiler.  The gcc comiplier installed from our Linux distro was
i386-redhat-linux.  I want to upgrade this version of gcc to the
latest release of gcc 2.95.3.  When I don't specify a target during
the configuration of gcc, the target defaults to i686-pc-linux-gnu.
Is it better to use this default value for the new version of the
compiler?  As far as I can tell, there's not a lot of difference
between the two compilers.  The same symbols appear to be defined, and
the code appears to run fine.

  Is there an advantage to specifying the target as an
i386-redhat-linux compiler?

 
 
 

GCC question i386-redhat-linux i686-pc-linux-gnu, what's the difference?

Post by Steven Rosted » Thu, 10 Jan 2002 22:18:10



> This is a newbie question regarding the installation of the gcc
> compiler.  The gcc comiplier installed from our Linux distro was
> i386-redhat-linux.  I want to upgrade this version of gcc to the
> latest release of gcc 2.95.3.  When I don't specify a target during
> the configuration of gcc, the target defaults to i686-pc-linux-gnu.
> Is it better to use this default value for the new version of the
> compiler?  As far as I can tell, there's not a lot of difference
> between the two compilers.  The same symbols appear to be defined, and
> the code appears to run fine.

>   Is there an advantage to specifying the target as an
> i386-redhat-linux compiler?

The i686-pc-linux-gnu will implement the added opcodes of the
intel 686 processor. If configure picked i686, you are better
off using it unless you plan to compile code to run on an
old i386 processor.

-- Steve.

 
 
 

GCC question i386-redhat-linux i686-pc-linux-gnu, what's the difference?

Post by Michael Meissne » Sat, 19 Jan 2002 16:31:54




> > This is a newbie question regarding the installation of the gcc
> > compiler.  The gcc comiplier installed from our Linux distro was
> > i386-redhat-linux.  I want to upgrade this version of gcc to the
> > latest release of gcc 2.95.3.  When I don't specify a target during
> > the configuration of gcc, the target defaults to i686-pc-linux-gnu.
> > Is it better to use this default value for the new version of the
> > compiler?  As far as I can tell, there's not a lot of difference
> > between the two compilers.  The same symbols appear to be defined, and
> > the code appears to run fine.

> >   Is there an advantage to specifying the target as an
> > i386-redhat-linux compiler?

> The i686-pc-linux-gnu will implement the added opcodes of the
> intel 686 processor. If configure picked i686, you are better
> off using it unless you plan to compile code to run on an
> old i386 processor.

Not quite true.  If you configure the compiler for i686-pc-linux-gnu, it will
default the -mcpu=<x> option to i686 (aka pentium-ii or pentium-pro), which
tries to optimize for running on a i686 processor, but can actually run on any
x86 processor.  If you configure the compiler for i386-pc-linux-gnu, it will
default to -mcpu=i386.  For example it knows a multiply is 4 cycles on an i686,
while on a 386, it is 6 cycles to start plus 1 cycle for every 1 bit in the
number, and that on a 386 it is faster to do a push from memory directly, while
in higher processors, it is faster to load the value into a register and then
do a push.

To select using i686 specific instructions, you use the -march=i686 option
which says to use any i686 specific instruction.  The main architecture
specific instructions GCC currently supports is condition move instructions,
which were added in the i686 family.  At least older AMD atholons, i486's, and
i386's did not support these instructions, which would mean your program would
trap if run on one of those.

--
Michael Meissner, Red Hat, Inc.  (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA