Re: Difference between --target=i386 and i686

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 12, 2020 at 9:10 AM J.W. Jagersma <jwjagersma@xxxxxxxxx> wrote:
> i686-gcc -march=i386: cmov (!)

Did you check to see where the cmov instruction is coming from?  The
compiler won't generate it with -march=i386, but there may be a
precompiled library like libgcc or libstdc++ that contains the cmov
instruction because they were compiled for i686.  In order to get the
right effect with -march=i386, you would need to build multiple copies
of the libraries, one of them with -march=i386.  We call this
multilibs.  This is normally done with -m32/-m64 so a single compiler
can generate both 32-bit and 64-bit code, but it is not normally done
with i386 and i686.  You would have to change the default
configuration to build multilibs based on -march.

The same thing happens in reverse when you configure for i386 and use
-march=i686, the compiler generated code will be i686, but the
precompiled libraries will be i386 code.

> So it looks like gcc compiled with --target=i686-* is incapable of producing
> i386 code, and --target=i386-* is the most versatile option for backwards
> compatibility with older cpus. Are there any disadvantages (reduced
> optimization, etc) to using an i386-gcc with -march=i686 when compiling for
> "newer" systems?

Besides the performance loss, i386 doesn't have cmpxchg which means
atomic support will be a problem.  Otherwise, it will probably work.

Jim



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux