[clang] 08388ad - [X86][AVX512FP16] Relax limitation to AVX512FP16 intrinsics. NFCI

Phoebe Wang via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 22 20:36:06 PDT 2022


Author: Phoebe Wang
Date: 2022-08-23T11:35:16+08:00
New Revision: 08388ad81e9d65116b0857b0ebc9bcf7f2be5e31

URL: https://github.com/llvm/llvm-project/commit/08388ad81e9d65116b0857b0ebc9bcf7f2be5e31
DIFF: https://github.com/llvm/llvm-project/commit/08388ad81e9d65116b0857b0ebc9bcf7f2be5e31.diff

LOG: [X86][AVX512FP16] Relax limitation to AVX512FP16 intrinsics. NFCI

Since we have enabled the support for `_Float16` on SSE2, we can relax
the limitation for AVX512FP16 now. This helps for user to use AVX512FP16
mixed with unsupported versions, e.g., multiversioning.

Also fix lit fails due to missing const modifier. Found during this change.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D132342

Added: 
    

Modified: 
    clang/lib/Headers/avx512fp16intrin.h
    clang/lib/Headers/avx512vlfp16intrin.h
    clang/lib/Headers/immintrin.h

Removed: 
    


################################################################################
diff  --git a/clang/lib/Headers/avx512fp16intrin.h b/clang/lib/Headers/avx512fp16intrin.h
index 2e4ca353ff692..7693857e92482 100644
--- a/clang/lib/Headers/avx512fp16intrin.h
+++ b/clang/lib/Headers/avx512fp16intrin.h
@@ -10,6 +10,8 @@
 #error "Never use <avx512fp16intrin.h> directly; include <immintrin.h> instead."
 #endif
 
+#ifdef __SSE2__
+
 #ifndef __AVX512FP16INTRIN_H
 #define __AVX512FP16INTRIN_H
 
@@ -3347,3 +3349,4 @@ _mm512_permutexvar_ph(__m512i __A, __m512h __B) {
 #undef __DEFAULT_FN_ATTRS512
 
 #endif
+#endif

diff  --git a/clang/lib/Headers/avx512vlfp16intrin.h b/clang/lib/Headers/avx512vlfp16intrin.h
index 3d27853ad9648..d4a7d1b1c53e0 100644
--- a/clang/lib/Headers/avx512vlfp16intrin.h
+++ b/clang/lib/Headers/avx512vlfp16intrin.h
@@ -11,6 +11,8 @@
     "Never use <avx512vlfp16intrin.h> directly; include <immintrin.h> instead."
 #endif
 
+#ifdef __SSE2__
+
 #ifndef __AVX512VLFP16INTRIN_H
 #define __AVX512VLFP16INTRIN_H
 
@@ -2066,3 +2068,4 @@ _mm_reduce_min_ph(__m128h __V) {
 #undef __DEFAULT_FN_ATTRS256
 
 #endif
+#endif

diff  --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h
index e4d7a799b1ca9..cca34783efaf4 100644
--- a/clang/lib/Headers/immintrin.h
+++ b/clang/lib/Headers/immintrin.h
@@ -214,17 +214,13 @@
 #include <avx512pfintrin.h>
 #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 <avx512fp16intrin.h>
 #endif
 
-#if defined(__AVX512FP16__) && defined(__AVX512VL__)
+#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) ||      \
+    (defined(__AVX512VL__) && defined(__AVX512FP16__))
 #include <avx512vlfp16intrin.h>
 #endif
 


        


More information about the cfe-commits mailing list