This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: i386.h fix for 4.0 branch (pr16888 fallout)
On Wed, May 11, 2005 at 05:34:39PM +0200, Michael Matz wrote:
> In 4.0 now. In retrospect I actually think that Alexandres change might
> not have been such a good idea after all. The problem is, that now you
> can't compile anymore programs which do the checking for MMX capability at
> runtime, i.e. something like:
> if (cpu_supports_mmx()) {
> asm do_stuff_with_mmx;
> } else {
> do_stuff_in_plain_c();
> }
>
> like is done in some media code. With Alexandres changes you have to
> specify -mmmx (or another option of that effect) now to even compile the
> above. The problem being that this activates TARGET_MMX (or _SSE{,2} for
> that matter), and hence activates that instruction set also generally,
> i.e. potentially on code paths not guarded by the above if written by the
> programmer. Hence you are now unable to compile such code which still
> runs (slower) on non-mmx/sse capable processors.
Without -msse etc. you can't use x/y constraints, so the only thing
you talk about here are __asm clobbers, right?
For those you can use
#ifdef __SSE__
"xmm0", "xmm6"
#endif
around SSE/SSE2 clobbers and
#ifdef __MMX__
"mm0", "mm5"
#endif
around MMX clobbers.
Without those options (and therefore defines), GCC doesn't know anything
about those registers, so there is no point telling GCC about them.
Jakub