xref: /freebsd/contrib/llvm-project/clang/lib/Headers/__wmmintrin_pclmul.h (revision 81ad626541db97eb356e2c1d4a20eb2a26a766ab)
10b57cec5SDimitry Andric /*===---- __wmmintrin_pclmul.h - PCMUL intrinsics ---------------------------===
20b57cec5SDimitry Andric  *
30b57cec5SDimitry Andric  * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric  * See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric  *
70b57cec5SDimitry Andric  *===-----------------------------------------------------------------------===
80b57cec5SDimitry Andric  */
90b57cec5SDimitry Andric 
100b57cec5SDimitry Andric #ifndef __WMMINTRIN_H
110b57cec5SDimitry Andric #error "Never use <__wmmintrin_pclmul.h> directly; include <wmmintrin.h> instead."
120b57cec5SDimitry Andric #endif
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef __WMMINTRIN_PCLMUL_H
150b57cec5SDimitry Andric #define __WMMINTRIN_PCLMUL_H
160b57cec5SDimitry Andric 
170b57cec5SDimitry Andric /// Multiplies two 64-bit integer values, which are selected from source
180b57cec5SDimitry Andric ///    operands using the immediate-value operand. The multiplication is a
190b57cec5SDimitry Andric ///    carry-less multiplication, and the 128-bit integer product is stored in
200b57cec5SDimitry Andric ///    the destination.
210b57cec5SDimitry Andric ///
220b57cec5SDimitry Andric /// \headerfile <x86intrin.h>
230b57cec5SDimitry Andric ///
240b57cec5SDimitry Andric /// \code
25*81ad6265SDimitry Andric /// __m128i _mm_clmulepi64_si128(__m128i X, __m128i Y, const int I);
260b57cec5SDimitry Andric /// \endcode
270b57cec5SDimitry Andric ///
280b57cec5SDimitry Andric /// This intrinsic corresponds to the <c> VPCLMULQDQ </c> instruction.
290b57cec5SDimitry Andric ///
30*81ad6265SDimitry Andric /// \param X
310b57cec5SDimitry Andric ///    A 128-bit vector of [2 x i64] containing one of the source operands.
32*81ad6265SDimitry Andric /// \param Y
330b57cec5SDimitry Andric ///    A 128-bit vector of [2 x i64] containing one of the source operands.
34*81ad6265SDimitry Andric /// \param I
350b57cec5SDimitry Andric ///    An immediate value specifying which 64-bit values to select from the
36*81ad6265SDimitry Andric ///    operands. Bit 0 is used to select a value from operand \a X, and bit
37*81ad6265SDimitry Andric ///    4 is used to select a value from operand \a Y: \n
38*81ad6265SDimitry Andric ///    Bit[0]=0 indicates that bits[63:0] of operand \a X are used. \n
39*81ad6265SDimitry Andric ///    Bit[0]=1 indicates that bits[127:64] of operand \a X are used. \n
40*81ad6265SDimitry Andric ///    Bit[4]=0 indicates that bits[63:0] of operand \a Y are used. \n
41*81ad6265SDimitry Andric ///    Bit[4]=1 indicates that bits[127:64] of operand \a Y are used.
420b57cec5SDimitry Andric /// \returns The 128-bit integer vector containing the result of the carry-less
430b57cec5SDimitry Andric ///    multiplication of the selected 64-bit values.
440b57cec5SDimitry Andric #define _mm_clmulepi64_si128(X, Y, I) \
450b57cec5SDimitry Andric   ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
460b57cec5SDimitry Andric                                         (__v2di)(__m128i)(Y), (char)(I)))
470b57cec5SDimitry Andric 
480b57cec5SDimitry Andric #endif /* __WMMINTRIN_PCLMUL_H */
49