master
 1/*===---- avx10_2copyintrin.h - AVX10.2 Copy intrinsics -------------------===
 2 *
 3 * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 4 * See https://llvm.org/LICENSE.txt for license information.
 5 * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 6 *
 7 *===-----------------------------------------------------------------------===
 8 */
 9#ifndef __IMMINTRIN_H
10#error                                                                         \
11    "Never use <avx10_2copyintrin.h> directly; include <immintrin.h> instead."
12#endif // __IMMINTRIN_H
13
14#ifndef __AVX10_2COPYINTRIN_H
15#define __AVX10_2COPYINTRIN_H
16
17/* Define the default attributes for the functions in this file. */
18#define __DEFAULT_FN_ATTRS128                                                  \
19  __attribute__((__always_inline__, __nodebug__, __target__("avx10.2-256"),    \
20                 __min_vector_width__(128)))
21
22/// Constructs a 128-bit integer vector, setting the lower 32 bits to the
23///    lower 32 bits of the parameter \a __A; the upper bits are zeoroed.
24///
25/// \code{.operation}
26/// result[31:0] := __A[31:0]
27/// result[MAX:32] := 0
28/// \endcode
29///
30/// \headerfile <immintrin.h>
31///
32/// This intrinsic corresponds to the <c> VMOVD </c> instruction.
33///
34/// \param __A
35///    A 128-bit integer vector.
36/// \returns A 128-bit integer vector. The lower 32 bits are copied from the
37///    parameter \a __A; the upper bits are zeroed.
38static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_move_epi32(__m128i __A) {
39  return (__m128i)__builtin_shufflevector(
40      (__v4si)__A, (__v4si)_mm_setzero_si128(), 0, 4, 4, 4);
41}
42
43/// Constructs a 128-bit integer vector, setting the lower 16 bits to the
44///    lower 16 bits of the parameter \a __A; the upper bits are zeoroed.
45///
46/// \code{.operation}
47/// result[15:0] := __A[15:0]
48/// result[MAX:16] := 0
49/// \endcode
50///
51/// \headerfile <immintrin.h>
52///
53/// This intrinsic corresponds to the <c> VMOVW </c> instruction.
54///
55/// \param __A
56///    A 128-bit integer vector.
57/// \returns A 128-bit integer vector. The lower 16 bits are copied from the
58///    parameter \a __A; the upper bits are zeroed.
59static __inline__ __m128i __DEFAULT_FN_ATTRS128 _mm_move_epi16(__m128i __A) {
60  return (__m128i)__builtin_shufflevector(
61      (__v8hi)__A, (__v8hi)_mm_setzero_si128(), 0, 8, 8, 8, 8, 8, 8, 8);
62}
63
64#undef __DEFAULT_FN_ATTRS128
65
66#endif // __AVX10_2COPYINTRIN_H