[clang] [clang] Make vector cast intrinsics constexpr (PR #156381)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 2 02:07:04 PDT 2025
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 origin/main HEAD --extensions h -- clang/lib/Headers/avx512fintrin.h clang/lib/Headers/avx512fp16intrin.h
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Headers/avx512fintrin.h b/clang/lib/Headers/avx512fintrin.h
index 317891dfb..3b65ef4a3 100644
--- a/clang/lib/Headers/avx512fintrin.h
+++ b/clang/lib/Headers/avx512fintrin.h
@@ -409,20 +409,17 @@ _mm512_castps256_ps512(__m256 __a)
}
static __inline __m128d __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castpd512_pd128(__m512d __a)
-{
+_mm512_castpd512_pd128(__m512d __a) {
return __builtin_shufflevector(__a, __a, 0, 1);
}
static __inline __m256d __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castpd512_pd256 (__m512d __A)
-{
+_mm512_castpd512_pd256(__m512d __A) {
return __builtin_shufflevector(__A, __A, 0, 1, 2, 3);
}
static __inline __m128 __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castps512_ps128(__m512 __a)
-{
+_mm512_castps512_ps128(__m512 __a) {
return __builtin_shufflevector(__a, __a, 0, 1, 2, 3);
}
@@ -432,14 +429,12 @@ _mm512_castps512_ps256(__m512 __A) {
}
static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castpd_ps (__m512d __A)
-{
+_mm512_castpd_ps(__m512d __A) {
return (__m512) (__A);
}
static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castpd_si512 (__m512d __A)
-{
+_mm512_castpd_si512(__m512d __A) {
return (__m512i) (__A);
}
@@ -453,14 +448,12 @@ _mm512_castpd128_pd512 (__m128d __A)
}
static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castps_pd (__m512 __A)
-{
+_mm512_castps_pd(__m512 __A) {
return (__m512d) (__A);
}
static __inline __m512i __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castps_si512 (__m512 __A)
-{
+_mm512_castps_si512(__m512 __A) {
return (__m512i) (__A);
}
@@ -489,20 +482,17 @@ _mm512_castsi256_si512 (__m256i __A)
}
static __inline __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castsi512_ps (__m512i __A)
-{
+_mm512_castsi512_ps(__m512i __A) {
return (__m512) (__A);
}
static __inline __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castsi512_pd (__m512i __A)
-{
+_mm512_castsi512_pd(__m512i __A) {
return (__m512d) (__A);
}
static __inline __m128i __DEFAULT_FN_ATTRS512_CONSTEXPR
-_mm512_castsi512_si128 (__m512i __A)
-{
+_mm512_castsi512_si128(__m512i __A) {
return (__m128i)__builtin_shufflevector(__A, __A , 0, 1);
}
diff --git a/clang/lib/Headers/avx512fp16intrin.h b/clang/lib/Headers/avx512fp16intrin.h
index b8145613d..cb053768b 100644
--- a/clang/lib/Headers/avx512fp16intrin.h
+++ b/clang/lib/Headers/avx512fp16intrin.h
@@ -113,31 +113,38 @@ _mm512_set1_pch(_Float16 _Complex __h) {
return (__m512h)_mm512_set1_ps(__builtin_bit_cast(float, __h));
}
-static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_ps(__m128h __a) {
+static __inline__ __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castph_ps(__m128h __a) {
return (__m128)__a;
}
-static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castph_ps(__m256h __a) {
+static __inline__ __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
+_mm256_castph_ps(__m256h __a) {
return (__m256)__a;
}
-static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castph_ps(__m512h __a) {
+static __inline__ __m512 __DEFAULT_FN_ATTRS512_CONSTEXPR
+_mm512_castph_ps(__m512h __a) {
return (__m512)__a;
}
-static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_pd(__m128h __a) {
+static __inline__ __m128d __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castph_pd(__m128h __a) {
return (__m128d)__a;
}
-static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castph_pd(__m256h __a) {
+static __inline__ __m256d __DEFAULT_FN_ATTRS256_CONSTEXPR
+_mm256_castph_pd(__m256h __a) {
return (__m256d)__a;
}
-static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castph_pd(__m512h __a) {
+static __inline__ __m512d __DEFAULT_FN_ATTRS512_CONSTEXPR
+_mm512_castph_pd(__m512h __a) {
return (__m512d)__a;
}
-static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castph_si128(__m128h __a) {
+static __inline__ __m128i __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castph_si128(__m128h __a) {
return (__m128i)__a;
}
@@ -151,31 +158,38 @@ _mm512_castph_si512(__m512h __a) {
return (__m512i)__a;
}
-static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castps_ph(__m128 __a) {
+static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castps_ph(__m128 __a) {
return (__m128h)__a;
}
-static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castps_ph(__m256 __a) {
+static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
+_mm256_castps_ph(__m256 __a) {
return (__m256h)__a;
}
-static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castps_ph(__m512 __a) {
+static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
+_mm512_castps_ph(__m512 __a) {
return (__m512h)__a;
}
-static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castpd_ph(__m128d __a) {
+static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castpd_ph(__m128d __a) {
return (__m128h)__a;
}
-static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR _mm256_castpd_ph(__m256d __a) {
+static __inline__ __m256h __DEFAULT_FN_ATTRS256_CONSTEXPR
+_mm256_castpd_ph(__m256d __a) {
return (__m256h)__a;
}
-static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR _mm512_castpd_ph(__m512d __a) {
+static __inline__ __m512h __DEFAULT_FN_ATTRS512_CONSTEXPR
+_mm512_castpd_ph(__m512d __a) {
return (__m512h)__a;
}
-static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR _mm_castsi128_ph(__m128i __a) {
+static __inline__ __m128h __DEFAULT_FN_ATTRS128_CONSTEXPR
+_mm_castsi128_ph(__m128i __a) {
return (__m128h)__a;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/156381
More information about the cfe-commits
mailing list