OSDN Git Service

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