]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/config/i386/cmpccxaddintrin.h
1afa03bd08ab9f2867009efa0a7beadcde5a087d
[thirdparty/gcc.git] / gcc / config / i386 / cmpccxaddintrin.h
1 /* Copyright (C) 2012-2021 Free Software Foundation, Inc.
2
3 This file is part of GCC.
4
5 GCC is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
9
10 GCC is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 Under Section 7 of GPL version 3, you are granted additional
16 permissions described in the GCC Runtime Library Exception, version
17 3.1, as published by the Free Software Foundation.
18
19 You should have received a copy of the GNU General Public License and
20 a copy of the GCC Runtime Library Exception along with this program;
21 see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
22 <http://www.gnu.org/licenses/>. */
23
24 #ifndef _X86GPRINTRIN_H_INCLUDED
25 #error "Never use <cmpccxaddintrin.h> directly; include <x86gprintrin.h> instead."
26 #endif
27
28 #ifndef _CMPCCXADDINTRIN_H_INCLUDED
29 #define _CMPCCXADDINTRIN_H_INCLUDED
30
31 #ifdef __x86_64__
32
33 #ifndef __CMPCCXADD__
34 #pragma GCC push_options
35 #pragma GCC target("cmpccxadd")
36 #define __DISABLE_CMPCCXADD__
37 #endif /* __CMPCCXADD__ */
38
39 typedef enum {
40 _CMPCCX_O, /* Overflow. */
41 _CMPCCX_NO, /* No overflow. */
42 _CMPCCX_B, /* Below. */
43 _CMPCCX_NB, /* Not below. */
44 _CMPCCX_Z, /* Zero. */
45 _CMPCCX_NZ, /* Not zero. */
46 _CMPCCX_BE, /* Below or equal. */
47 _CMPCCX_NBE, /* Neither below nor equal. */
48 _CMPCCX_S, /* Sign. */
49 _CMPCCX_NS, /* No sign. */
50 _CMPCCX_P, /* Parity. */
51 _CMPCCX_NP, /* No parity. */
52 _CMPCCX_L, /* Less. */
53 _CMPCCX_NL, /* Not less. */
54 _CMPCCX_LE, /* Less or equal. */
55 _CMPCCX_NLE, /* Neither less nor equal. */
56 } _CMPCCX_ENUM;
57
58 #ifdef __OPTIMIZE__
59 extern __inline int
60 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
61 __cmpccxadd_epi32 (int *__A, int __B, int __C, const _CMPCCX_ENUM __D)
62 {
63 return __builtin_ia32_cmpccxadd (__A, __B, __C, __D);
64 }
65
66 extern __inline long long
67 __attribute__ ((__gnu_inline__, __always_inline__, __artificial__))
68 __cmpccxadd_epi64 (long long *__A, long long __B, long long __C,
69 const _CMPCCX_ENUM __D)
70 {
71 return __builtin_ia32_cmpccxadd64 (__A, __B, __C, __D);
72 }
73 #else
74 #define __cmpccxadd_epi32(A,B,C,D) \
75 __builtin_ia32_cmpccxadd ((int *) (A), (int) (B), (int) (C), \
76 (_CMPCCX_ENUM) (D))
77 #define __cmpccxadd_epi64(A,B,C,D) \
78 __builtin_ia32_cmpccxadd64 ((long long *) (A), (long long) (B), \
79 (long long) (C), (_CMPCCX_ENUM) (D))
80 #endif
81
82 #ifdef __DISABLE_CMPCCXADD__
83 #undef __DISABLE_CMPCCXADD__
84 #pragma GCC pop_options
85 #endif /* __DISABLE_CMPCCXADD__ */
86
87 #endif
88
89 #endif /* _CMPCCXADDINTRIN_H_INCLUDED */