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