1 #ifndef _IA64INTRIN_H_INCLUDED
2 #define _IA64INTRIN_H_INCLUDED
4 /* ??? Overloaded builtins havn't been ported to C++ yet. */
7 #define __sync_val_compare_and_swap(PTR, OLD, NEW) \
8 ((sizeof (*(PTR)) == sizeof(int)) \
9 ? (__typeof__(*(PTR))) \
10 __sync_val_compare_and_swap_4((int *)(void *)(PTR),(int)(OLD),(int)(NEW)) \
11 : (__typeof__(*(PTR))) \
12 __sync_val_compare_and_swap_8((long *)(void *)(PTR),(long)(OLD),(long)(NEW)))
14 #define __sync_bool_compare_and_swap(PTR, OLD, NEW) \
15 ((sizeof (*(PTR)) == sizeof(int)) \
16 ? __sync_bool_compare_and_swap_4((int *)(void *)(PTR),(int)(OLD),(int)(NEW)) \
17 : __sync_bool_compare_and_swap_8((long *)(void *)(PTR),(long)(OLD),(long)(NEW)))
19 #define __sync_lock_release(PTR) \
20 ((sizeof (*(PTR)) == sizeof(int)) \
21 ? __sync_lock_release_4((int *)(void *)(PTR)) \
22 : __sync_lock_release_8((long *)(void *)(PTR)))
24 #define __sync_lock_test_and_set(PTR,VAL) \
25 ((sizeof (*(PTR)) == sizeof(int)) \
26 ? (__typeof__(*(PTR))) __sync_lock_test_and_set_4((int *)(void *)(PTR),(int)(VAL)) \
27 : (__typeof__(*(PTR))) __sync_lock_test_and_set_8((long *)(void *)(PTR),(long)(VAL)))
29 #define __sync_fetch_and_add(PTR,VAL) \
30 ((sizeof (*(PTR)) == sizeof(int)) \
31 ? (__typeof__(*(PTR))) __sync_fetch_and_add_4((int *)(void *)(PTR),(int)(VAL)) \
32 : (__typeof__(*(PTR))) __sync_fetch_and_add_8((long *)(void *)(PTR),(long)(VAL)))
34 #define __sync_fetch_and_sub(PTR,VAL) \
35 ((sizeof (*(PTR)) == sizeof(int)) \
36 ? (__typeof__(*(PTR))) __sync_fetch_and_sub_4((int *)(void *)(PTR),(int)(VAL)) \
37 : (__typeof__(*(PTR))) __sync_fetch_and_sub_8((long *)(void *)(PTR),(long)(VAL)))
39 #define __sync_fetch_and_and(PTR,VAL) \
40 ((sizeof (*(PTR)) == sizeof(int)) \
41 ? (__typeof__(*(PTR))) __sync_fetch_and_and_4((int *)(void *)(PTR),(int)(VAL)) \
42 : (__typeof__(*(PTR))) __sync_fetch_and_and_8((long *)(void *)(PTR),(long)(VAL)))
44 #define __sync_fetch_and_or(PTR,VAL) \
45 ((sizeof (*(PTR)) == sizeof(int)) \
46 ? (__typeof__(*(PTR))) __sync_fetch_and_or_4((int *)(void *)(PTR),(int)(VAL)) \
47 : (__typeof__(*(PTR))) __sync_fetch_and_or_8((long *)(void *)(PTR),(long)(VAL)))
49 #define __sync_fetch_and_xor(PTR,VAL) \
50 ((sizeof (*(PTR)) == sizeof(int)) \
51 ? (__typeof__(*(PTR))) __sync_fetch_and_xor_4((int *)(void *)(PTR),(int)(VAL)) \
52 : (__typeof__(*(PTR))) __sync_fetch_and_xor_8((long *)(void *)(PTR),(long)(VAL)))
54 #define __sync_fetch_and_nand(PTR,VAL) \
55 ((sizeof (*(PTR)) == sizeof(int)) \
56 ? (__typeof__(*(PTR))) __sync_fetch_and_nand_4((int *)(void *)(PTR),(int)(VAL)) \
57 : (__typeof__(*(PTR))) __sync_fetch_and_nand_8((long *)(void *)(PTR),(long)(VAL)))
59 #define __sync_add_and_fetch(PTR,VAL) \
60 ((sizeof (*(PTR)) == sizeof(int)) \
61 ? (__typeof__(*(PTR))) __sync_add_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
62 : (__typeof__(*(PTR))) __sync_add_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
64 #define __sync_sub_and_fetch(PTR,VAL) \
65 ((sizeof (*(PTR)) == sizeof(int)) \
66 ? (__typeof__(*(PTR))) __sync_sub_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
67 : (__typeof__(*(PTR))) __sync_sub_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
69 #define __sync_and_and_fetch(PTR,VAL) \
70 ((sizeof (*(PTR)) == sizeof(int)) \
71 ? (__typeof__(*(PTR))) __sync_and_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
72 : (__typeof__(*(PTR))) __sync_and_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
74 #define __sync_or_and_fetch(PTR,VAL) \
75 ((sizeof (*(PTR)) == sizeof(int)) \
76 ? (__typeof__(*(PTR))) __sync_or_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
77 : (__typeof__(*(PTR))) __sync_or_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
79 #define __sync_xor_and_fetch(PTR,VAL) \
80 ((sizeof (*(PTR)) == sizeof(int)) \
81 ? (__typeof__(*(PTR))) __sync_xor_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
82 : (__typeof__(*(PTR))) __sync_xor_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
84 #define __sync_nand_and_fetch(PTR,VAL) \
85 ((sizeof (*(PTR)) == sizeof(int)) \
86 ? (__typeof__(*(PTR))) __sync_nand_and_fetch_4((int *)(void *)(PTR),(int)(VAL)) \
87 : (__typeof__(*(PTR))) __sync_nand_and_fetch_8((long *)(void *)(PTR),(long)(VAL)))
89 #endif /* __cplusplus */
91 #endif /* _IA64INTRIN_H_INCLUDED */