Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 1 | /*===---- __wmmintrin_pclmul.h - PCMUL intrinsics ---------------------------=== |
| 2 | * |
Logan Chien | df4f766 | 2019-09-04 16:45:23 -0700 | [diff] [blame] | 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 |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 6 | * |
| 7 | *===-----------------------------------------------------------------------=== |
| 8 | */ |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 9 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 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 |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 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 | /// |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 28 | /// This intrinsic corresponds to the <c> VPCLMULQDQ </c> instruction. |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 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 |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 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. |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 42 | /// \returns The 128-bit integer vector containing the result of the carry-less |
| 43 | /// multiplication of the selected 64-bit values. |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 44 | #define _mm_clmulepi64_si128(X, Y, I) \ |
| 45 | ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(X), \ |
| 46 | (__v2di)(__m128i)(Y), (char)(I))) |
Logan Chien | 2833ffb | 2018-10-09 10:03:24 +0800 | [diff] [blame] | 47 | |
Logan Chien | 55afb0a | 2018-10-15 10:42:14 +0800 | [diff] [blame] | 48 | #endif /* __WMMINTRIN_PCLMUL_H */ |