diff --git a/clang/lib/Headers/ammintrin.h b/clang/lib/Headers/ammintrin.h index 3806be6ebc437..1af2096595cac 100644 --- a/clang/lib/Headers/ammintrin.h +++ b/clang/lib/Headers/ammintrin.h @@ -10,6 +10,10 @@ #ifndef __AMMINTRIN_H #define __AMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include /* Define the default attributes for the functions in this file. */ diff --git a/clang/lib/Headers/emmintrin.h b/clang/lib/Headers/emmintrin.h index b79a4f17f9c7f..6e9c3032c21f7 100644 --- a/clang/lib/Headers/emmintrin.h +++ b/clang/lib/Headers/emmintrin.h @@ -10,6 +10,10 @@ #ifndef __EMMINTRIN_H #define __EMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include typedef double __m128d __attribute__((__vector_size__(16), __aligned__(16))); diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h index 8a75895c6c5f1..2b9ef61d27d2c 100644 --- a/clang/lib/Headers/immintrin.h +++ b/clang/lib/Headers/immintrin.h @@ -10,6 +10,10 @@ #ifndef __IMMINTRIN_H #define __IMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include #if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ diff --git a/clang/lib/Headers/mmintrin.h b/clang/lib/Headers/mmintrin.h index 79a8b55016b19..03bac92198ad8 100644 --- a/clang/lib/Headers/mmintrin.h +++ b/clang/lib/Headers/mmintrin.h @@ -10,6 +10,10 @@ #ifndef __MMINTRIN_H #define __MMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8))); typedef long long __v1di __attribute__((__vector_size__(8))); diff --git a/clang/lib/Headers/nmmintrin.h b/clang/lib/Headers/nmmintrin.h index 672aea4966817..59fc7ec99e614 100644 --- a/clang/lib/Headers/nmmintrin.h +++ b/clang/lib/Headers/nmmintrin.h @@ -10,6 +10,10 @@ #ifndef __NMMINTRIN_H #define __NMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + /* To match expectations of gcc we put the sse4.2 definitions into smmintrin.h, just include it now then. */ #include diff --git a/clang/lib/Headers/pmmintrin.h b/clang/lib/Headers/pmmintrin.h index a83b2eb6d8e26..eda83567cd058 100644 --- a/clang/lib/Headers/pmmintrin.h +++ b/clang/lib/Headers/pmmintrin.h @@ -10,6 +10,10 @@ #ifndef __PMMINTRIN_H #define __PMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include /* Define the default attributes for the functions in this file. */ diff --git a/clang/lib/Headers/smmintrin.h b/clang/lib/Headers/smmintrin.h index 5028fd5ea5955..710e55aaa1203 100644 --- a/clang/lib/Headers/smmintrin.h +++ b/clang/lib/Headers/smmintrin.h @@ -10,6 +10,10 @@ #ifndef __SMMINTRIN_H #define __SMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include /* Define the default attributes for the functions in this file. */ diff --git a/clang/lib/Headers/tmmintrin.h b/clang/lib/Headers/tmmintrin.h index dbd959d0a62cb..bcffa8187801c 100644 --- a/clang/lib/Headers/tmmintrin.h +++ b/clang/lib/Headers/tmmintrin.h @@ -10,6 +10,10 @@ #ifndef __TMMINTRIN_H #define __TMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include /* Define the default attributes for the functions in this file. */ diff --git a/clang/lib/Headers/wmmintrin.h b/clang/lib/Headers/wmmintrin.h index f932ca81089ca..49148dbf3ac61 100644 --- a/clang/lib/Headers/wmmintrin.h +++ b/clang/lib/Headers/wmmintrin.h @@ -10,6 +10,10 @@ #ifndef __WMMINTRIN_H #define __WMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include #include <__wmmintrin_aes.h> diff --git a/clang/lib/Headers/xmmintrin.h b/clang/lib/Headers/xmmintrin.h index 620453c97783c..1612d3d2773d5 100644 --- a/clang/lib/Headers/xmmintrin.h +++ b/clang/lib/Headers/xmmintrin.h @@ -10,6 +10,10 @@ #ifndef __XMMINTRIN_H #define __XMMINTRIN_H +#if !defined(__i386__) && !defined(__x86_64__) +#error "This header is only meant to be used on x86 and x64 architecture" +#endif + #include typedef int __v4si __attribute__((__vector_size__(16))); diff --git a/clang/test/Headers/xmmintrin-unsupported.c b/clang/test/Headers/xmmintrin-unsupported.c new file mode 100644 index 0000000000000..1991a132f451c --- /dev/null +++ b/clang/test/Headers/xmmintrin-unsupported.c @@ -0,0 +1,5 @@ +// RUN: not %clang_cc1 %s -triple aarch64-eabi -fsyntax-only 2>&1 | FileCheck %s +// +// REQUIRES: x86-registered-target +// CHECK: This header is only meant to be used on x86 and x64 architecture +#include