[clang] [llvm] [X86] AVX10_V2_AUX Implementation (PR #206888)
Evgenii Kudriashov via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 26 06:46:08 PDT 2026
================
@@ -0,0 +1,2404 @@
+/*===------------ avx10_2_v2auxintrin.h - AVX10_2_V2AUX -------------------===
+ *
+ * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+ * See https://llvm.org/LICENSE.txt for license information.
+ * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+ *
+ *===-----------------------------------------------------------------------===
+ */
+#ifndef __IMMINTRIN_H
+#error \
+ "Never use <avx10_2_v2auxintrin.h> directly; include <immintrin.h> instead."
+#endif // __IMMINTRIN_H
+
+#ifdef __SSE2__
+
+#ifndef __AVX10_2_V2AUXINTRIN_H
+#define __AVX10_2_V2AUXINTRIN_H
+
+/* Define the default attributes for the functions in this file. */
+#define __DEFAULT_FN_ATTRS128 \
+ __attribute__((__always_inline__, __nodebug__, __target__("avx10v2aux"), \
+ __min_vector_width__(128)))
+#define __DEFAULT_FN_ATTRS256 \
+ __attribute__((__always_inline__, __nodebug__, __target__("avx10v2aux"), \
+ __min_vector_width__(256)))
+
+/// Convert packed single-precision (32-bit) floating-point elements in \a __A
+/// to packed BF8 (8-bit) floating-point elements, and store the results in
+/// a 128-bit vector.
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c VCVTPS2BF8 instruction.
+///
+/// \param __A
+/// A 128-bit vector of [4 x float].
+/// \returns
+/// A 128-bit vector of [16 x i8]. The lower 4 bytes contain the converted
+/// values; the upper bytes are zeroed.
+static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_cvtps_bf8(__m128 __A) {
+ return (__m128i)__builtin_ia32_vcvtps2bf8_128((__v4sf)__A);
+}
+
+/// Convert packed single-precision (32-bit) floating-point elements in \a __A
+/// to packed BF8 (8-bit) floating-point elements, and store the results in
+/// a 128-bit vector using writemask \a __U.
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c VCVTPS2BF8 instruction.
+///
+/// \param __W
+/// A 128-bit vector of [16 x i8] used for writemask.
+/// \param __U
+/// A 8-bit mask indicating which elements to write.
+/// \param __A
+/// A 128-bit vector of [4 x float].
+/// \returns
+/// A 128-bit vector of [16 x i8]. The lower 4 bytes contain the converted
+/// values, or the corresponding bytes of \a __W where the mask bit is clear;
+/// the upper bytes are zeroed.
+static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_mask_cvtps_bf8(__m128i __W,
+ __mmask8 __U,
+ __m128 __A) {
+ return (__m128i)__builtin_ia32_vcvtps2bf8_128_mask((__v4sf)__A, (__v16qi)__W,
+ (__mmask8)__U);
+}
+
+/// Convert packed single-precision (32-bit) floating-point elements in \a __A
+/// to packed BF8 (8-bit) floating-point elements, and store the results in
+/// a 128-bit vector using zeromask \a __U.
+///
+/// \headerfile <immintrin.h>
+///
+/// This intrinsic corresponds to the \c VCVTPS2BF8 instruction.
+///
+/// \param __U
+/// A 8-bit mask indicating which elements to write (zero otherwise).
+/// \param __A
+/// A 128-bit vector of [4 x float].
+/// \returns
+/// A 128-bit vector of [16 x i8]. The lower 4 bytes contain the converted
+/// values, or zero where the mask bit is clear; the upper bytes are zeroed.
+static __inline__ __m128i __DEFAULT_FN_ATTRS128
+_mm_maskz_cvtps_bf8(__mmask8 __U, __m128 __A) {
+ return (__m128i)__builtin_ia32_vcvtps2bf8_128_mask(
+ (__v4sf)__A, (__v16qi)_mm_setzero_si128(), (__mmask8)__U);
+}
----------------
e-kud wrote:
Haven't we agreed to use select on maskz version?
https://github.com/llvm/llvm-project/pull/206888
More information about the cfe-commits
mailing list