From 6f35f3cd8071e37ccf5e9c6d93d636e9eca29e45 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Fri, 20 Aug 2010 23:00:03 +0000 Subject: [PATCH] Disallow direct inclusion of avxintrin.h. Users should include immintrin.h instead. This matches GCC's behavior. llvm-svn: 111692 --- clang/lib/Headers/avxintrin.h | 13 ++------- clang/test/Headers/x86-intrinsics-headers.c | 31 +++++---------------- 2 files changed, 10 insertions(+), 34 deletions(-) diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h index 160f4c1e2bc9..884d31cb8917 100644 --- a/clang/lib/Headers/avxintrin.h +++ b/clang/lib/Headers/avxintrin.h @@ -21,12 +21,9 @@ *===-----------------------------------------------------------------------=== */ -#ifndef __AVXINTRIN_H -#define __AVXINTRIN_H - -#ifndef __AVX__ -#error "AVX instruction set not enabled" -#else +#ifndef __IMMINTRIN_H +#error "Never use directly; include instead." +#endif typedef double __v4df __attribute__ ((__vector_size__ (32))); typedef float __v8sf __attribute__ ((__vector_size__ (32))); @@ -1157,7 +1154,3 @@ _mm256_castsi128_si256(__m128i in) __m128i zero = _mm_setzero_si128(); return __builtin_shufflevector(in, zero, 0, 1, 2, 2); } - -#endif /* __AVX__ */ - -#endif /* __AVXINTRIN_H */ diff --git a/clang/test/Headers/x86-intrinsics-headers.c b/clang/test/Headers/x86-intrinsics-headers.c index b3beab1c51ae..ba833ec03893 100644 --- a/clang/test/Headers/x86-intrinsics-headers.c +++ b/clang/test/Headers/x86-intrinsics-headers.c @@ -4,33 +4,16 @@ #if defined(i386) || defined(__x86_64__) -# if defined(__MMX__) -#include +#ifdef __MMX__ #include -# endif +#endif -# if defined(__SSE__) -#include -# endif - -# if defined(__SSE3__) -#include -# endif - -# if defined(__SSSE3__) -#include -# endif - -# if defined(__SSE4_1__) -#include -# endif - -# if defined(__SSE4_2__) +#ifdef __SSE4_2__ +// nmmintrin forwards to smmintrin. #include -# endif +#endif -# if defined(__AVX__) -#include -# endif +// immintrin includes all other intel intrinsic headers. +#include #endif