[clang] 3fb40ce - [X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless avx512fintrin.h has been included.
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 28 11:29:09 PDT 2021
Author: Craig Topper
Date: 2021-03-28T11:26:30-07:00
New Revision: 3fb40ce167ff5f05afadf8f525ff9e17350d6d7f
URL: https://github.com/llvm/llvm-project/commit/3fb40ce167ff5f05afadf8f525ff9e17350d6d7f
DIFF: https://github.com/llvm/llvm-project/commit/3fb40ce167ff5f05afadf8f525ff9e17350d6d7f.diff
LOG: [X86] Don't define vpclmulqdq or vaes intrinsics in the headers unless avx512fintrin.h has been included.
The intrinsics won't compile unless avx512fintrin.h has declared
the 512 bit types.
Added:
Modified:
clang/lib/Headers/immintrin.h
clang/lib/Headers/vaesintrin.h
clang/lib/Headers/vpclmulqdqintrin.h
Removed:
################################################################################
diff --git a/clang/lib/Headers/immintrin.h b/clang/lib/Headers/immintrin.h
index 22f7a520c929..56d3dadf6a33 100644
--- a/clang/lib/Headers/immintrin.h
+++ b/clang/lib/Headers/immintrin.h
@@ -72,11 +72,6 @@
#include <f16cintrin.h>
#endif
-#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
- defined(__VPCLMULQDQ__)
-#include <vpclmulqdqintrin.h>
-#endif
-
/* No feature check desired due to internal checks */
#include <bmiintrin.h>
@@ -230,6 +225,11 @@
#include <pkuintrin.h>
#endif
+#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
+ defined(__VPCLMULQDQ__)
+#include <vpclmulqdqintrin.h>
+#endif
+
#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
defined(__VAES__)
#include <vaesintrin.h>
diff --git a/clang/lib/Headers/vaesintrin.h b/clang/lib/Headers/vaesintrin.h
index c4d5c3e75140..f3c0807bb94a 100644
--- a/clang/lib/Headers/vaesintrin.h
+++ b/clang/lib/Headers/vaesintrin.h
@@ -28,13 +28,6 @@ static __inline__ __m256i __DEFAULT_FN_ATTRS
(__v4di) __B);
}
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenc_epi128(__m512i __A, __m512i __B)
-{
- return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
- (__v8di) __B);
-}
-
static __inline__ __m256i __DEFAULT_FN_ATTRS
_mm256_aesdec_epi128(__m256i __A, __m256i __B)
{
@@ -42,32 +35,40 @@ static __inline__ __m256i __DEFAULT_FN_ATTRS
(__v4di) __B);
}
-static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesdec_epi128(__m512i __A, __m512i __B)
+static __inline__ __m256i __DEFAULT_FN_ATTRS
+ _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
{
- return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
- (__v8di) __B);
+ return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A,
+ (__v4di) __B);
}
static __inline__ __m256i __DEFAULT_FN_ATTRS
- _mm256_aesenclast_epi128(__m256i __A, __m256i __B)
+ _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
{
- return (__m256i) __builtin_ia32_aesenclast256((__v4di) __A,
+ return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A,
(__v4di) __B);
}
+#ifdef __AVX512FINTRIN_H
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
- _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+ _mm512_aesenc_epi128(__m512i __A, __m512i __B)
{
- return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+ return (__m512i) __builtin_ia32_aesenc512((__v8di) __A,
(__v8di) __B);
}
-static __inline__ __m256i __DEFAULT_FN_ATTRS
- _mm256_aesdeclast_epi128(__m256i __A, __m256i __B)
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesdec_epi128(__m512i __A, __m512i __B)
{
- return (__m256i) __builtin_ia32_aesdeclast256((__v4di) __A,
- (__v4di) __B);
+ return (__m512i) __builtin_ia32_aesdec512((__v8di) __A,
+ (__v8di) __B);
+}
+
+static __inline__ __m512i __DEFAULT_FN_ATTRS_F
+ _mm512_aesenclast_epi128(__m512i __A, __m512i __B)
+{
+ return (__m512i) __builtin_ia32_aesenclast512((__v8di) __A,
+ (__v8di) __B);
}
static __inline__ __m512i __DEFAULT_FN_ATTRS_F
@@ -76,7 +77,7 @@ static __inline__ __m512i __DEFAULT_FN_ATTRS_F
return (__m512i) __builtin_ia32_aesdeclast512((__v8di) __A,
(__v8di) __B);
}
-
+#endif // __AVX512FINTRIN_H
#undef __DEFAULT_FN_ATTRS
#undef __DEFAULT_FN_ATTRS_F
diff --git a/clang/lib/Headers/vpclmulqdqintrin.h b/clang/lib/Headers/vpclmulqdqintrin.h
index 470d83254905..44daadb07d57 100644
--- a/clang/lib/Headers/vpclmulqdqintrin.h
+++ b/clang/lib/Headers/vpclmulqdqintrin.h
@@ -19,10 +19,12 @@
(__v4di)(__m256i)(B), \
(char)(I))
+#ifdef __AVX512FINTRIN_H
#define _mm512_clmulepi64_epi128(A, B, I) \
(__m512i)__builtin_ia32_pclmulqdq512((__v8di)(__m512i)(A), \
(__v8di)(__m512i)(B), \
(char)(I))
+#endif // __AVX512FINTRIN_H
#endif /* __VPCLMULQDQINTRIN_H */
More information about the cfe-commits
mailing list