Path: blob/main/contrib/llvm-project/clang/lib/Headers/adxintrin.h
35233 views
/*===---- adxintrin.h - ADX intrinsics -------------------------------------===1*2* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3* See https://llvm.org/LICENSE.txt for license information.4* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5*6*===-----------------------------------------------------------------------===7*/89#ifndef __IMMINTRIN_H10#error "Never use <adxintrin.h> directly; include <immintrin.h> instead."11#endif1213#ifndef __ADXINTRIN_H14#define __ADXINTRIN_H1516/* Define the default attributes for the functions in this file. */17#define __DEFAULT_FN_ATTRS \18__attribute__((__always_inline__, __nodebug__, __target__("adx")))1920/* Use C++ inline semantics in C++, GNU inline for C mode. */21#if defined(__cplusplus)22#define __INLINE __inline23#else24#define __INLINE static __inline25#endif2627#if defined(__cplusplus)28extern "C" {29#endif3031/* Intrinsics that are available only if __ADX__ is defined. */3233/// Adds unsigned 32-bit integers \a __x and \a __y, plus 0 or 1 as indicated34/// by the carry flag \a __cf. Stores the unsigned 32-bit sum in the memory35/// at \a __p, and returns the 8-bit carry-out (carry flag).36///37/// \code{.operation}38/// temp := (__cf == 0) ? 0 : 139/// Store32(__p, __x + __y + temp)40/// result := CF41/// \endcode42///43/// \headerfile <immintrin.h>44///45/// This intrinsic corresponds to the \c ADCX instruction.46///47/// \param __cf48/// The 8-bit unsigned carry flag; any non-zero value indicates carry.49/// \param __x50/// A 32-bit unsigned addend.51/// \param __y52/// A 32-bit unsigned addend.53/// \param __p54/// Pointer to memory for storing the sum.55/// \returns The 8-bit unsigned carry-out value.56__INLINE unsigned char __DEFAULT_FN_ATTRS _addcarryx_u32(unsigned char __cf,57unsigned int __x,58unsigned int __y,59unsigned int *__p) {60return __builtin_ia32_addcarryx_u32(__cf, __x, __y, __p);61}6263#ifdef __x86_64__64/// Adds unsigned 64-bit integers \a __x and \a __y, plus 0 or 1 as indicated65/// by the carry flag \a __cf. Stores the unsigned 64-bit sum in the memory66/// at \a __p, and returns the 8-bit carry-out (carry flag).67///68/// \code{.operation}69/// temp := (__cf == 0) ? 0 : 170/// Store64(__p, __x + __y + temp)71/// result := CF72/// \endcode73///74/// \headerfile <immintrin.h>75///76/// This intrinsic corresponds to the \c ADCX instruction.77///78/// \param __cf79/// The 8-bit unsigned carry flag; any non-zero value indicates carry.80/// \param __x81/// A 64-bit unsigned addend.82/// \param __y83/// A 64-bit unsigned addend.84/// \param __p85/// Pointer to memory for storing the sum.86/// \returns The 8-bit unsigned carry-out value.87__INLINE unsigned char __DEFAULT_FN_ATTRS88_addcarryx_u64(unsigned char __cf, unsigned long long __x,89unsigned long long __y, unsigned long long *__p) {90return __builtin_ia32_addcarryx_u64(__cf, __x, __y, __p);91}92#endif9394#if defined(__cplusplus)95}96#endif9798#undef __INLINE99#undef __DEFAULT_FN_ATTRS100101#endif /* __ADXINTRIN_H */102103104