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