[clang] [Clang] Add __builtin_selectvector and use it for AVX512 intrinsics (PR #91306)
via cfe-commits
cfe-commits at lists.llvm.org
Tue May 7 01:14:06 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 09327efdf0f02c4f865a4536db96cac539bb1c01 25ab7acb3de4abaf6ad72eab3fa52227920f8518 -- clang/test/Sema/builtin-selectvector.c clang/lib/CodeGen/CGBuiltin.cpp clang/lib/Headers/avx512bf16intrin.h clang/lib/Headers/avx512bitalgintrin.h clang/lib/Headers/avx512bwintrin.h clang/lib/Headers/avx512cdintrin.h clang/lib/Headers/avx512dqintrin.h clang/lib/Headers/avx512fintrin.h clang/lib/Headers/avx512fp16intrin.h clang/lib/Headers/avx512ifmaintrin.h clang/lib/Headers/avx512ifmavlintrin.h clang/lib/Headers/avx512vbmi2intrin.h clang/lib/Headers/avx512vbmiintrin.h clang/lib/Headers/avx512vbmivlintrin.h clang/lib/Headers/avx512vlbf16intrin.h clang/lib/Headers/avx512vlbitalgintrin.h clang/lib/Headers/avx512vlbwintrin.h clang/lib/Headers/avx512vlcdintrin.h clang/lib/Headers/avx512vldqintrin.h clang/lib/Headers/avx512vlfp16intrin.h clang/lib/Headers/avx512vlintrin.h clang/lib/Headers/avx512vlvbmi2intrin.h clang/lib/Headers/avx512vlvnniintrin.h clang/lib/Headers/avx512vnniintrin.h clang/lib/Headers/avx512vpopcntdqintrin.h clang/lib/Headers/avx512vpopcntdqvlintrin.h clang/lib/Headers/gfniintrin.h clang/lib/Sema/SemaChecking.cpp clang/test/CodeGen/X86/avx512dq-builtins.c clang/test/CodeGen/X86/avx512f-builtins-constrained.c clang/test/CodeGen/X86/avx512f-builtins.c clang/test/CodeGen/X86/avx512fp16-builtins.c clang/test/CodeGen/X86/avx512vl-builtins.c clang/test/CodeGen/X86/avx512vlfp16-builtins.c
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Headers/avx512vlbwintrin.h b/clang/lib/Headers/avx512vlbwintrin.h
index 79be7a645c..e75147b838 100644
--- a/clang/lib/Headers/avx512vlbwintrin.h
+++ b/clang/lib/Headers/avx512vlbwintrin.h
@@ -1682,7 +1682,7 @@ _mm_mask_unpackhi_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_unpackhi_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
return (__m128i)__builtin_selectvector((__v8hi)_mm_unpackhi_epi16(__A, __B),
- (__v8hi) _mm_setzero_si128(),
+ (__v8hi)_mm_setzero_si128(),
__builtin_bit_cast(__vecmask8, __U));
}
@@ -1738,7 +1738,7 @@ _mm_mask_unpacklo_epi16(__m128i __W, __mmask8 __U, __m128i __A, __m128i __B) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_maskz_unpacklo_epi16(__mmask8 __U, __m128i __A, __m128i __B) {
return (__m128i)__builtin_selectvector((__v8hi)_mm_unpacklo_epi16(__A, __B),
- (__v8hi) _mm_setzero_si128(),
+ (__v8hi)_mm_setzero_si128(),
__builtin_bit_cast(__vecmask8, __U));
}
@@ -2800,7 +2800,7 @@ _mm256_mask_permutexvar_epi16 (__m256i __W, __mmask16 __M, __m256i __A,
static __inline__ short __DEFAULT_FN_ATTRS128
_mm_reduce_add_epi16(__m128i __W) {
return __builtin_reduce_add((__v8hi)__W);
- }
+}
static __inline__ short __DEFAULT_FN_ATTRS128
_mm_reduce_mul_epi16(__m128i __W) {
diff --git a/clang/lib/Headers/avx512vlintrin.h b/clang/lib/Headers/avx512vlintrin.h
index 6d15942a85..8534c565e1 100644
--- a/clang/lib/Headers/avx512vlintrin.h
+++ b/clang/lib/Headers/avx512vlintrin.h
@@ -4201,7 +4201,7 @@ _mm256_maskz_scalef_ps (__mmask8 __U, __m256 __A, __m256 __B) {
static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_rolv_epi32(__m128i __A,
__m128i __B) {
return (__m128i)__builtin_ia32_prolvd128((__v4si)__A, (__v4si)__B);
-}
+ }
static __inline__ __m128i __DEFAULT_FN_ATTRS128
_mm_mask_rolv_epi32 (__m128i __W, __mmask8 __U, __m128i __A, __m128i __B)
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index b219d55866..6dfd015ef2 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -3039,8 +3039,8 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
return ExprError();
}
- const auto* LHSVecT = LHST->getAs<VectorType>();
- const auto* MaskVecT = MaskT->getAs<VectorType>();
+ const auto *LHSVecT = LHST->getAs<VectorType>();
+ const auto *MaskVecT = MaskT->getAs<VectorType>();
if (!LHSVecT) {
Diag(LHS.get()->getBeginLoc(), diag::err_builtin_invalid_arg_type)
``````````
</details>
https://github.com/llvm/llvm-project/pull/91306
More information about the cfe-commits
mailing list