OSDN Git Service

* optabs.c (debug_optab_libfunc): Update; make available to gdb.
[pf3gnuchains/gcc-fork.git] / gcc / optabs.h
1 /* Definitions for code generation pass of GNU compiler.
2    Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
3    Free Software Foundation, Inc.
4
5 This file is part of GCC.
6
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.
11
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.
16
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/>.  */
20
21 #ifndef GCC_OPTABS_H
22 #define GCC_OPTABS_H
23
24 #include "insn-codes.h"
25
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.
29
30    For example, add_optab applies to addition.
31
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.
35
36    The `lib_call' slot is the name of the library function that
37    can be used to perform the operation.
38
39    A few optabs, such as move_optab and cmp_optab, are used
40    by special code.  */
41
42 struct optab_handlers
43 {
44   enum insn_code insn_code;
45 };
46
47 struct optab
48 {
49   enum rtx_code code;
50   const char *libcall_basename;
51   char libcall_suffix;
52   void (*libcall_gen)(struct optab *, const char *name, char suffix, enum machine_mode);
53   struct optab_handlers handlers[NUM_MACHINE_MODES];
54 };
55 typedef struct optab * optab;
56
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
61 {
62   enum rtx_code code;
63   const char *libcall_basename;
64   void (*libcall_gen)(struct convert_optab *, const char *name,
65                       enum machine_mode,
66                       enum machine_mode);
67   struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
68 };
69 typedef struct convert_optab *convert_optab;
70
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)
74
75 /* Enumeration of valid indexes into optab_table.  */
76 enum optab_index
77 {
78   OTI_add,
79   OTI_addv,
80   OTI_sub,
81   OTI_subv,
82
83   /* Signed and fp multiply */
84   OTI_smul,
85   OTI_smulv,
86   /* Signed multiply, return high word */
87   OTI_smul_highpart,
88   OTI_umul_highpart,
89   /* Signed multiply with result one machine mode wider than args */
90   OTI_smul_widen,
91   OTI_umul_widen,
92   /* Widening multiply of one unsigned and one signed operand.  */
93   OTI_usmul_widen,
94   /* Signed multiply and add with the result and addend one machine mode
95      wider than the multiplicand and multiplier.  */
96   OTI_smadd_widen,
97   /* Unsigned multiply and add with the result and addend one machine mode
98      wider than the multiplicand and multiplier.  */
99   OTI_umadd_widen,
100   /* Signed multiply and subtract the result and minuend one machine mode
101      wider than the multiplicand and multiplier.  */
102   OTI_smsub_widen,
103   /* Unsigned multiply and subtract the result and minuend one machine mode
104      wider than the multiplicand and multiplier.  */
105   OTI_umsub_widen,
106
107   /* Signed divide */
108   OTI_sdiv,
109   OTI_sdivv,
110   /* Signed divide-and-remainder in one */
111   OTI_sdivmod,
112   OTI_udiv,
113   OTI_udivmod,
114   /* Signed remainder */
115   OTI_smod,
116   OTI_umod,
117   /* Floating point remainder functions */
118   OTI_fmod,
119   OTI_remainder,
120   /* Convert float to integer in float fmt */
121   OTI_ftrunc,
122
123   /* Logical and */
124   OTI_and,
125   /* Logical or */
126   OTI_ior,
127   /* Logical xor */
128   OTI_xor,
129
130   /* Arithmetic shift left */
131   OTI_ashl,
132   /* Logical shift right */
133   OTI_lshr,
134   /* Arithmetic shift right */
135   OTI_ashr,
136   /* Rotate left */
137   OTI_rotl,
138   /* Rotate right */
139   OTI_rotr,
140   /* Signed and floating-point minimum value */
141   OTI_smin,
142   /* Signed and floating-point maximum value */
143   OTI_smax,
144   /* Unsigned minimum value */
145   OTI_umin,
146   /* Unsigned maximum value */
147   OTI_umax,
148   /* Power */
149   OTI_pow,
150   /* Arc tangent of y/x */
151   OTI_atan2,
152
153   /* Move instruction.  */
154   OTI_mov,
155   /* Move, preserving high part of register.  */
156   OTI_movstrict,
157   /* Move, with a misaligned memory.  */
158   OTI_movmisalign,
159   /* Nontemporal store.  */
160   OTI_storent,
161
162   /* Unary operations */
163   /* Negation */
164   OTI_neg,
165   OTI_negv,
166   /* Abs value */
167   OTI_abs,
168   OTI_absv,
169   /* Byteswap */
170   OTI_bswap,
171   /* Bitwise not */
172   OTI_one_cmpl,
173   /* Bit scanning and counting */
174   OTI_ffs,
175   OTI_clz,
176   OTI_ctz,
177   OTI_popcount,
178   OTI_parity,
179   /* Square root */
180   OTI_sqrt,
181   /* Sine-Cosine */
182   OTI_sincos,
183   /* Sine */
184   OTI_sin,
185   /* Inverse sine */
186   OTI_asin,
187   /* Cosine */
188   OTI_cos,
189   /* Inverse cosine */
190   OTI_acos,
191   /* Exponential */
192   OTI_exp,
193   /* Base-10 Exponential */
194   OTI_exp10,
195   /* Base-2 Exponential */
196   OTI_exp2,
197   /* Exponential - 1*/
198   OTI_expm1,
199   /* Load exponent of a floating point number */
200   OTI_ldexp,
201   /* Multiply floating-point number by integral power of radix */
202   OTI_scalb,
203   /* Radix-independent exponent */
204   OTI_logb,
205   OTI_ilogb,
206   /* Natural Logarithm */
207   OTI_log,
208   /* Base-10 Logarithm */
209   OTI_log10,
210   /* Base-2 Logarithm */
211   OTI_log2,
212   /* logarithm of 1 plus argument */
213   OTI_log1p,
214   /* Rounding functions */
215   OTI_floor,
216   OTI_ceil,
217   OTI_btrunc,
218   OTI_round,
219   OTI_nearbyint,
220   OTI_rint,
221   /* Tangent */
222   OTI_tan,
223   /* Inverse tangent */
224   OTI_atan,
225   /* Copy sign */
226   OTI_copysign,
227   /* Signbit */
228   OTI_signbit,
229   /* Test for infinite value */
230   OTI_isinf,
231
232   /* Compare insn; two operands.  */
233   OTI_cmp,
234   /* Used only for libcalls for unsigned comparisons.  */
235   OTI_ucmp,
236   /* tst insn; compare one operand against 0 */
237   OTI_tst,
238
239   /* Floating point comparison optabs - used primarily for libfuncs */
240   OTI_eq,
241   OTI_ne,
242   OTI_gt,
243   OTI_ge,
244   OTI_lt,
245   OTI_le,
246   OTI_unord,
247
248   /* String length */
249   OTI_strlen,
250
251   /* Combined compare & jump/store flags/move operations.  */
252   OTI_cbranch,
253   OTI_cmov,
254   OTI_cstore,
255
256   /* Push instruction.  */
257   OTI_push,
258
259   /* Conditional add instruction.  */
260   OTI_addcc,
261
262   /* Reduction operations on a vector operand.  */
263   OTI_reduc_smax,
264   OTI_reduc_umax,
265   OTI_reduc_smin,
266   OTI_reduc_umin,
267   OTI_reduc_splus,
268   OTI_reduc_uplus,
269
270   /* Summation, with result machine mode one or more wider than args.  */
271   OTI_ssum_widen,
272   OTI_usum_widen,
273
274   /* Dot product, with result machine mode one or more wider than args.  */
275   OTI_sdot_prod,
276   OTI_udot_prod,
277
278   /* Set specified field of vector operand.  */
279   OTI_vec_set,
280   /* Extract specified field of vector operand.  */
281   OTI_vec_extract,
282   /* Extract even/odd fields of vector operands.  */
283   OTI_vec_extract_even,
284   OTI_vec_extract_odd,
285   /* Interleave fields of vector operands.  */
286   OTI_vec_interleave_high,
287   OTI_vec_interleave_low,
288   /* Initialize vector operand.  */
289   OTI_vec_init,
290   /* Whole vector shift. The shift amount is in bits.  */
291   OTI_vec_shl,
292   OTI_vec_shr,
293   /* Extract specified elements from vectors, for vector load.  */
294   OTI_vec_realign_load,
295   /* Widening multiplication.  
296      The high/low part of the resulting vector of products is returned.  */
297   OTI_vec_widen_umult_hi,
298   OTI_vec_widen_umult_lo,
299   OTI_vec_widen_smult_hi,
300   OTI_vec_widen_smult_lo,
301   /* Extract and widen the high/low part of a vector of signed or
302      floating point elements.  */
303   OTI_vec_unpacks_hi,
304   OTI_vec_unpacks_lo,
305   /* Extract and widen the high/low part of a vector of unsigned
306      elements.  */
307   OTI_vec_unpacku_hi,
308   OTI_vec_unpacku_lo,
309
310   /* Extract, convert to floating point and widen the high/low part of
311      a vector of signed or unsigned integer elements.  */
312   OTI_vec_unpacks_float_hi,
313   OTI_vec_unpacks_float_lo,
314   OTI_vec_unpacku_float_hi,
315   OTI_vec_unpacku_float_lo,
316
317   /* Narrow (demote) and merge the elements of two vectors.  */
318   OTI_vec_pack_trunc,
319   OTI_vec_pack_usat,
320   OTI_vec_pack_ssat,
321
322   /* Convert to signed/unsigned integer, narrow and merge elements
323      of two vectors of floating point elements.  */
324   OTI_vec_pack_sfix_trunc,
325   OTI_vec_pack_ufix_trunc,
326
327   /* Perform a raise to the power of integer.  */
328   OTI_powi,
329
330   OTI_MAX
331 };
332
333 extern optab optab_table[OTI_MAX];
334
335 #define add_optab (optab_table[OTI_add])
336 #define sub_optab (optab_table[OTI_sub])
337 #define smul_optab (optab_table[OTI_smul])
338 #define addv_optab (optab_table[OTI_addv])
339 #define subv_optab (optab_table[OTI_subv])
340 #define smul_highpart_optab (optab_table[OTI_smul_highpart])
341 #define umul_highpart_optab (optab_table[OTI_umul_highpart])
342 #define smul_widen_optab (optab_table[OTI_smul_widen])
343 #define umul_widen_optab (optab_table[OTI_umul_widen])
344 #define usmul_widen_optab (optab_table[OTI_usmul_widen])
345 #define smadd_widen_optab (optab_table[OTI_smadd_widen])
346 #define umadd_widen_optab (optab_table[OTI_umadd_widen])
347 #define smsub_widen_optab (optab_table[OTI_smsub_widen])
348 #define umsub_widen_optab (optab_table[OTI_umsub_widen])
349 #define sdiv_optab (optab_table[OTI_sdiv])
350 #define smulv_optab (optab_table[OTI_smulv])
351 #define sdivv_optab (optab_table[OTI_sdivv])
352 #define sdivmod_optab (optab_table[OTI_sdivmod])
353 #define udiv_optab (optab_table[OTI_udiv])
354 #define udivmod_optab (optab_table[OTI_udivmod])
355 #define smod_optab (optab_table[OTI_smod])
356 #define umod_optab (optab_table[OTI_umod])
357 #define fmod_optab (optab_table[OTI_fmod])
358 #define remainder_optab (optab_table[OTI_remainder])
359 #define ftrunc_optab (optab_table[OTI_ftrunc])
360 #define and_optab (optab_table[OTI_and])
361 #define ior_optab (optab_table[OTI_ior])
362 #define xor_optab (optab_table[OTI_xor])
363 #define ashl_optab (optab_table[OTI_ashl])
364 #define lshr_optab (optab_table[OTI_lshr])
365 #define ashr_optab (optab_table[OTI_ashr])
366 #define rotl_optab (optab_table[OTI_rotl])
367 #define rotr_optab (optab_table[OTI_rotr])
368 #define smin_optab (optab_table[OTI_smin])
369 #define smax_optab (optab_table[OTI_smax])
370 #define umin_optab (optab_table[OTI_umin])
371 #define umax_optab (optab_table[OTI_umax])
372 #define pow_optab (optab_table[OTI_pow])
373 #define atan2_optab (optab_table[OTI_atan2])
374
375 #define mov_optab (optab_table[OTI_mov])
376 #define movstrict_optab (optab_table[OTI_movstrict])
377 #define movmisalign_optab (optab_table[OTI_movmisalign])
378 #define storent_optab (optab_table[OTI_storent])
379
380 #define neg_optab (optab_table[OTI_neg])
381 #define negv_optab (optab_table[OTI_negv])
382 #define abs_optab (optab_table[OTI_abs])
383 #define absv_optab (optab_table[OTI_absv])
384 #define one_cmpl_optab (optab_table[OTI_one_cmpl])
385 #define bswap_optab (optab_table[OTI_bswap])
386 #define ffs_optab (optab_table[OTI_ffs])
387 #define clz_optab (optab_table[OTI_clz])
388 #define ctz_optab (optab_table[OTI_ctz])
389 #define popcount_optab (optab_table[OTI_popcount])
390 #define parity_optab (optab_table[OTI_parity])
391 #define sqrt_optab (optab_table[OTI_sqrt])
392 #define sincos_optab (optab_table[OTI_sincos])
393 #define sin_optab (optab_table[OTI_sin])
394 #define asin_optab (optab_table[OTI_asin])
395 #define cos_optab (optab_table[OTI_cos])
396 #define acos_optab (optab_table[OTI_acos])
397 #define exp_optab (optab_table[OTI_exp])
398 #define exp10_optab (optab_table[OTI_exp10])
399 #define exp2_optab (optab_table[OTI_exp2])
400 #define expm1_optab (optab_table[OTI_expm1])
401 #define ldexp_optab (optab_table[OTI_ldexp])
402 #define scalb_optab (optab_table[OTI_scalb])
403 #define logb_optab (optab_table[OTI_logb])
404 #define ilogb_optab (optab_table[OTI_ilogb])
405 #define log_optab (optab_table[OTI_log])
406 #define log10_optab (optab_table[OTI_log10])
407 #define log2_optab (optab_table[OTI_log2])
408 #define log1p_optab (optab_table[OTI_log1p])
409 #define floor_optab (optab_table[OTI_floor])
410 #define ceil_optab (optab_table[OTI_ceil])
411 #define btrunc_optab (optab_table[OTI_btrunc])
412 #define round_optab (optab_table[OTI_round])
413 #define nearbyint_optab (optab_table[OTI_nearbyint])
414 #define rint_optab (optab_table[OTI_rint])
415 #define tan_optab (optab_table[OTI_tan])
416 #define atan_optab (optab_table[OTI_atan])
417 #define copysign_optab (optab_table[OTI_copysign])
418 #define signbit_optab (optab_table[OTI_signbit])
419 #define isinf_optab (optab_table[OTI_isinf])
420
421 #define cmp_optab (optab_table[OTI_cmp])
422 #define ucmp_optab (optab_table[OTI_ucmp])
423 #define tst_optab (optab_table[OTI_tst])
424
425 #define eq_optab (optab_table[OTI_eq])
426 #define ne_optab (optab_table[OTI_ne])
427 #define gt_optab (optab_table[OTI_gt])
428 #define ge_optab (optab_table[OTI_ge])
429 #define lt_optab (optab_table[OTI_lt])
430 #define le_optab (optab_table[OTI_le])
431 #define unord_optab (optab_table[OTI_unord])
432
433 #define strlen_optab (optab_table[OTI_strlen])
434
435 #define cbranch_optab (optab_table[OTI_cbranch])
436 #define cmov_optab (optab_table[OTI_cmov])
437 #define cstore_optab (optab_table[OTI_cstore])
438 #define push_optab (optab_table[OTI_push])
439 #define addcc_optab (optab_table[OTI_addcc])
440
441 #define reduc_smax_optab (optab_table[OTI_reduc_smax])
442 #define reduc_umax_optab (optab_table[OTI_reduc_umax])
443 #define reduc_smin_optab (optab_table[OTI_reduc_smin])
444 #define reduc_umin_optab (optab_table[OTI_reduc_umin])
445 #define reduc_splus_optab (optab_table[OTI_reduc_splus])
446 #define reduc_uplus_optab (optab_table[OTI_reduc_uplus])
447
448 #define ssum_widen_optab (optab_table[OTI_ssum_widen])
449 #define usum_widen_optab (optab_table[OTI_usum_widen])
450 #define sdot_prod_optab (optab_table[OTI_sdot_prod])
451 #define udot_prod_optab (optab_table[OTI_udot_prod])
452
453 #define vec_set_optab (optab_table[OTI_vec_set])
454 #define vec_extract_optab (optab_table[OTI_vec_extract])
455 #define vec_extract_even_optab (optab_table[OTI_vec_extract_even])
456 #define vec_extract_odd_optab (optab_table[OTI_vec_extract_odd])
457 #define vec_interleave_high_optab (optab_table[OTI_vec_interleave_high])
458 #define vec_interleave_low_optab (optab_table[OTI_vec_interleave_low])
459 #define vec_init_optab (optab_table[OTI_vec_init])
460 #define vec_shl_optab (optab_table[OTI_vec_shl])
461 #define vec_shr_optab (optab_table[OTI_vec_shr])
462 #define vec_realign_load_optab (optab_table[OTI_vec_realign_load])
463 #define vec_widen_umult_hi_optab (optab_table[OTI_vec_widen_umult_hi])
464 #define vec_widen_umult_lo_optab (optab_table[OTI_vec_widen_umult_lo])
465 #define vec_widen_smult_hi_optab (optab_table[OTI_vec_widen_smult_hi])
466 #define vec_widen_smult_lo_optab (optab_table[OTI_vec_widen_smult_lo])
467 #define vec_unpacks_hi_optab (optab_table[OTI_vec_unpacks_hi])
468 #define vec_unpacks_lo_optab (optab_table[OTI_vec_unpacks_lo])
469 #define vec_unpacku_hi_optab (optab_table[OTI_vec_unpacku_hi])
470 #define vec_unpacku_lo_optab (optab_table[OTI_vec_unpacku_lo])
471 #define vec_unpacks_float_hi_optab (optab_table[OTI_vec_unpacks_float_hi])
472 #define vec_unpacks_float_lo_optab (optab_table[OTI_vec_unpacks_float_lo])
473 #define vec_unpacku_float_hi_optab (optab_table[OTI_vec_unpacku_float_hi])
474 #define vec_unpacku_float_lo_optab (optab_table[OTI_vec_unpacku_float_lo])
475 #define vec_pack_trunc_optab (optab_table[OTI_vec_pack_trunc])
476 #define vec_pack_ssat_optab (optab_table[OTI_vec_pack_ssat])
477 #define vec_pack_usat_optab (optab_table[OTI_vec_pack_usat])
478 #define vec_pack_sfix_trunc_optab (optab_table[OTI_vec_pack_sfix_trunc])
479 #define vec_pack_ufix_trunc_optab (optab_table[OTI_vec_pack_ufix_trunc])
480
481 #define powi_optab (optab_table[OTI_powi])
482
483 /* Conversion optabs have their own table and indexes.  */
484 enum convert_optab_index
485 {
486   COI_sext,
487   COI_zext,
488   COI_trunc,
489
490   COI_sfix,
491   COI_ufix,
492
493   COI_sfixtrunc,
494   COI_ufixtrunc,
495
496   COI_sfloat,
497   COI_ufloat,
498
499   COI_lrint,
500   COI_lround,
501   COI_lfloor,
502   COI_lceil,
503
504   COI_MAX
505 };
506
507 extern convert_optab convert_optab_table[COI_MAX];
508
509 #define sext_optab (convert_optab_table[COI_sext])
510 #define zext_optab (convert_optab_table[COI_zext])
511 #define trunc_optab (convert_optab_table[COI_trunc])
512 #define sfix_optab (convert_optab_table[COI_sfix])
513 #define ufix_optab (convert_optab_table[COI_ufix])
514 #define sfixtrunc_optab (convert_optab_table[COI_sfixtrunc])
515 #define ufixtrunc_optab (convert_optab_table[COI_ufixtrunc])
516 #define sfloat_optab (convert_optab_table[COI_sfloat])
517 #define ufloat_optab (convert_optab_table[COI_ufloat])
518 #define lrint_optab (convert_optab_table[COI_lrint])
519 #define lround_optab (convert_optab_table[COI_lround])
520 #define lfloor_optab (convert_optab_table[COI_lfloor])
521 #define lceil_optab (convert_optab_table[COI_lceil])
522
523 /* These arrays record the insn_code of insns that may be needed to
524    perform input and output reloads of special objects.  They provide a
525    place to pass a scratch register.  */
526 extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
527 extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
528
529 /* Contains the optab used for each rtx code.  */
530 extern optab code_to_optab[NUM_RTX_CODE + 1];
531
532 \f
533 typedef rtx (*rtxfun) (rtx);
534
535 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
536    gives the gen_function to make a branch to test that condition.  */
537
538 extern rtxfun bcc_gen_fctn[NUM_RTX_CODE];
539
540 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
541    gives the insn code to make a store-condition insn
542    to test that condition.  */
543
544 extern enum insn_code setcc_gen_code[NUM_RTX_CODE];
545
546 #ifdef HAVE_conditional_move
547 /* Indexed by the machine mode, gives the insn code to make a conditional
548    move insn.  */
549
550 extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
551 #endif
552
553 /* Indexed by the machine mode, gives the insn code for vector conditional
554    operation.  */
555
556 extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
557 extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
558
559 /* This array records the insn_code of insns to perform block moves.  */
560 extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
561
562 /* This array records the insn_code of insns to perform block sets.  */
563 extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
564
565 /* These arrays record the insn_code of two different kinds of insns
566    to perform block compares.  */
567 extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
568 extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
569 extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
570
571 /* Synchronization primitives.  This first set is atomic operation for
572    which we don't care about the resulting value.  */
573 extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
574 extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
575 extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
576 extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
577 extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
578 extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
579
580 /* This second set is atomic operations in which we return the value
581    that existed in memory before the operation.  */
582 extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
583 extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
584 extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
585 extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
586 extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
587 extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
588
589 /* This third set is atomic operations in which we return the value
590    that resulted after performing the operation.  */
591 extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
592 extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
593 extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
594 extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
595 extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
596 extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
597
598 /* Atomic compare and swap.  */
599 extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
600 extern enum insn_code sync_compare_and_swap_cc[NUM_MACHINE_MODES];
601
602 /* Atomic exchange with acquire semantics.  */
603 extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
604
605 /* Atomic clear with release semantics.  */
606 extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
607
608 /* Define functions given in optabs.c.  */
609
610 extern rtx expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op,
611                                       rtx target, int unsignedp);
612
613 extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
614                               rtx op0, rtx op1, rtx op2, rtx target,
615                               int unsignedp);
616
617 /* Expand a binary operation given optab and rtx operands.  */
618 extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
619                          enum optab_methods);
620
621 extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
622                                 enum optab_methods);
623
624 /* Expand a binary operation with both signed and unsigned forms.  */
625 extern rtx sign_expand_binop (enum machine_mode, optab, optab, rtx, rtx,
626                               rtx, int, enum optab_methods);
627
628 /* Generate code to perform an operation on one operand with two results.  */
629 extern int expand_twoval_unop (optab, rtx, rtx, rtx, int);
630
631 /* Generate code to perform an operation on two operands with two results.  */
632 extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int);
633
634 /* Generate code to perform an operation on two operands with two
635    results, using a library function.  */
636 extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx,
637                                          enum rtx_code);
638
639 /* Expand a unary arithmetic operation given optab rtx operand.  */
640 extern rtx expand_unop (enum machine_mode, optab, rtx, rtx, int);
641
642 /* Expand the absolute value operation.  */
643 extern rtx expand_abs_nojump (enum machine_mode, rtx, rtx, int);
644 extern rtx expand_abs (enum machine_mode, rtx, rtx, int, int);
645
646 /* Expand the copysign operation.  */
647 extern rtx expand_copysign (rtx, rtx, rtx);
648
649 /* Generate an instruction with a given INSN_CODE with an output and
650    an input.  */
651 extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
652
653 /* Excapsulate the block in REG_LIBCALL, and REG_RETVAL reg notes and add 
654    REG_LIBCALL_ID notes to all insns in block.  */
655 extern void maybe_encapsulate_block (rtx, rtx, rtx);
656
657 /* Emit code to perform a series of operations on a multi-word quantity, one
658    word at a time.  */
659 extern rtx emit_no_conflict_block (rtx, rtx, rtx, rtx, rtx);
660
661 /* Emit one rtl insn to compare two rtx's.  */
662 extern void emit_cmp_insn (rtx, rtx, enum rtx_code, rtx, enum machine_mode,
663                            int);
664
665 /* The various uses that a comparison can have; used by can_compare_p:
666    jumps, conditional moves, store flag operations.  */
667 enum can_compare_purpose
668 {
669   ccp_jump,
670   ccp_cmov,
671   ccp_store_flag
672 };
673
674 /* Return the optab used for computing the given operation on the type
675    given by the second argument.  */
676 extern optab optab_for_tree_code (enum tree_code, const_tree);
677
678 /* Nonzero if a compare of mode MODE can be done straightforwardly
679    (without splitting it into pieces).  */
680 extern int can_compare_p (enum rtx_code, enum machine_mode,
681                           enum can_compare_purpose);
682
683 /* Return the INSN_CODE to use for an extend operation.  */
684 extern enum insn_code can_extend_p (enum machine_mode, enum machine_mode, int);
685
686 /* Generate the body of an insn to extend Y (with mode MFROM)
687    into X (with mode MTO).  Do zero-extension if UNSIGNEDP is nonzero.  */
688 extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
689                             enum machine_mode, int);
690
691 /* Call this to reset the function entry for one optab.  */
692 extern void set_optab_libfunc (optab, enum machine_mode, const char *);
693 extern void set_conv_libfunc (convert_optab, enum machine_mode,
694                               enum machine_mode, const char *);
695
696 /* Generate code for a FLOAT_EXPR.  */
697 extern void expand_float (rtx, rtx, int);
698
699 /* Generate code for a FIX_EXPR.  */
700 extern void expand_fix (rtx, rtx, int);
701
702 /* Generate code for float to integral conversion.  */
703 extern bool expand_sfix_optab (rtx, rtx, convert_optab);
704
705 /* Return tree if target supports vector operations for COND_EXPR.  */
706 bool expand_vec_cond_expr_p (tree, enum machine_mode);
707
708 /* Generate code for VEC_COND_EXPR.  */
709 extern rtx expand_vec_cond_expr (tree, rtx);
710
711 /* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR.  */
712 extern rtx expand_vec_shift_expr (tree, rtx);
713
714 #define optab_handler(optab,mode) (&(optab)->handlers[(int) (mode)])
715 #define convert_optab_handler(optab,mode,mode2) \
716         (&(optab)->handlers[(int) (mode)][(int) (mode2)])
717
718 extern rtx optab_libfunc (optab optab, enum machine_mode mode);
719 extern rtx optab_libfunc (optab optab, enum machine_mode mode);
720 extern rtx convert_optab_libfunc (convert_optab optab, enum machine_mode mode1,
721                                   enum machine_mode mode2);
722 #endif /* GCC_OPTABS_H */