1*bdd1243dSDimitry Andric /*===--------------- cmpccxaddintrin.h - CMPCCXADD intrinsics--------------=== 2*bdd1243dSDimitry Andric * 3*bdd1243dSDimitry Andric * 4*bdd1243dSDimitry Andric * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 5*bdd1243dSDimitry Andric * See https://llvm.org/LICENSE.txt for license information. 6*bdd1243dSDimitry Andric * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 7*bdd1243dSDimitry Andric * 8*bdd1243dSDimitry Andric *===-----------------------------------------------------------------------=== 9*bdd1243dSDimitry Andric */ 10*bdd1243dSDimitry Andric #ifndef __X86GPRINTRIN_H 11*bdd1243dSDimitry Andric #error \ 12*bdd1243dSDimitry Andric "Never use <cmpccxaddintrin.h> directly; include <x86gprintrin.h> instead." 13*bdd1243dSDimitry Andric #endif // __X86GPRINTRIN_H 14*bdd1243dSDimitry Andric 15*bdd1243dSDimitry Andric #ifndef __CMPCCXADDINTRIN_H 16*bdd1243dSDimitry Andric #define __CMPCCXADDINTRIN_H 17*bdd1243dSDimitry Andric #ifdef __x86_64__ 18*bdd1243dSDimitry Andric 19*bdd1243dSDimitry Andric typedef enum { 20*bdd1243dSDimitry Andric _CMPCCX_O, /* Overflow. */ 21*bdd1243dSDimitry Andric _CMPCCX_NO, /* No overflow. */ 22*bdd1243dSDimitry Andric _CMPCCX_B, /* Below. */ 23*bdd1243dSDimitry Andric _CMPCCX_NB, /* Not below. */ 24*bdd1243dSDimitry Andric _CMPCCX_Z, /* Zero. */ 25*bdd1243dSDimitry Andric _CMPCCX_NZ, /* Not zero. */ 26*bdd1243dSDimitry Andric _CMPCCX_BE, /* Below or equal. */ 27*bdd1243dSDimitry Andric _CMPCCX_NBE, /* Neither below nor equal. */ 28*bdd1243dSDimitry Andric _CMPCCX_S, /* Sign. */ 29*bdd1243dSDimitry Andric _CMPCCX_NS, /* No sign. */ 30*bdd1243dSDimitry Andric _CMPCCX_P, /* Parity. */ 31*bdd1243dSDimitry Andric _CMPCCX_NP, /* No parity. */ 32*bdd1243dSDimitry Andric _CMPCCX_L, /* Less. */ 33*bdd1243dSDimitry Andric _CMPCCX_NL, /* Not less. */ 34*bdd1243dSDimitry Andric _CMPCCX_LE, /* Less or equal. */ 35*bdd1243dSDimitry Andric _CMPCCX_NLE, /* Neither less nor equal. */ 36*bdd1243dSDimitry Andric } _CMPCCX_ENUM; 37*bdd1243dSDimitry Andric 38*bdd1243dSDimitry Andric /// Compares the value from the memory __A with the value of __B. If the 39*bdd1243dSDimitry Andric /// specified condition __D is met, then add the third operand __C to the 40*bdd1243dSDimitry Andric /// __A and write it into __A, else the value of __A is unchanged. The return 41*bdd1243dSDimitry Andric /// value is the original value of __A. 42*bdd1243dSDimitry Andric /// 43*bdd1243dSDimitry Andric /// \headerfile <immintrin.h> 44*bdd1243dSDimitry Andric /// 45*bdd1243dSDimitry Andric /// This intrinsic corresponds to the \c CMPCCXADD instructions. 46*bdd1243dSDimitry Andric /// 47*bdd1243dSDimitry Andric /// \param __A 48*bdd1243dSDimitry Andric /// __A pointer specifying the memory address. 49*bdd1243dSDimitry Andric /// 50*bdd1243dSDimitry Andric /// \param __B 51*bdd1243dSDimitry Andric /// A integer operand. 52*bdd1243dSDimitry Andric /// 53*bdd1243dSDimitry Andric /// \param __C 54*bdd1243dSDimitry Andric /// A integer operand. 55*bdd1243dSDimitry Andric /// 56*bdd1243dSDimitry Andric /// \param __D 57*bdd1243dSDimitry Andric /// The specified condition. 58*bdd1243dSDimitry Andric /// 59*bdd1243dSDimitry Andric /// \returns a integer which is the original value of first operand. 60*bdd1243dSDimitry Andric 61*bdd1243dSDimitry Andric #define _cmpccxadd_epi32(__A, __B, __C, __D) \ 62*bdd1243dSDimitry Andric ((int)(__builtin_ia32_cmpccxadd32((void *)(__A), (int)(__B), (int)(__C), \ 63*bdd1243dSDimitry Andric (int)(__D)))) 64*bdd1243dSDimitry Andric 65*bdd1243dSDimitry Andric #define _cmpccxadd_epi64(__A, __B, __C, __D) \ 66*bdd1243dSDimitry Andric ((long long)(__builtin_ia32_cmpccxadd64((void *)(__A), (long long)(__B), \ 67*bdd1243dSDimitry Andric (long long)(__C), (int)(__D)))) 68*bdd1243dSDimitry Andric 69*bdd1243dSDimitry Andric #endif // __x86_64__ 70*bdd1243dSDimitry Andric #endif // __CMPCCXADDINTRIN_H 71