PR target/16201
[official-gcc.git] / gcc / config / ia64 / ia64intrin.h
blob2397c4ccde84fe0810d3686aeb634e7ae7026ad2
1 #ifndef _IA64INTRIN_H_INCLUDED
2 #define _IA64INTRIN_H_INCLUDED
4 /* Actually, everything is a compiler builtin, but just so
5 there's no confusion... */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
10 extern void __sync_synchronize (void);
12 extern int __sync_val_compare_and_swap_si (int *, int, int);
13 extern long __sync_val_compare_and_swap_di (long *, long, long);
14 #define __sync_val_compare_and_swap(PTR, OLD, NEW) \
15 ((sizeof (*(PTR)) == sizeof(int)) \
16 ? (__typeof__(*(PTR))) \
17 __sync_val_compare_and_swap_si((int *)(void *)(PTR),(int)(OLD),(int)(NEW)) \
18 : (__typeof__(*(PTR))) \
19 __sync_val_compare_and_swap_di((long *)(void *)(PTR),(long)(OLD),(long)(NEW)))
21 extern int __sync_bool_compare_and_swap_si (int *, int, int);
22 extern int __sync_bool_compare_and_swap_di (long *, long, long);
23 #define __sync_bool_compare_and_swap(PTR, OLD, NEW) \
24 ((sizeof (*(PTR)) == sizeof(int)) \
25 ? __sync_bool_compare_and_swap_si((int *)(void *)(PTR),(int)(OLD),(int)(NEW)) \
26 : __sync_bool_compare_and_swap_di((long *)(void *)(PTR),(long)(OLD),(long)(NEW)))
28 extern void __sync_lock_release_si (int *);
29 extern void __sync_lock_release_di (long *);
30 #define __sync_lock_release(PTR) \
31 ((sizeof (*(PTR)) == sizeof(int)) \
32 ? __sync_lock_release_si((int *)(void *)(PTR)) \
33 : __sync_lock_release_di((long *)(void *)(PTR)))
35 extern int __sync_lock_test_and_set_si (int *, int);
36 extern long __sync_lock_test_and_set_di (long *, long);
37 #define __sync_lock_test_and_set(PTR,VAL) \
38 ((sizeof (*(PTR)) == sizeof(int)) \
39 ? (__typeof__(*(PTR))) __sync_lock_test_and_set_si((int *)(void *)(PTR),(int)(VAL)) \
40 : (__typeof__(*(PTR))) __sync_lock_test_and_set_di((long *)(void *)(PTR),(long)(VAL)))
42 extern int __sync_fetch_and_add_si (int *, int);
43 extern long __sync_fetch_and_add_di (long *, long);
44 #define __sync_fetch_and_add(PTR,VAL) \
45 ((sizeof (*(PTR)) == sizeof(int)) \
46 ? (__typeof__(*(PTR))) __sync_fetch_and_add_si((int *)(void *)(PTR),(int)(VAL)) \
47 : (__typeof__(*(PTR))) __sync_fetch_and_add_di((long *)(void *)(PTR),(long)(VAL)))
49 extern int __sync_fetch_and_sub_si (int *, int);
50 extern long __sync_fetch_and_sub_di (long *, long);
51 #define __sync_fetch_and_sub(PTR,VAL) \
52 ((sizeof (*(PTR)) == sizeof(int)) \
53 ? (__typeof__(*(PTR))) __sync_fetch_and_sub_si((int *)(void *)(PTR),(int)(VAL)) \
54 : (__typeof__(*(PTR))) __sync_fetch_and_sub_di((long *)(void *)(PTR),(long)(VAL)))
56 extern int __sync_fetch_and_and_si (int *, int);
57 extern long __sync_fetch_and_and_di (long *, long);
58 #define __sync_fetch_and_and(PTR,VAL) \
59 ((sizeof (*(PTR)) == sizeof(int)) \
60 ? (__typeof__(*(PTR))) __sync_fetch_and_and_si((int *)(void *)(PTR),(int)(VAL)) \
61 : (__typeof__(*(PTR))) __sync_fetch_and_and_di((long *)(void *)(PTR),(long)(VAL)))
63 extern int __sync_fetch_and_or_si (int *, int);
64 extern long __sync_fetch_and_or_di (long *, long);
65 #define __sync_fetch_and_or(PTR,VAL) \
66 ((sizeof (*(PTR)) == sizeof(int)) \
67 ? (__typeof__(*(PTR))) __sync_fetch_and_or_si((int *)(void *)(PTR),(int)(VAL)) \
68 : (__typeof__(*(PTR))) __sync_fetch_and_or_di((long *)(void *)(PTR),(long)(VAL)))
70 extern int __sync_fetch_and_xor_si (int *, int);
71 extern long __sync_fetch_and_xor_di (long *, long);
72 #define __sync_fetch_and_xor(PTR,VAL) \
73 ((sizeof (*(PTR)) == sizeof(int)) \
74 ? (__typeof__(*(PTR))) __sync_fetch_and_xor_si((int *)(void *)(PTR),(int)(VAL)) \
75 : (__typeof__(*(PTR))) __sync_fetch_and_xor_di((long *)(void *)(PTR),(long)(VAL)))
77 extern int __sync_fetch_and_nand_si (int *, int);
78 extern long __sync_fetch_and_nand_di (long *, long);
79 #define __sync_fetch_and_nand(PTR,VAL) \
80 ((sizeof (*(PTR)) == sizeof(int)) \
81 ? (__typeof__(*(PTR))) __sync_fetch_and_nand_si((int *)(void *)(PTR),(int)(VAL)) \
82 : (__typeof__(*(PTR))) __sync_fetch_and_nand_di((long *)(void *)(PTR),(long)(VAL)))
84 extern int __sync_add_and_fetch_si (int *, int);
85 extern long __sync_add_and_fetch_di (long *, long);
86 #define __sync_add_and_fetch(PTR,VAL) \
87 ((sizeof (*(PTR)) == sizeof(int)) \
88 ? (__typeof__(*(PTR))) __sync_add_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
89 : (__typeof__(*(PTR))) __sync_add_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
91 extern int __sync_sub_and_fetch_si (int *, int);
92 extern long __sync_sub_and_fetch_di (long *, long);
93 #define __sync_sub_and_fetch(PTR,VAL) \
94 ((sizeof (*(PTR)) == sizeof(int)) \
95 ? (__typeof__(*(PTR))) __sync_sub_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
96 : (__typeof__(*(PTR))) __sync_sub_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
98 extern int __sync_and_and_fetch_si (int *, int);
99 extern long __sync_and_and_fetch_di (long *, long);
100 #define __sync_and_and_fetch(PTR,VAL) \
101 ((sizeof (*(PTR)) == sizeof(int)) \
102 ? (__typeof__(*(PTR))) __sync_and_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
103 : (__typeof__(*(PTR))) __sync_and_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
105 extern int __sync_or_and_fetch_si (int *, int);
106 extern long __sync_or_and_fetch_di (long *, long);
107 #define __sync_or_and_fetch(PTR,VAL) \
108 ((sizeof (*(PTR)) == sizeof(int)) \
109 ? (__typeof__(*(PTR))) __sync_or_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
110 : (__typeof__(*(PTR))) __sync_or_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
112 extern int __sync_xor_and_fetch_si (int *, int);
113 extern long __sync_xor_and_fetch_di (long *, long);
114 #define __sync_xor_and_fetch(PTR,VAL) \
115 ((sizeof (*(PTR)) == sizeof(int)) \
116 ? (__typeof__(*(PTR))) __sync_xor_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
117 : (__typeof__(*(PTR))) __sync_xor_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
119 extern int __sync_nand_and_fetch_si (int *, int);
120 extern long __sync_nand_and_fetch_di (long *, long);
121 #define __sync_nand_and_fetch(PTR,VAL) \
122 ((sizeof (*(PTR)) == sizeof(int)) \
123 ? (__typeof__(*(PTR))) __sync_nand_and_fetch_si((int *)(void *)(PTR),(int)(VAL)) \
124 : (__typeof__(*(PTR))) __sync_nand_and_fetch_di((long *)(void *)(PTR),(long)(VAL)))
126 #ifdef __cplusplus
128 #endif
130 #endif