On Thu, Jul 19, 2012 at 11:51 AM, Jakub Jelinek <ja...@redhat.com> wrote:
> I think it is fine to change existing mm3dnow.h header, but not in the way > it has been changed in the patch. The thing is that unlike the newly added > intrinsics headers, mm3dnow.h is still publicly includable header, and just > including that header should work properly, so mm3dnow.h has to include > prftchwintrin.h, which should be allowed to be included from x86intrin.h > as well as mm3dnow.h, and that header should have guards, so that if both > x86intrin.h is included and mm3dnow.h too (the latter first), > prftchwintrin.h isn't included in twice. Probably something like attached patch, with following changes to the original patch: +#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED +# error "Never use <adxintrin.h> directly; include <x86intrin.h> instead." +#endif No need to check for _IMMINTRIN_H_INCLUDED (in all new headers). In config/i386/prfchwintrin.h, change this part to: +#if !defined _X86INTRIN_H_INCLUDED && !defined _MM3DNOW_H_INCLUDED +# error "Never use <prfchwintrin.h> directly; include <x86intrin.h> or <mm3dnow.h> instead." +#endif Uros.
Index: mm3dnow.h =================================================================== --- mm3dnow.h (revision 189643) +++ mm3dnow.h (working copy) @@ -30,6 +30,7 @@ #ifdef __3dNOW__ #include <mmintrin.h> +#include <prfchwintrin.h> extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _m_femms (void) @@ -157,12 +158,6 @@ __builtin_prefetch (__P, 0, 3 /* _MM_HINT_T0 */); } -extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_m_prefetchw (void *__P) -{ - __builtin_prefetch (__P, 1, 3 /* _MM_HINT_T0 */); -} - extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__)) _m_from_float (float __A) { Index: x86intrin.h =================================================================== --- x86intrin.h (revision 189643) +++ x86intrin.h (working copy) @@ -97,4 +97,8 @@ #include <popcntintrin.h> #endif +#ifdef __PRFCHW__ +#include <prfchwintrin.h> +#endif + #endif /* _X86INTRIN_H_INCLUDED */