[RFA] Using the new atomicity builtins

Benjamin Kosnik bkoz@redhat.com
Thu May 26 07:02:00 GMT 2005


> >An annoyance is with the i*86 targets: the target bits are implemented
> >only for i486 and later (for the "obvious" reasons) but, by default, g++
> >generates code runnable also on i386. Therefore we have to somehow
> >detect whether -march=i486 was passed and switch from the fall back
> >(whichever it is) to the actual builtin, basing on that. That's why my
> >first block of work doesn't include i686, which actually is also done,
> >in the compiler. Ideas about the best way to do this? Also, in case of
> >x86_64 in real 64-bit mode (vs 32-bit mode) this is not a problem, of
> >course, but we have to check for that. Annoying. Ideas about the best
> >way to deal with such issues? Is __i486__ or similar going to work?

Oh, I remember this now. 

> Steven Bosscher suggested privately that maybe a builtin define is the
> best solution. It looks like could boil down to something as simple as
> (in gcc/config/i386/i386.h):
> 
>   if (!TARGET_386)
>     builtin_define ("__x86_atomic__");
> 
> that would encompass everything i?86 and x86_64 related.

This might be the way to go.

A quick question: isn't configure.host's cpu_include_dir already set to
the appropriate target based on things like -march=i486? If so,
couldn't you just re-use this solution for the i386/i486+ issue?

Or, are you talking about putting these atomic operations back into
headers, and not .cc/.o files?

Maybe I'm just confused...

-benjamin



More information about the Libstdc++ mailing list