brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · a0bd99d Raw
101 lines · c
1/*===---- crc32intrin.h - SSE4.2 Accumulate CRC32 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-exception6 *7 *===-----------------------------------------------------------------------===8 */9 10#ifndef __CRC32INTRIN_H11#define __CRC32INTRIN_H12 13#define __DEFAULT_FN_ATTRS                                                     \14  __attribute__((__always_inline__, __nodebug__, __target__("crc32")))15 16/// Adds the unsigned integer operand to the CRC-32C checksum of the17///    unsigned char operand.18///19/// \headerfile <x86intrin.h>20///21/// This intrinsic corresponds to the <c> CRC32B </c> instruction.22///23/// \param __C24///    An unsigned integer operand to add to the CRC-32C checksum of operand25///    \a  __D.26/// \param __D27///    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 of29///    operand \a __D.30static __inline__ unsigned int __DEFAULT_FN_ATTRS31_mm_crc32_u8(unsigned int __C, unsigned char __D)32{33  return __builtin_ia32_crc32qi(__C, __D);34}35 36/// Adds the unsigned integer operand to the CRC-32C checksum of the37///    unsigned short operand.38///39/// \headerfile <x86intrin.h>40///41/// This intrinsic corresponds to the <c> CRC32W </c> instruction.42///43/// \param __C44///    An unsigned integer operand to add to the CRC-32C checksum of operand45///    \a __D.46/// \param __D47///    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 of49///    operand \a __D.50static __inline__ unsigned int __DEFAULT_FN_ATTRS51_mm_crc32_u16(unsigned int __C, unsigned short __D)52{53  return __builtin_ia32_crc32hi(__C, __D);54}55 56/// Adds the first unsigned integer operand to the CRC-32C checksum of57///    the second unsigned integer operand.58///59/// \headerfile <x86intrin.h>60///61/// This intrinsic corresponds to the <c> CRC32L </c> instruction.62///63/// \param __C64///    An unsigned integer operand to add to the CRC-32C checksum of operand65///    \a __D.66/// \param __D67///    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 of69///    operand \a __D.70static __inline__ unsigned int __DEFAULT_FN_ATTRS71_mm_crc32_u32(unsigned int __C, unsigned int __D)72{73  return __builtin_ia32_crc32si(__C, __D);74}75 76#ifdef __x86_64__77/// Adds the unsigned integer operand to the CRC-32C checksum of the78///    unsigned 64-bit integer operand.79///80/// \headerfile <x86intrin.h>81///82/// This intrinsic corresponds to the <c> CRC32Q </c> instruction.83///84/// \param __C85///    An unsigned integer operand to add to the CRC-32C checksum of operand86///    \a __D.87/// \param __D88///    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 of90///    operand \a __D.91static __inline__ unsigned long long __DEFAULT_FN_ATTRS92_mm_crc32_u64(unsigned long long __C, unsigned long long __D)93{94  return __builtin_ia32_crc32di(__C, __D);95}96#endif /* __x86_64__ */97 98#undef __DEFAULT_FN_ATTRS99 100#endif /* __CRC32INTRIN_H */101