[clang] F16c constexpr support Issue #154310 (PR #158142)

via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 11 18:06:02 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 c,h -- clang/lib/Headers/f16cintrin.h clang/test/CodeGen/X86/f16c-builtins.c
``````````

: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/f16cintrin.h b/clang/lib/Headers/f16cintrin.h
index c3045b117..2aa89b4a9 100644
--- a/clang/lib/Headers/f16cintrin.h
+++ b/clang/lib/Headers/f16cintrin.h
@@ -44,8 +44,7 @@
 ///    A 16-bit half-precision float value.
 /// \returns The converted 32-bit float value.
 static __inline float __DEFAULT_FN_ATTRS128_CONSTEXPR
-_cvtsh_ss(unsigned short __a)
-{
+_cvtsh_ss(unsigned short __a) {
   return (float)__builtin_bit_cast(__fp16, __a);
 }
 
@@ -113,8 +112,7 @@ _cvtsh_ss(unsigned short __a)
 ///    64 bits are used in the conversion.
 /// \returns A 128-bit vector of [4 x float] containing converted float values.
 static __inline __m128 __DEFAULT_FN_ATTRS128_CONSTEXPR
-_mm_cvtph_ps(__m128i __a)
-{
+_mm_cvtph_ps(__m128i __a) {
   typedef __fp16 __v4fp16 __attribute__((__vector_size__(8)));
 
   __v4hi __v = __builtin_shufflevector((__v8hi)__a, (__v8hi)__a, 0, 1, 2, 3);
@@ -160,8 +158,7 @@ _mm_cvtph_ps(__m128i __a)
 /// \returns A vector of [8 x float] containing the converted 32-bit
 ///    single-precision float values.
 static __inline __m256 __DEFAULT_FN_ATTRS256_CONSTEXPR
-_mm256_cvtph_ps(__m128i __a)
-{
+_mm256_cvtph_ps(__m128i __a) {
   typedef __fp16 __v8fp16 __attribute__((__vector_size__(16), __aligned__(16)));
 
   return (__m256) __builtin_convertvector((__v8fp16)__a, __v8sf);

``````````

</details>


https://github.com/llvm/llvm-project/pull/158142


More information about the cfe-commits mailing list