Index: lib/Headers/immintrin.h =================================================================== --- lib/Headers/immintrin.h +++ lib/Headers/immintrin.h @@ -24,22 +24,41 @@ #ifndef __IMMINTRIN_H #define __IMMINTRIN_H +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__MMX__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE2__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE3__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSSE3__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__SSE4_2__) || defined(__SSE4_1__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AES__) || defined(__PCLMUL__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX2__) #include /* The 256-bit versions of functions in f16cintrin.h. @@ -54,45 +73,90 @@ { return (__m256)__builtin_ia32_vcvtph2ps256((__v8hi)__a); } +#endif /* __AVX2__ */ +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512F__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VL__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512BW__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512CD__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512DQ__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512BW__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512CD__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512DQ__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512ER__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512IFMA__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AVX512IFMA__) && defined(__AVX512VL__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512VBMI__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || \ + (defined(__AVX512VBMI__) && defined(__AVX512VL__)) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__AVX512PF__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PKU__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDRND__) static __inline__ int __attribute__((__always_inline__, __nodebug__, __target__("rdrnd"))) _rdrand16_step(unsigned short *__p) { @@ -112,7 +176,9 @@ return __builtin_ia32_rdrand64_step(__p); } #endif +#endif /* __RDRND__ */ +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FSGSBASE__) #ifdef __x86_64__ static __inline__ unsigned int __attribute__((__always_inline__, __nodebug__, __target__("fsgsbase"))) _readfsbase_u32(void) @@ -162,22 +228,36 @@ return __builtin_ia32_wrgsbase64(__V); } #endif +#endif /* __FSGSBASE__ */ +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RTM__) #include - #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SHA__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FXSR__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVE__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEOPT__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVEC__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XSAVES__) #include +#endif /* Some intrinsics inside adxintrin.h are available only on processors with ADX, * whereas others are also available at all times. */ Index: lib/Headers/x86intrin.h =================================================================== --- lib/Headers/x86intrin.h +++ lib/Headers/x86intrin.h @@ -28,29 +28,53 @@ #include +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__3dNOW__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__BMI2__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__LZCNT__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__POPCNT__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__RDSEED__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__PRFCHW__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__SSE4A__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__FMA4__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__XOP__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__TBM__) #include +#endif +#if !defined(_MSC_VER) || __has_feature(modules) || defined(__F16C__) #include +#endif /* FIXME: LWP */ Index: test/CodeGen/ms-mm-align.c =================================================================== --- test/CodeGen/ms-mm-align.c +++ test/CodeGen/ms-mm-align.c @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 \ +// RUN: %clang_cc1 -ffreestanding -fms-extensions -fms-compatibility -fms-compatibility-version=17.00 -target-feature +sse \ // RUN: -triple i686--windows -emit-llvm %s -o - \ // RUN: | FileCheck %s -check-prefix CHECK