diff --git a/clang/lib/Headers/avx512fp16intrin.h b/clang/lib/Headers/avx512fp16intrin.h --- a/clang/lib/Headers/avx512fp16intrin.h +++ b/clang/lib/Headers/avx512fp16intrin.h @@ -10,6 +10,8 @@ #error "Never use directly; include instead." #endif +#ifdef __SSE2__ + #ifndef __AVX512FP16INTRIN_H #define __AVX512FP16INTRIN_H @@ -3347,3 +3349,4 @@ #undef __DEFAULT_FN_ATTRS512 #endif +#endif diff --git a/clang/lib/Headers/avx512vlfp16intrin.h b/clang/lib/Headers/avx512vlfp16intrin.h --- a/clang/lib/Headers/avx512vlfp16intrin.h +++ b/clang/lib/Headers/avx512vlfp16intrin.h @@ -11,6 +11,8 @@ "Never use directly; include instead." #endif +#ifdef __SSE2__ + #ifndef __AVX512VLFP16INTRIN_H #define __AVX512VLFP16INTRIN_H @@ -2066,3 +2068,4 @@ #undef __DEFAULT_FN_ATTRS256 #endif +#endif diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h --- a/clang/lib/Headers/immintrin.h +++ b/clang/lib/Headers/immintrin.h @@ -214,17 +214,13 @@ #include #endif -/* - * FIXME: _Float16 type is legal only when HW support float16 operation. - * We use __AVX512FP16__ to identify if float16 is supported or not, so - * when float16 is not supported, the related header is not included. - * - */ -#if defined(__AVX512FP16__) +#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ + defined(__AVX512FP16__) #include #endif -#if defined(__AVX512FP16__) && defined(__AVX512VL__) +#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \ + (defined(__AVX512VL__) && defined(__AVX512FP16__)) #include #endif