* toplev.h (floor_log2): If GCC_VERSION >= 3004, declare as static
[official-gcc.git] / gcc / sync-builtins.def
blob86cb0aa3f162b45e3673a3b8fadd46999f50f18f
1 /* This file contains the definitions and documentation for the
2 synchronization builtins used in the GNU compiler.
3 Copyright (C) 2005, 2007 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 3, or (at your option) any later
10 version.
12 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
17 You should have received a copy of the GNU General Public License
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
21 /* Before including this file, you should define a macro:
23 DEF_SYNC_BUILTIN (ENUM, NAME, TYPE, ATTRS)
25 See builtins.def for details. */
27 /* Synchronization Primitives. The "_N" version is the one that the user
28 is supposed to be using. It's overloaded, and is resolved to one of the
29 "_1" through "_16" versions, plus some extra casts. */
31 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_N, "__sync_fetch_and_add",
32 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
33 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_1, "__sync_fetch_and_add_1",
34 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
35 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_2, "__sync_fetch_and_add_2",
36 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
37 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_4, "__sync_fetch_and_add_4",
38 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
39 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_8, "__sync_fetch_and_add_8",
40 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
41 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_ADD_16, "__sync_fetch_and_add_16",
42 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
44 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_N, "__sync_fetch_and_sub",
45 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
46 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_1, "__sync_fetch_and_sub_1",
47 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
48 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_2, "__sync_fetch_and_sub_2",
49 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
50 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_4, "__sync_fetch_and_sub_4",
51 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
52 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_8, "__sync_fetch_and_sub_8",
53 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
54 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_SUB_16, "__sync_fetch_and_sub_16",
55 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
57 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_N, "__sync_fetch_and_or",
58 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
59 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_1, "__sync_fetch_and_or_1",
60 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
61 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_2, "__sync_fetch_and_or_2",
62 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
63 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_4, "__sync_fetch_and_or_4",
64 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
65 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_8, "__sync_fetch_and_or_8",
66 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
67 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_OR_16, "__sync_fetch_and_or_16",
68 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
70 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_N, "__sync_fetch_and_and",
71 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
72 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_1, "__sync_fetch_and_and_1",
73 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
74 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_2, "__sync_fetch_and_and_2",
75 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
76 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_4, "__sync_fetch_and_and_4",
77 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
78 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_8, "__sync_fetch_and_and_8",
79 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
80 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_AND_16, "__sync_fetch_and_and_16",
81 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
83 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_N, "__sync_fetch_and_xor",
84 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
85 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_1, "__sync_fetch_and_xor_1",
86 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
87 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_2, "__sync_fetch_and_xor_2",
88 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
89 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_4, "__sync_fetch_and_xor_4",
90 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
91 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_8, "__sync_fetch_and_xor_8",
92 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
93 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_XOR_16, "__sync_fetch_and_xor_16",
94 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
96 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_N, "__sync_fetch_and_nand",
97 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
98 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_1, "__sync_fetch_and_nand_1",
99 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
100 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_2, "__sync_fetch_and_nand_2",
101 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
102 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_4, "__sync_fetch_and_nand_4",
103 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
104 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_8, "__sync_fetch_and_nand_8",
105 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
106 DEF_SYNC_BUILTIN (BUILT_IN_FETCH_AND_NAND_16, "__sync_fetch_and_nand_16",
107 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
109 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_N, "__sync_add_and_fetch",
110 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
111 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_1, "__sync_add_and_fetch_1",
112 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
113 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_2, "__sync_add_and_fetch_2",
114 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
115 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_4, "__sync_add_and_fetch_4",
116 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
117 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_8, "__sync_add_and_fetch_8",
118 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
119 DEF_SYNC_BUILTIN (BUILT_IN_ADD_AND_FETCH_16, "__sync_add_and_fetch_16",
120 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
122 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_N, "__sync_sub_and_fetch",
123 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
124 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_1, "__sync_sub_and_fetch_1",
125 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
126 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_2, "__sync_sub_and_fetch_2",
127 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
128 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_4, "__sync_sub_and_fetch_4",
129 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
130 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_8, "__sync_sub_and_fetch_8",
131 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
132 DEF_SYNC_BUILTIN (BUILT_IN_SUB_AND_FETCH_16, "__sync_sub_and_fetch_16",
133 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
135 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_N, "__sync_or_and_fetch",
136 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
137 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_1, "__sync_or_and_fetch_1",
138 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
139 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_2, "__sync_or_and_fetch_2",
140 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
141 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_4, "__sync_or_and_fetch_4",
142 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
143 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_8, "__sync_or_and_fetch_8",
144 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
145 DEF_SYNC_BUILTIN (BUILT_IN_OR_AND_FETCH_16, "__sync_or_and_fetch_16",
146 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
148 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_N, "__sync_and_and_fetch",
149 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
150 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_1, "__sync_and_and_fetch_1",
151 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
152 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_2, "__sync_and_and_fetch_2",
153 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
154 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_4, "__sync_and_and_fetch_4",
155 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
156 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_8, "__sync_and_and_fetch_8",
157 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
158 DEF_SYNC_BUILTIN (BUILT_IN_AND_AND_FETCH_16, "__sync_and_and_fetch_16",
159 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
161 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_N, "__sync_xor_and_fetch",
162 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
163 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_1, "__sync_xor_and_fetch_1",
164 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
165 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_2, "__sync_xor_and_fetch_2",
166 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
167 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_4, "__sync_xor_and_fetch_4",
168 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
169 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_8, "__sync_xor_and_fetch_8",
170 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
171 DEF_SYNC_BUILTIN (BUILT_IN_XOR_AND_FETCH_16, "__sync_xor_and_fetch_16",
172 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
174 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_N, "__sync_nand_and_fetch",
175 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
176 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_1, "__sync_nand_and_fetch_1",
177 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
178 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_2, "__sync_nand_and_fetch_2",
179 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
180 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_4, "__sync_nand_and_fetch_4",
181 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
182 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_8, "__sync_nand_and_fetch_8",
183 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
184 DEF_SYNC_BUILTIN (BUILT_IN_NAND_AND_FETCH_16, "__sync_nand_and_fetch_16",
185 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
187 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_N,
188 "__sync_bool_compare_and_swap",
189 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
190 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_1,
191 "__sync_bool_compare_and_swap_1",
192 BT_FN_BOOL_VPTR_I1_I1, ATTR_NOTHROW_LIST)
193 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_2,
194 "__sync_bool_compare_and_swap_2",
195 BT_FN_BOOL_VPTR_I2_I2, ATTR_NOTHROW_LIST)
196 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_4,
197 "__sync_bool_compare_and_swap_4",
198 BT_FN_BOOL_VPTR_I4_I4, ATTR_NOTHROW_LIST)
199 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_8,
200 "__sync_bool_compare_and_swap_8",
201 BT_FN_BOOL_VPTR_I8_I8, ATTR_NOTHROW_LIST)
202 DEF_SYNC_BUILTIN (BUILT_IN_BOOL_COMPARE_AND_SWAP_16,
203 "__sync_bool_compare_and_swap_16",
204 BT_FN_BOOL_VPTR_I16_I16, ATTR_NOTHROW_LIST)
206 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_N,
207 "__sync_val_compare_and_swap",
208 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
209 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_1,
210 "__sync_val_compare_and_swap_1",
211 BT_FN_I1_VPTR_I1_I1, ATTR_NOTHROW_LIST)
212 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_2,
213 "__sync_val_compare_and_swap_2",
214 BT_FN_I2_VPTR_I2_I2, ATTR_NOTHROW_LIST)
215 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_4,
216 "__sync_val_compare_and_swap_4",
217 BT_FN_I4_VPTR_I4_I4, ATTR_NOTHROW_LIST)
218 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_8,
219 "__sync_val_compare_and_swap_8",
220 BT_FN_I8_VPTR_I8_I8, ATTR_NOTHROW_LIST)
221 DEF_SYNC_BUILTIN (BUILT_IN_VAL_COMPARE_AND_SWAP_16,
222 "__sync_val_compare_and_swap_16",
223 BT_FN_I16_VPTR_I16_I16, ATTR_NOTHROW_LIST)
225 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_N, "__sync_lock_test_and_set",
226 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
227 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_1, "__sync_lock_test_and_set_1",
228 BT_FN_I1_VPTR_I1, ATTR_NOTHROW_LIST)
229 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_2, "__sync_lock_test_and_set_2",
230 BT_FN_I2_VPTR_I2, ATTR_NOTHROW_LIST)
231 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_4, "__sync_lock_test_and_set_4",
232 BT_FN_I4_VPTR_I4, ATTR_NOTHROW_LIST)
233 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_8, "__sync_lock_test_and_set_8",
234 BT_FN_I8_VPTR_I8, ATTR_NOTHROW_LIST)
235 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_TEST_AND_SET_16, "__sync_lock_test_and_set_16",
236 BT_FN_I16_VPTR_I16, ATTR_NOTHROW_LIST)
238 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_N, "__sync_lock_release",
239 BT_FN_VOID_VAR, ATTR_NOTHROW_LIST)
240 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_1, "__sync_lock_release_1",
241 BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
242 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_2, "__sync_lock_release_2",
243 BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
244 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_4, "__sync_lock_release_4",
245 BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
246 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_8, "__sync_lock_release_8",
247 BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
248 DEF_SYNC_BUILTIN (BUILT_IN_LOCK_RELEASE_16, "__sync_lock_release_16",
249 BT_FN_VOID_VPTR, ATTR_NOTHROW_LIST)
251 DEF_SYNC_BUILTIN (BUILT_IN_SYNCHRONIZE, "__sync_synchronize",
252 BT_FN_VOID, ATTR_NOTHROW_LIST)