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]

[PATCH] Fix x86intrin.h with -Wsystem-headers


Hi!

Both fma4intrin.h and avxintrin.h define the same 4 types, which is an error
except for system headers.
My understanding is that -mfma4 implies -mavx and -mfma4 -mno-avx is the
same as -mno-fma4, plus fma4intrin.h can be only included from x86intrin.h.
Thus, in all cases when fma4intrin.h is included, avxintrin.h is also
included and defines the types too.
This patch makes sure that fma4intrin.h comes after avxintrin.h and uses
the avxintrin.h definitions instead of providing its own ones. 

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2009-11-06  Jakub Jelinek  <jakub@redhat.com>

	* config/i386/x86intrin.h: Include fma4intrin.h, xopintrin.h and
	lwpintrin.h after immintrin.h.
	* config/i386/fma4intrin.h (__v8sf, __v4df, __m256, __m256d): Remove
	typedefs.

--- gcc/config/i386/fma4intrin.h.jj	2009-09-30 09:53:04.000000000 +0200
+++ gcc/config/i386/fma4intrin.h	2009-11-05 21:28:29.000000000 +0100
@@ -35,15 +35,6 @@
 /* We need definitions from the SSE4A, SSE3, SSE2 and SSE header files.  */
 #include <ammintrin.h>
 
-/* Internal data types for implementing the intrinsics.  */
-typedef float __v8sf __attribute__ ((__vector_size__ (32)));
-typedef double __v4df __attribute__ ((__vector_size__ (32)));
-
-typedef float __m256 __attribute__ ((__vector_size__ (32),
-				     __may_alias__));
-typedef double __m256d __attribute__ ((__vector_size__ (32),
-				       __may_alias__));
-
 /* 128b Floating point multiply/add type instructions.  */
 extern __inline __m128 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_macc_ps (__m128 __A, __m128 __B, __m128 __C)
--- gcc/config/i386/x86intrin.h.jj	2009-11-05 10:11:59.000000000 +0100
+++ gcc/config/i386/x86intrin.h	2009-11-05 21:27:55.000000000 +0100
@@ -54,6 +54,17 @@
 #include <smmintrin.h>
 #endif
 
+#if defined (__AES__) || defined (__PCLMUL__)
+#include <wmmintrin.h>
+#endif
+
+/* For including AVX instructions */
+#include <immintrin.h>
+
+#ifdef __3dNOW__
+#include <mm3dnow.h>
+#endif
+
 #ifdef __FMA4__
 #include <fma4intrin.h>
 #endif
@@ -66,15 +77,4 @@
 #include <lwpintrin.h>
 #endif
 
-#if defined (__AES__) || defined (__PCLMUL__)
-#include <wmmintrin.h>
-#endif
-
-/* For including AVX instructions */
-#include <immintrin.h>
-
-#ifdef __3dNOW__
-#include <mm3dnow.h>
-#endif
-
 #endif /* _X86INTRIN_H_INCLUDED */

	Jakub


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