sync_add_and_fetch problem
Michael Meissner
meissner@linux.vnet.ibm.com
Thu Dec 4 20:44:00 GMT 2008
On Thu, Dec 04, 2008 at 02:38:08PM -0500, Charles Crisler wrote:
> OK, I have gotten it worked out now. Thank you for all of the help.
>
> How can someone check what the default architecture setting is for their
> gcc? This seems to fit the evidence but I would really like to verify
> it.
Gcc defines different macros, based on what the -march=xxxx option is:
The trouble is the processor varients are exclusive (i.e. if you say
-march=i586, it defines __i586__ and not __i486__). This means you might need
to add a bunch of #if's to capture all of the names. At this writing, the
names defined are (I'm eliminating multiple names defined for the same target):
__i486__
__i586__
__i686__
__geode__
__k6__
__athlon__
__k8__
__amdfam10__
__pentium4__
__nocona__
__core2__
The problem is if somebody in GCC 4.5 adds a new processor name.
If you can live with a more modern system as the base, you could use the
feature test macros (testing for __SSE__ for instance if your minimum target is
-march=pentium3).
Note, the one-laptop-per-child project is shipping a processor that does not
support the SSE instruction set, so by doing so, you might restrict where your
programs can run.
If you only anticipate running your program on your current machine and use a
recent compiler, you can use -march=native, and the compiler will figure out
what machine you are using and use all of the instructions that the machine
provides.
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com
More information about the Gcc-help
mailing list