1 /*===---- crc32intrin.h - SSE4.2 Accumulate CRC32 intrinsics ---------------===
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
7 *===-----------------------------------------------------------------------===
10 #ifndef __CRC32INTRIN_H
11 #define __CRC32INTRIN_H
13 #define __DEFAULT_FN_ATTRS \
14 __attribute__((__always_inline__, __nodebug__, __target__("crc32")))
16 /// Adds the unsigned integer operand to the CRC-32C checksum of the
17 /// unsigned char operand.
19 /// \headerfile <x86intrin.h>
21 /// This intrinsic corresponds to the <c> CRC32B </c> instruction.
24 /// An unsigned integer operand to add to the CRC-32C checksum of operand
27 /// An unsigned 8-bit integer operand used to compute the CRC-32C checksum.
28 /// \returns The result of adding operand \a __C to the CRC-32C checksum of
30 static __inline__
unsigned int __DEFAULT_FN_ATTRS
31 _mm_crc32_u8(unsigned int __C
, unsigned char __D
)
33 return __builtin_ia32_crc32qi(__C
, __D
);
36 /// Adds the unsigned integer operand to the CRC-32C checksum of the
37 /// unsigned short operand.
39 /// \headerfile <x86intrin.h>
41 /// This intrinsic corresponds to the <c> CRC32W </c> instruction.
44 /// An unsigned integer operand to add to the CRC-32C checksum of operand
47 /// An unsigned 16-bit integer operand used to compute the CRC-32C checksum.
48 /// \returns The result of adding operand \a __C to the CRC-32C checksum of
50 static __inline__
unsigned int __DEFAULT_FN_ATTRS
51 _mm_crc32_u16(unsigned int __C
, unsigned short __D
)
53 return __builtin_ia32_crc32hi(__C
, __D
);
56 /// Adds the first unsigned integer operand to the CRC-32C checksum of
57 /// the second unsigned integer operand.
59 /// \headerfile <x86intrin.h>
61 /// This intrinsic corresponds to the <c> CRC32L </c> instruction.
64 /// An unsigned integer operand to add to the CRC-32C checksum of operand
67 /// An unsigned 32-bit integer operand used to compute the CRC-32C checksum.
68 /// \returns The result of adding operand \a __C to the CRC-32C checksum of
70 static __inline__
unsigned int __DEFAULT_FN_ATTRS
71 _mm_crc32_u32(unsigned int __C
, unsigned int __D
)
73 return __builtin_ia32_crc32si(__C
, __D
);
77 /// Adds the unsigned integer operand to the CRC-32C checksum of the
78 /// unsigned 64-bit integer operand.
80 /// \headerfile <x86intrin.h>
82 /// This intrinsic corresponds to the <c> CRC32Q </c> instruction.
85 /// An unsigned integer operand to add to the CRC-32C checksum of operand
88 /// An unsigned 64-bit integer operand used to compute the CRC-32C checksum.
89 /// \returns The result of adding operand \a __C to the CRC-32C checksum of
91 static __inline__
unsigned long long __DEFAULT_FN_ATTRS
92 _mm_crc32_u64(unsigned long long __C
, unsigned long long __D
)
94 return __builtin_ia32_crc32di(__C
, __D
);
96 #endif /* __x86_64__ */
98 #undef __DEFAULT_FN_ATTRS
100 #endif /* __CRC32INTRIN_H */