1 /*===---- __wmmintrin_pclmul.h - PCMUL 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 
10 #ifndef __WMMINTRIN_H
11 #error "Never use <__wmmintrin_pclmul.h> directly; include <wmmintrin.h> instead."
12 #endif
13 
14 #ifndef __WMMINTRIN_PCLMUL_H
15 #define __WMMINTRIN_PCLMUL_H
16 
17 /// Multiplies two 64-bit integer values, which are selected from source
18 ///    operands using the immediate-value operand. The multiplication is a
19 ///    carry-less multiplication, and the 128-bit integer product is stored in
20 ///    the destination.
21 ///
22 /// \headerfile <x86intrin.h>
23 ///
24 /// \code
25 /// __m128i _mm_clmulepi64_si128(__m128i X, __m128i Y, const int I);
26 /// \endcode
27 ///
28 /// This intrinsic corresponds to the <c> VPCLMULQDQ </c> instruction.
29 ///
30 /// \param X
31 ///    A 128-bit vector of [2 x i64] containing one of the source operands.
32 /// \param Y
33 ///    A 128-bit vector of [2 x i64] containing one of the source operands.
34 /// \param I
35 ///    An immediate value specifying which 64-bit values to select from the
36 ///    operands. Bit 0 is used to select a value from operand \a X, and bit
37 ///    4 is used to select a value from operand \a Y: \n
38 ///    Bit[0]=0 indicates that bits[63:0] of operand \a X are used. \n
39 ///    Bit[0]=1 indicates that bits[127:64] of operand \a X are used. \n
40 ///    Bit[4]=0 indicates that bits[63:0] of operand \a Y are used. \n
41 ///    Bit[4]=1 indicates that bits[127:64] of operand \a Y are used.
42 /// \returns The 128-bit integer vector containing the result of the carry-less
43 ///    multiplication of the selected 64-bit values.
44 #define _mm_clmulepi64_si128(X, Y, I) \
45   ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
46                                         (__v2di)(__m128i)(Y), (char)(I)))
47 
48 #endif /* __WMMINTRIN_PCLMUL_H */
49