Relax constraints on Machine_Attribute argument types:
[official-gcc.git] / gcc / optabs.h
blob096feda7df2b5df4ec32fd0294d7b9a5f7eeb5cb
1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
3 Free Software Foundation, Inc.
5 This file is part of GCC.
7 GCC is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
10 any later version.
12 GCC is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License 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 #ifndef GCC_OPTABS_H
22 #define GCC_OPTABS_H
24 #include "insn-codes.h"
26 /* Optabs are tables saying how to generate insn bodies
27 for various machine modes and numbers of operands.
28 Each optab applies to one operation.
30 For example, add_optab applies to addition.
32 The insn_code slot is the enum insn_code that says how to
33 generate an insn for this operation on a particular machine mode.
34 It is CODE_FOR_nothing if there is no such insn on the target machine.
36 The `lib_call' slot is the name of the library function that
37 can be used to perform the operation.
39 A few optabs, such as move_optab, are used by special code. */
41 struct optab_handlers
43 enum insn_code insn_code;
46 struct optab_d
48 enum rtx_code code;
49 const char *libcall_basename;
50 char libcall_suffix;
51 void (*libcall_gen)(struct optab_d *, const char *name, char suffix,
52 enum machine_mode);
53 struct optab_handlers handlers[NUM_MACHINE_MODES];
55 typedef struct optab_d * optab;
57 /* A convert_optab is for some sort of conversion operation between
58 modes. The first array index is the destination mode, the second
59 is the source mode. */
60 struct convert_optab_d
62 enum rtx_code code;
63 const char *libcall_basename;
64 void (*libcall_gen)(struct convert_optab_d *, const char *name,
65 enum machine_mode,
66 enum machine_mode);
67 struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
69 typedef struct convert_optab_d *convert_optab;
71 /* Given an enum insn_code, access the function to construct
72 the body of that kind of insn. */
73 #define GEN_FCN(CODE) (insn_data[CODE].genfun)
75 /* Enumeration of valid indexes into optab_table. */
76 enum optab_index
78 /* Fixed-point operators with signed/unsigned saturation */
79 OTI_ssadd,
80 OTI_usadd,
81 OTI_sssub,
82 OTI_ussub,
83 OTI_ssmul,
84 OTI_usmul,
85 OTI_ssdiv,
86 OTI_usdiv,
87 OTI_ssneg,
88 OTI_usneg,
89 OTI_ssashl,
90 OTI_usashl,
92 OTI_add,
93 OTI_addv,
94 OTI_sub,
95 OTI_subv,
97 /* Signed and fp multiply */
98 OTI_smul,
99 OTI_smulv,
100 /* Signed multiply, return high word */
101 OTI_smul_highpart,
102 OTI_umul_highpart,
103 /* Signed multiply with result one machine mode wider than args */
104 OTI_smul_widen,
105 OTI_umul_widen,
106 /* Widening multiply of one unsigned and one signed operand. */
107 OTI_usmul_widen,
108 /* Signed multiply and add with the result and addend one machine mode
109 wider than the multiplicand and multiplier. */
110 OTI_smadd_widen,
111 /* Unsigned multiply and add with the result and addend one machine mode
112 wider than the multiplicand and multiplier. */
113 OTI_umadd_widen,
114 /* Signed multiply and add with the result and addend one machine mode
115 wider than the multiplicand and multiplier.
116 All involved operations are saturating. */
117 OTI_ssmadd_widen,
118 /* Unsigned multiply and add with the result and addend one machine mode
119 wider than the multiplicand and multiplier.
120 All involved operations are saturating. */
121 OTI_usmadd_widen,
122 /* Signed multiply and subtract the result and minuend one machine mode
123 wider than the multiplicand and multiplier. */
124 OTI_smsub_widen,
125 /* Unsigned multiply and subtract the result and minuend one machine mode
126 wider than the multiplicand and multiplier. */
127 OTI_umsub_widen,
128 /* Signed multiply and subtract the result and minuend one machine mode
129 wider than the multiplicand and multiplier.
130 All involved operations are saturating. */
131 OTI_ssmsub_widen,
132 /* Unsigned multiply and subtract the result and minuend one machine mode
133 wider than the multiplicand and multiplier.
134 All involved operations are saturating. */
135 OTI_usmsub_widen,
137 /* Signed divide */
138 OTI_sdiv,
139 OTI_sdivv,
140 /* Signed divide-and-remainder in one */
141 OTI_sdivmod,
142 OTI_udiv,
143 OTI_udivmod,
144 /* Signed remainder */
145 OTI_smod,
146 OTI_umod,
147 /* Floating point remainder functions */
148 OTI_fmod,
149 OTI_remainder,
150 /* Convert float to integer in float fmt */
151 OTI_ftrunc,
153 /* Logical and */
154 OTI_and,
155 /* Logical or */
156 OTI_ior,
157 /* Logical xor */
158 OTI_xor,
160 /* Arithmetic shift left */
161 OTI_ashl,
162 /* Logical shift right */
163 OTI_lshr,
164 /* Arithmetic shift right */
165 OTI_ashr,
166 /* Rotate left */
167 OTI_rotl,
168 /* Rotate right */
169 OTI_rotr,
171 /* Arithmetic shift left of vector by vector */
172 OTI_vashl,
173 /* Logical shift right of vector by vector */
174 OTI_vlshr,
175 /* Arithmetic shift right of vector by vector */
176 OTI_vashr,
177 /* Rotate left of vector by vector */
178 OTI_vrotl,
179 /* Rotate right of vector by vector */
180 OTI_vrotr,
182 /* Signed and floating-point minimum value */
183 OTI_smin,
184 /* Signed and floating-point maximum value */
185 OTI_smax,
186 /* Unsigned minimum value */
187 OTI_umin,
188 /* Unsigned maximum value */
189 OTI_umax,
190 /* Power */
191 OTI_pow,
192 /* Arc tangent of y/x */
193 OTI_atan2,
195 /* Move instruction. */
196 OTI_mov,
197 /* Move, preserving high part of register. */
198 OTI_movstrict,
199 /* Move, with a misaligned memory. */
200 OTI_movmisalign,
201 /* Nontemporal store. */
202 OTI_storent,
204 /* Unary operations */
205 /* Negation */
206 OTI_neg,
207 OTI_negv,
208 /* Abs value */
209 OTI_abs,
210 OTI_absv,
211 /* Byteswap */
212 OTI_bswap,
213 /* Bitwise not */
214 OTI_one_cmpl,
215 /* Bit scanning and counting */
216 OTI_ffs,
217 OTI_clz,
218 OTI_ctz,
219 OTI_popcount,
220 OTI_parity,
221 /* Square root */
222 OTI_sqrt,
223 /* Sine-Cosine */
224 OTI_sincos,
225 /* Sine */
226 OTI_sin,
227 /* Inverse sine */
228 OTI_asin,
229 /* Cosine */
230 OTI_cos,
231 /* Inverse cosine */
232 OTI_acos,
233 /* Exponential */
234 OTI_exp,
235 /* Base-10 Exponential */
236 OTI_exp10,
237 /* Base-2 Exponential */
238 OTI_exp2,
239 /* Exponential - 1*/
240 OTI_expm1,
241 /* Load exponent of a floating point number */
242 OTI_ldexp,
243 /* Multiply floating-point number by integral power of radix */
244 OTI_scalb,
245 /* Radix-independent exponent */
246 OTI_logb,
247 OTI_ilogb,
248 /* Natural Logarithm */
249 OTI_log,
250 /* Base-10 Logarithm */
251 OTI_log10,
252 /* Base-2 Logarithm */
253 OTI_log2,
254 /* logarithm of 1 plus argument */
255 OTI_log1p,
256 /* Rounding functions */
257 OTI_floor,
258 OTI_ceil,
259 OTI_btrunc,
260 OTI_round,
261 OTI_nearbyint,
262 OTI_rint,
263 /* Tangent */
264 OTI_tan,
265 /* Inverse tangent */
266 OTI_atan,
267 /* Copy sign */
268 OTI_copysign,
269 /* Signbit */
270 OTI_signbit,
271 /* Test for infinite value */
272 OTI_isinf,
274 /* Compare insn; two operands. Used only for libcalls. */
275 OTI_cmp,
276 OTI_ucmp,
278 /* Floating point comparison optabs - used primarily for libfuncs */
279 OTI_eq,
280 OTI_ne,
281 OTI_gt,
282 OTI_ge,
283 OTI_lt,
284 OTI_le,
285 OTI_unord,
287 /* String length */
288 OTI_strlen,
290 /* Combined compare & jump/move/store flags/trap operations. */
291 OTI_cbranch,
292 OTI_cmov,
293 OTI_cstore,
294 OTI_ctrap,
296 /* Push instruction. */
297 OTI_push,
299 /* Conditional add instruction. */
300 OTI_addcc,
302 /* Reduction operations on a vector operand. */
303 OTI_reduc_smax,
304 OTI_reduc_umax,
305 OTI_reduc_smin,
306 OTI_reduc_umin,
307 OTI_reduc_splus,
308 OTI_reduc_uplus,
310 /* Summation, with result machine mode one or more wider than args. */
311 OTI_ssum_widen,
312 OTI_usum_widen,
314 /* Dot product, with result machine mode one or more wider than args. */
315 OTI_sdot_prod,
316 OTI_udot_prod,
318 /* Set specified field of vector operand. */
319 OTI_vec_set,
320 /* Extract specified field of vector operand. */
321 OTI_vec_extract,
322 /* Extract even/odd fields of vector operands. */
323 OTI_vec_extract_even,
324 OTI_vec_extract_odd,
325 /* Interleave fields of vector operands. */
326 OTI_vec_interleave_high,
327 OTI_vec_interleave_low,
328 /* Initialize vector operand. */
329 OTI_vec_init,
330 /* Whole vector shift. The shift amount is in bits. */
331 OTI_vec_shl,
332 OTI_vec_shr,
333 /* Extract specified elements from vectors, for vector load. */
334 OTI_vec_realign_load,
335 /* Widening multiplication.
336 The high/low part of the resulting vector of products is returned. */
337 OTI_vec_widen_umult_hi,
338 OTI_vec_widen_umult_lo,
339 OTI_vec_widen_smult_hi,
340 OTI_vec_widen_smult_lo,
341 /* Extract and widen the high/low part of a vector of signed or
342 floating point elements. */
343 OTI_vec_unpacks_hi,
344 OTI_vec_unpacks_lo,
345 /* Extract and widen the high/low part of a vector of unsigned
346 elements. */
347 OTI_vec_unpacku_hi,
348 OTI_vec_unpacku_lo,
350 /* Extract, convert to floating point and widen the high/low part of
351 a vector of signed or unsigned integer elements. */
352 OTI_vec_unpacks_float_hi,
353 OTI_vec_unpacks_float_lo,
354 OTI_vec_unpacku_float_hi,
355 OTI_vec_unpacku_float_lo,
357 /* Narrow (demote) and merge the elements of two vectors. */
358 OTI_vec_pack_trunc,
359 OTI_vec_pack_usat,
360 OTI_vec_pack_ssat,
362 /* Convert to signed/unsigned integer, narrow and merge elements
363 of two vectors of floating point elements. */
364 OTI_vec_pack_sfix_trunc,
365 OTI_vec_pack_ufix_trunc,
367 /* Perform a raise to the power of integer. */
368 OTI_powi,
370 OTI_MAX
373 extern struct optab_d optab_table[OTI_MAX];
375 #define ssadd_optab (&optab_table[OTI_ssadd])
376 #define usadd_optab (&optab_table[OTI_usadd])
377 #define sssub_optab (&optab_table[OTI_sssub])
378 #define ussub_optab (&optab_table[OTI_ussub])
379 #define ssmul_optab (&optab_table[OTI_ssmul])
380 #define usmul_optab (&optab_table[OTI_usmul])
381 #define ssdiv_optab (&optab_table[OTI_ssdiv])
382 #define usdiv_optab (&optab_table[OTI_usdiv])
383 #define ssneg_optab (&optab_table[OTI_ssneg])
384 #define usneg_optab (&optab_table[OTI_usneg])
385 #define ssashl_optab (&optab_table[OTI_ssashl])
386 #define usashl_optab (&optab_table[OTI_usashl])
388 #define add_optab (&optab_table[OTI_add])
389 #define sub_optab (&optab_table[OTI_sub])
390 #define smul_optab (&optab_table[OTI_smul])
391 #define addv_optab (&optab_table[OTI_addv])
392 #define subv_optab (&optab_table[OTI_subv])
393 #define smul_highpart_optab (&optab_table[OTI_smul_highpart])
394 #define umul_highpart_optab (&optab_table[OTI_umul_highpart])
395 #define smul_widen_optab (&optab_table[OTI_smul_widen])
396 #define umul_widen_optab (&optab_table[OTI_umul_widen])
397 #define usmul_widen_optab (&optab_table[OTI_usmul_widen])
398 #define smadd_widen_optab (&optab_table[OTI_smadd_widen])
399 #define umadd_widen_optab (&optab_table[OTI_umadd_widen])
400 #define ssmadd_widen_optab (&optab_table[OTI_ssmadd_widen])
401 #define usmadd_widen_optab (&optab_table[OTI_usmadd_widen])
402 #define smsub_widen_optab (&optab_table[OTI_smsub_widen])
403 #define umsub_widen_optab (&optab_table[OTI_umsub_widen])
404 #define ssmsub_widen_optab (&optab_table[OTI_ssmsub_widen])
405 #define usmsub_widen_optab (&optab_table[OTI_usmsub_widen])
406 #define sdiv_optab (&optab_table[OTI_sdiv])
407 #define smulv_optab (&optab_table[OTI_smulv])
408 #define sdivv_optab (&optab_table[OTI_sdivv])
409 #define sdivmod_optab (&optab_table[OTI_sdivmod])
410 #define udiv_optab (&optab_table[OTI_udiv])
411 #define udivmod_optab (&optab_table[OTI_udivmod])
412 #define smod_optab (&optab_table[OTI_smod])
413 #define umod_optab (&optab_table[OTI_umod])
414 #define fmod_optab (&optab_table[OTI_fmod])
415 #define remainder_optab (&optab_table[OTI_remainder])
416 #define ftrunc_optab (&optab_table[OTI_ftrunc])
417 #define and_optab (&optab_table[OTI_and])
418 #define ior_optab (&optab_table[OTI_ior])
419 #define xor_optab (&optab_table[OTI_xor])
420 #define ashl_optab (&optab_table[OTI_ashl])
421 #define lshr_optab (&optab_table[OTI_lshr])
422 #define ashr_optab (&optab_table[OTI_ashr])
423 #define rotl_optab (&optab_table[OTI_rotl])
424 #define rotr_optab (&optab_table[OTI_rotr])
425 #define vashl_optab (&optab_table[OTI_vashl])
426 #define vlshr_optab (&optab_table[OTI_vlshr])
427 #define vashr_optab (&optab_table[OTI_vashr])
428 #define vrotl_optab (&optab_table[OTI_vrotl])
429 #define vrotr_optab (&optab_table[OTI_vrotr])
430 #define smin_optab (&optab_table[OTI_smin])
431 #define smax_optab (&optab_table[OTI_smax])
432 #define umin_optab (&optab_table[OTI_umin])
433 #define umax_optab (&optab_table[OTI_umax])
434 #define pow_optab (&optab_table[OTI_pow])
435 #define atan2_optab (&optab_table[OTI_atan2])
437 #define mov_optab (&optab_table[OTI_mov])
438 #define movstrict_optab (&optab_table[OTI_movstrict])
439 #define movmisalign_optab (&optab_table[OTI_movmisalign])
440 #define storent_optab (&optab_table[OTI_storent])
442 #define neg_optab (&optab_table[OTI_neg])
443 #define negv_optab (&optab_table[OTI_negv])
444 #define abs_optab (&optab_table[OTI_abs])
445 #define absv_optab (&optab_table[OTI_absv])
446 #define one_cmpl_optab (&optab_table[OTI_one_cmpl])
447 #define bswap_optab (&optab_table[OTI_bswap])
448 #define ffs_optab (&optab_table[OTI_ffs])
449 #define clz_optab (&optab_table[OTI_clz])
450 #define ctz_optab (&optab_table[OTI_ctz])
451 #define popcount_optab (&optab_table[OTI_popcount])
452 #define parity_optab (&optab_table[OTI_parity])
453 #define sqrt_optab (&optab_table[OTI_sqrt])
454 #define sincos_optab (&optab_table[OTI_sincos])
455 #define sin_optab (&optab_table[OTI_sin])
456 #define asin_optab (&optab_table[OTI_asin])
457 #define cos_optab (&optab_table[OTI_cos])
458 #define acos_optab (&optab_table[OTI_acos])
459 #define exp_optab (&optab_table[OTI_exp])
460 #define exp10_optab (&optab_table[OTI_exp10])
461 #define exp2_optab (&optab_table[OTI_exp2])
462 #define expm1_optab (&optab_table[OTI_expm1])
463 #define ldexp_optab (&optab_table[OTI_ldexp])
464 #define scalb_optab (&optab_table[OTI_scalb])
465 #define logb_optab (&optab_table[OTI_logb])
466 #define ilogb_optab (&optab_table[OTI_ilogb])
467 #define log_optab (&optab_table[OTI_log])
468 #define log10_optab (&optab_table[OTI_log10])
469 #define log2_optab (&optab_table[OTI_log2])
470 #define log1p_optab (&optab_table[OTI_log1p])
471 #define floor_optab (&optab_table[OTI_floor])
472 #define ceil_optab (&optab_table[OTI_ceil])
473 #define btrunc_optab (&optab_table[OTI_btrunc])
474 #define round_optab (&optab_table[OTI_round])
475 #define nearbyint_optab (&optab_table[OTI_nearbyint])
476 #define rint_optab (&optab_table[OTI_rint])
477 #define tan_optab (&optab_table[OTI_tan])
478 #define atan_optab (&optab_table[OTI_atan])
479 #define copysign_optab (&optab_table[OTI_copysign])
480 #define signbit_optab (&optab_table[OTI_signbit])
481 #define isinf_optab (&optab_table[OTI_isinf])
483 #define cmp_optab (&optab_table[OTI_cmp])
484 #define ucmp_optab (&optab_table[OTI_ucmp])
486 #define eq_optab (&optab_table[OTI_eq])
487 #define ne_optab (&optab_table[OTI_ne])
488 #define gt_optab (&optab_table[OTI_gt])
489 #define ge_optab (&optab_table[OTI_ge])
490 #define lt_optab (&optab_table[OTI_lt])
491 #define le_optab (&optab_table[OTI_le])
492 #define unord_optab (&optab_table[OTI_unord])
494 #define strlen_optab (&optab_table[OTI_strlen])
496 #define cbranch_optab (&optab_table[OTI_cbranch])
497 #define cmov_optab (&optab_table[OTI_cmov])
498 #define cstore_optab (&optab_table[OTI_cstore])
499 #define ctrap_optab (&optab_table[OTI_ctrap])
501 #define push_optab (&optab_table[OTI_push])
502 #define addcc_optab (&optab_table[OTI_addcc])
504 #define reduc_smax_optab (&optab_table[OTI_reduc_smax])
505 #define reduc_umax_optab (&optab_table[OTI_reduc_umax])
506 #define reduc_smin_optab (&optab_table[OTI_reduc_smin])
507 #define reduc_umin_optab (&optab_table[OTI_reduc_umin])
508 #define reduc_splus_optab (&optab_table[OTI_reduc_splus])
509 #define reduc_uplus_optab (&optab_table[OTI_reduc_uplus])
511 #define ssum_widen_optab (&optab_table[OTI_ssum_widen])
512 #define usum_widen_optab (&optab_table[OTI_usum_widen])
513 #define sdot_prod_optab (&optab_table[OTI_sdot_prod])
514 #define udot_prod_optab (&optab_table[OTI_udot_prod])
516 #define vec_set_optab (&optab_table[OTI_vec_set])
517 #define vec_extract_optab (&optab_table[OTI_vec_extract])
518 #define vec_extract_even_optab (&optab_table[OTI_vec_extract_even])
519 #define vec_extract_odd_optab (&optab_table[OTI_vec_extract_odd])
520 #define vec_interleave_high_optab (&optab_table[OTI_vec_interleave_high])
521 #define vec_interleave_low_optab (&optab_table[OTI_vec_interleave_low])
522 #define vec_init_optab (&optab_table[OTI_vec_init])
523 #define vec_shl_optab (&optab_table[OTI_vec_shl])
524 #define vec_shr_optab (&optab_table[OTI_vec_shr])
525 #define vec_realign_load_optab (&optab_table[OTI_vec_realign_load])
526 #define vec_widen_umult_hi_optab (&optab_table[OTI_vec_widen_umult_hi])
527 #define vec_widen_umult_lo_optab (&optab_table[OTI_vec_widen_umult_lo])
528 #define vec_widen_smult_hi_optab (&optab_table[OTI_vec_widen_smult_hi])
529 #define vec_widen_smult_lo_optab (&optab_table[OTI_vec_widen_smult_lo])
530 #define vec_unpacks_hi_optab (&optab_table[OTI_vec_unpacks_hi])
531 #define vec_unpacks_lo_optab (&optab_table[OTI_vec_unpacks_lo])
532 #define vec_unpacku_hi_optab (&optab_table[OTI_vec_unpacku_hi])
533 #define vec_unpacku_lo_optab (&optab_table[OTI_vec_unpacku_lo])
534 #define vec_unpacks_float_hi_optab (&optab_table[OTI_vec_unpacks_float_hi])
535 #define vec_unpacks_float_lo_optab (&optab_table[OTI_vec_unpacks_float_lo])
536 #define vec_unpacku_float_hi_optab (&optab_table[OTI_vec_unpacku_float_hi])
537 #define vec_unpacku_float_lo_optab (&optab_table[OTI_vec_unpacku_float_lo])
538 #define vec_pack_trunc_optab (&optab_table[OTI_vec_pack_trunc])
539 #define vec_pack_ssat_optab (&optab_table[OTI_vec_pack_ssat])
540 #define vec_pack_usat_optab (&optab_table[OTI_vec_pack_usat])
541 #define vec_pack_sfix_trunc_optab (&optab_table[OTI_vec_pack_sfix_trunc])
542 #define vec_pack_ufix_trunc_optab (&optab_table[OTI_vec_pack_ufix_trunc])
544 #define powi_optab (&optab_table[OTI_powi])
546 /* Conversion optabs have their own table and indexes. */
547 enum convert_optab_index
549 COI_sext,
550 COI_zext,
551 COI_trunc,
553 COI_sfix,
554 COI_ufix,
556 COI_sfixtrunc,
557 COI_ufixtrunc,
559 COI_sfloat,
560 COI_ufloat,
562 COI_lrint,
563 COI_lround,
564 COI_lfloor,
565 COI_lceil,
567 COI_fract,
568 COI_fractuns,
569 COI_satfract,
570 COI_satfractuns,
572 COI_MAX
575 extern struct convert_optab_d convert_optab_table[COI_MAX];
577 #define sext_optab (&convert_optab_table[COI_sext])
578 #define zext_optab (&convert_optab_table[COI_zext])
579 #define trunc_optab (&convert_optab_table[COI_trunc])
580 #define sfix_optab (&convert_optab_table[COI_sfix])
581 #define ufix_optab (&convert_optab_table[COI_ufix])
582 #define sfixtrunc_optab (&convert_optab_table[COI_sfixtrunc])
583 #define ufixtrunc_optab (&convert_optab_table[COI_ufixtrunc])
584 #define sfloat_optab (&convert_optab_table[COI_sfloat])
585 #define ufloat_optab (&convert_optab_table[COI_ufloat])
586 #define lrint_optab (&convert_optab_table[COI_lrint])
587 #define lround_optab (&convert_optab_table[COI_lround])
588 #define lfloor_optab (&convert_optab_table[COI_lfloor])
589 #define lceil_optab (&convert_optab_table[COI_lceil])
590 #define fract_optab (&convert_optab_table[COI_fract])
591 #define fractuns_optab (&convert_optab_table[COI_fractuns])
592 #define satfract_optab (&convert_optab_table[COI_satfract])
593 #define satfractuns_optab (&convert_optab_table[COI_satfractuns])
595 /* These arrays record the insn_code of insns that may be needed to
596 perform input and output reloads of special objects. They provide a
597 place to pass a scratch register. */
598 extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
599 extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
601 /* Contains the optab used for each rtx code. */
602 extern optab code_to_optab[NUM_RTX_CODE + 1];
605 typedef rtx (*rtxfun) (rtx);
607 #ifdef HAVE_conditional_move
608 /* Indexed by the machine mode, gives the insn code to make a conditional
609 move insn. */
611 extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
612 #endif
614 /* Indexed by the machine mode, gives the insn code for vector conditional
615 operation. */
617 extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
618 extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
620 /* This array records the insn_code of insns to perform block moves. */
621 extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
623 /* This array records the insn_code of insns to perform block sets. */
624 extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
626 /* These arrays record the insn_code of two different kinds of insns
627 to perform block compares. */
628 extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
629 extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
630 extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
632 /* Synchronization primitives. This first set is atomic operation for
633 which we don't care about the resulting value. */
634 extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
635 extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
636 extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
637 extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
638 extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
639 extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
641 /* This second set is atomic operations in which we return the value
642 that existed in memory before the operation. */
643 extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
644 extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
645 extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
646 extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
647 extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
648 extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
650 /* This third set is atomic operations in which we return the value
651 that resulted after performing the operation. */
652 extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
653 extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
654 extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
655 extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
656 extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
657 extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
659 /* Atomic compare and swap. */
660 extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
662 /* Atomic exchange with acquire semantics. */
663 extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
665 /* Atomic clear with release semantics. */
666 extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
668 /* Define functions given in optabs.c. */
670 extern rtx expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op,
671 rtx target, int unsignedp);
673 extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
674 rtx op0, rtx op1, rtx op2, rtx target,
675 int unsignedp);
677 /* Expand a binary operation given optab and rtx operands. */
678 extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
679 enum optab_methods);
681 extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
682 enum optab_methods);
684 /* Expand a binary operation with both signed and unsigned forms. */
685 extern rtx sign_expand_binop (enum machine_mode, optab, optab, rtx, rtx,
686 rtx, int, enum optab_methods);
688 /* Generate code to perform an operation on one operand with two results. */
689 extern int expand_twoval_unop (optab, rtx, rtx, rtx, int);
691 /* Generate code to perform an operation on two operands with two results. */
692 extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int);
694 /* Generate code to perform an operation on two operands with two
695 results, using a library function. */
696 extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx,
697 enum rtx_code);
699 /* Expand a unary arithmetic operation given optab rtx operand. */
700 extern rtx expand_unop (enum machine_mode, optab, rtx, rtx, int);
702 /* Expand the absolute value operation. */
703 extern rtx expand_abs_nojump (enum machine_mode, rtx, rtx, int);
704 extern rtx expand_abs (enum machine_mode, rtx, rtx, int, int);
706 /* Expand the copysign operation. */
707 extern rtx expand_copysign (rtx, rtx, rtx);
709 /* Generate an instruction with a given INSN_CODE with an output and
710 an input. */
711 extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
712 extern bool maybe_emit_unop_insn (int, rtx, rtx, enum rtx_code);
714 /* An extra flag to control optab_for_tree_code's behavior. This is needed to
715 distinguish between machines with a vector shift that takes a scalar for the
716 shift amount vs. machines that take a vector for the shift amount. */
717 enum optab_subtype
719 optab_default,
720 optab_scalar,
721 optab_vector
724 /* Return the optab used for computing the given operation on the type given by
725 the second argument. The third argument distinguishes between the types of
726 vector shifts and rotates */
727 extern optab optab_for_tree_code (enum tree_code, const_tree, enum optab_subtype);
729 /* The various uses that a comparison can have; used by can_compare_p:
730 jumps, conditional moves, store flag operations. */
731 enum can_compare_purpose
733 ccp_jump,
734 ccp_cmov,
735 ccp_store_flag
738 /* Nonzero if a compare of mode MODE can be done straightforwardly
739 (without splitting it into pieces). */
740 extern int can_compare_p (enum rtx_code, enum machine_mode,
741 enum can_compare_purpose);
743 /* Return the INSN_CODE to use for an extend operation. */
744 extern enum insn_code can_extend_p (enum machine_mode, enum machine_mode, int);
746 /* Generate the body of an insn to extend Y (with mode MFROM)
747 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
748 extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
749 enum machine_mode, int);
751 /* Call this to reset the function entry for one optab. */
752 extern void set_optab_libfunc (optab, enum machine_mode, const char *);
753 extern void set_conv_libfunc (convert_optab, enum machine_mode,
754 enum machine_mode, const char *);
756 /* Generate code for a FIXED_CONVERT_EXPR. */
757 extern void expand_fixed_convert (rtx, rtx, int, int);
759 /* Generate code for a FLOAT_EXPR. */
760 extern void expand_float (rtx, rtx, int);
762 /* Generate code for a FIX_EXPR. */
763 extern void expand_fix (rtx, rtx, int);
765 /* Generate code for float to integral conversion. */
766 extern bool expand_sfix_optab (rtx, rtx, convert_optab);
768 /* Return tree if target supports vector operations for COND_EXPR. */
769 bool expand_vec_cond_expr_p (tree, enum machine_mode);
771 /* Generate code for VEC_COND_EXPR. */
772 extern rtx expand_vec_cond_expr (tree, rtx);
774 /* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
775 extern rtx expand_vec_shift_expr (tree, rtx);
777 #define optab_handler(optab,mode) (&(optab)->handlers[(int) (mode)])
778 #define convert_optab_handler(optab,mode,mode2) \
779 (&(optab)->handlers[(int) (mode)][(int) (mode2)])
781 extern rtx optab_libfunc (optab optab, enum machine_mode mode);
782 extern rtx optab_libfunc (optab optab, enum machine_mode mode);
783 extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
784 enum machine_mode mode2);
785 #endif /* GCC_OPTABS_H */