blob: fef4b93dbb43368867bf684e95b345630deb55e7 [file] [log] [blame]
Logan Chien2833ffb2018-10-09 10:03:24 +08001/*===---- __wmmintrin_pclmul.h - PCMUL intrinsics ---------------------------===
2 *
Logan Chiendf4f7662019-09-04 16:45:23 -07003 * 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
Logan Chien2833ffb2018-10-09 10:03:24 +08006 *
7 *===-----------------------------------------------------------------------===
8 */
Logan Chien2833ffb2018-10-09 10:03:24 +08009
Logan Chien55afb0a2018-10-15 10:42:14 +080010#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
Logan Chien2833ffb2018-10-09 10:03:24 +080018/// 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///
Logan Chien55afb0a2018-10-15 10:42:14 +080028/// This intrinsic corresponds to the <c> VPCLMULQDQ </c> instruction.
Logan Chien2833ffb2018-10-09 10:03:24 +080029///
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
Logan Chien55afb0a2018-10-15 10:42:14 +080036/// 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.
Logan Chien2833ffb2018-10-09 10:03:24 +080042/// \returns The 128-bit integer vector containing the result of the carry-less
43/// multiplication of the selected 64-bit values.
Logan Chien55afb0a2018-10-15 10:42:14 +080044#define _mm_clmulepi64_si128(X, Y, I) \
45 ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \
46 (__v2di)(__m128i)(Y), (char)(I)))
Logan Chien2833ffb2018-10-09 10:03:24 +080047
Logan Chien55afb0a2018-10-15 10:42:14 +080048#endif /* __WMMINTRIN_PCLMUL_H */