This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, i386] automatic MMX/x87 FPU mode switching (the real one)


On Tue, Jun 21, 2005 at 12:43:31PM +0200, Uros Bizjak wrote:
> A IMHO nice feature of this patch is, that manually inserted emms (via
> _mm_empty() intrinsic) is also handled with LCM approach. If there is no need
> for emms in this place, it is not emitted. And this patch also handles (stupid)
> code like:
> 
> #include <mmintrin.h>
> 
> __v8qi
> aaa (__v8qi x, __v8qi y)
> {
>   __v8qi mm1;
> 
>   mm1 = _mm_add_pi8 (x, y);
>   _mm_empty ();
>   return mm1;
> }
> 
> to produce correct asm code:
> 
> aaa:
>         subl $12, %esp
>         paddb %mm1, %mm0
>         movq %mm0, (%esp)
>         emms
>         movq (%esp), %mm0
>         addl $12, %esp
>         ret

This result contradicts your previous statement that manually insertted
emms are not emitted.  Which might be cool, but is not 100% required for
this patch; just that we get correct code with them.

> For __builtin_apply ()problems, I suggest that called function (for i386)
> should NOT use MMX registers, and that it is always called in FPU_MODE_387.

I agree.  You planning on working on this I assume?

I suppose the workaround patch you posted is good enough in the 
meantime.  Or we could temporarily xfail the test.

[ Grr... forgot to change the mime type of the patch for inclusion 
  in the reply mail.  Review coming separately.  ]


r~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]