1 /* Definitions for code generation pass of GNU compiler.
2 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007
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)
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/>. */
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 and cmp_optab, are used
44 enum insn_code insn_code
;
50 const char *libcall_basename
;
52 void (*libcall_gen
)(struct optab
*, const char *name
, char suffix
, enum machine_mode
);
53 struct optab_handlers handlers
[NUM_MACHINE_MODES
];
55 typedef struct optab
* 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. */
63 const char *libcall_basename
;
64 void (*libcall_gen
)(struct convert_optab
*, const char *name
,
67 struct optab_handlers handlers
[NUM_MACHINE_MODES
][NUM_MACHINE_MODES
];
69 typedef struct convert_optab
*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. */
78 /* Fixed-point operators with signed/unsigned saturation */
97 /* Signed and fp multiply */
100 /* Signed multiply, return high word */
103 /* Signed multiply with result one machine mode wider than args */
106 /* Widening multiply of one unsigned and one signed operand. */
108 /* Signed multiply and add with the result and addend one machine mode
109 wider than the multiplicand and multiplier. */
111 /* Unsigned multiply and add with the result and addend one machine mode
112 wider than the multiplicand and multiplier. */
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. */
118 /* Unigned multiply and add with the result and addend one machine mode
119 wider than the multiplicand and multiplier.
120 All involved operations are saturating. */
122 /* Signed multiply and subtract the result and minuend one machine mode
123 wider than the multiplicand and multiplier. */
125 /* Unsigned multiply and subtract the result and minuend one machine mode
126 wider than the multiplicand and multiplier. */
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. */
132 /* Unigned multiply and subtract the result and minuend one machine mode
133 wider than the multiplicand and multiplier.
134 All involved operations are saturating. */
140 /* Signed divide-and-remainder in one */
144 /* Signed remainder */
147 /* Floating point remainder functions */
150 /* Convert float to integer in float fmt */
160 /* Arithmetic shift left */
162 /* Logical shift right */
164 /* Arithmetic shift right */
171 /* Arithmetic shift left of vector by vector */
173 /* Logical shift right of vector by vector */
175 /* Arithmetic shift right of vector by vector */
177 /* Rotate left of vector by vector */
179 /* Rotate right of vector by vector */
182 /* Signed and floating-point minimum value */
184 /* Signed and floating-point maximum value */
186 /* Unsigned minimum value */
188 /* Unsigned maximum value */
192 /* Arc tangent of y/x */
195 /* Move instruction. */
197 /* Move, preserving high part of register. */
199 /* Move, with a misaligned memory. */
201 /* Nontemporal store. */
204 /* Unary operations */
215 /* Bit scanning and counting */
235 /* Base-10 Exponential */
237 /* Base-2 Exponential */
241 /* Load exponent of a floating point number */
243 /* Multiply floating-point number by integral power of radix */
245 /* Radix-independent exponent */
248 /* Natural Logarithm */
250 /* Base-10 Logarithm */
252 /* Base-2 Logarithm */
254 /* logarithm of 1 plus argument */
256 /* Rounding functions */
265 /* Inverse tangent */
271 /* Test for infinite value */
274 /* Compare insn; two operands. */
276 /* Used only for libcalls for unsigned comparisons. */
278 /* tst insn; compare one operand against 0 */
281 /* Floating point comparison optabs - used primarily for libfuncs */
293 /* Combined compare & jump/store flags/move operations. */
298 /* Push instruction. */
301 /* Conditional add instruction. */
304 /* Reduction operations on a vector operand. */
312 /* Summation, with result machine mode one or more wider than args. */
316 /* Dot product, with result machine mode one or more wider than args. */
320 /* Set specified field of vector operand. */
322 /* Extract specified field of vector operand. */
324 /* Extract even/odd fields of vector operands. */
325 OTI_vec_extract_even
,
327 /* Interleave fields of vector operands. */
328 OTI_vec_interleave_high
,
329 OTI_vec_interleave_low
,
330 /* Initialize vector operand. */
332 /* Whole vector shift. The shift amount is in bits. */
335 /* Extract specified elements from vectors, for vector load. */
336 OTI_vec_realign_load
,
337 /* Widening multiplication.
338 The high/low part of the resulting vector of products is returned. */
339 OTI_vec_widen_umult_hi
,
340 OTI_vec_widen_umult_lo
,
341 OTI_vec_widen_smult_hi
,
342 OTI_vec_widen_smult_lo
,
343 /* Extract and widen the high/low part of a vector of signed or
344 floating point elements. */
347 /* Extract and widen the high/low part of a vector of unsigned
352 /* Extract, convert to floating point and widen the high/low part of
353 a vector of signed or unsigned integer elements. */
354 OTI_vec_unpacks_float_hi
,
355 OTI_vec_unpacks_float_lo
,
356 OTI_vec_unpacku_float_hi
,
357 OTI_vec_unpacku_float_lo
,
359 /* Narrow (demote) and merge the elements of two vectors. */
364 /* Convert to signed/unsigned integer, narrow and merge elements
365 of two vectors of floating point elements. */
366 OTI_vec_pack_sfix_trunc
,
367 OTI_vec_pack_ufix_trunc
,
369 /* Perform a raise to the power of integer. */
375 extern struct optab optab_table
[OTI_MAX
];
377 #define ssadd_optab (&optab_table[OTI_ssadd])
378 #define usadd_optab (&optab_table[OTI_usadd])
379 #define sssub_optab (&optab_table[OTI_sssub])
380 #define ussub_optab (&optab_table[OTI_ussub])
381 #define ssmul_optab (&optab_table[OTI_ssmul])
382 #define usmul_optab (&optab_table[OTI_usmul])
383 #define ssdiv_optab (&optab_table[OTI_ssdiv])
384 #define usdiv_optab (&optab_table[OTI_usdiv])
385 #define ssneg_optab (&optab_table[OTI_ssneg])
386 #define usneg_optab (&optab_table[OTI_usneg])
387 #define ssashl_optab (&optab_table[OTI_ssashl])
388 #define usashl_optab (&optab_table[OTI_usashl])
390 #define add_optab (&optab_table[OTI_add])
391 #define sub_optab (&optab_table[OTI_sub])
392 #define smul_optab (&optab_table[OTI_smul])
393 #define addv_optab (&optab_table[OTI_addv])
394 #define subv_optab (&optab_table[OTI_subv])
395 #define smul_highpart_optab (&optab_table[OTI_smul_highpart])
396 #define umul_highpart_optab (&optab_table[OTI_umul_highpart])
397 #define smul_widen_optab (&optab_table[OTI_smul_widen])
398 #define umul_widen_optab (&optab_table[OTI_umul_widen])
399 #define usmul_widen_optab (&optab_table[OTI_usmul_widen])
400 #define smadd_widen_optab (&optab_table[OTI_smadd_widen])
401 #define umadd_widen_optab (&optab_table[OTI_umadd_widen])
402 #define ssmadd_widen_optab (&optab_table[OTI_ssmadd_widen])
403 #define usmadd_widen_optab (&optab_table[OTI_usmadd_widen])
404 #define smsub_widen_optab (&optab_table[OTI_smsub_widen])
405 #define umsub_widen_optab (&optab_table[OTI_umsub_widen])
406 #define ssmsub_widen_optab (&optab_table[OTI_ssmsub_widen])
407 #define usmsub_widen_optab (&optab_table[OTI_usmsub_widen])
408 #define sdiv_optab (&optab_table[OTI_sdiv])
409 #define smulv_optab (&optab_table[OTI_smulv])
410 #define sdivv_optab (&optab_table[OTI_sdivv])
411 #define sdivmod_optab (&optab_table[OTI_sdivmod])
412 #define udiv_optab (&optab_table[OTI_udiv])
413 #define udivmod_optab (&optab_table[OTI_udivmod])
414 #define smod_optab (&optab_table[OTI_smod])
415 #define umod_optab (&optab_table[OTI_umod])
416 #define fmod_optab (&optab_table[OTI_fmod])
417 #define remainder_optab (&optab_table[OTI_remainder])
418 #define ftrunc_optab (&optab_table[OTI_ftrunc])
419 #define and_optab (&optab_table[OTI_and])
420 #define ior_optab (&optab_table[OTI_ior])
421 #define xor_optab (&optab_table[OTI_xor])
422 #define ashl_optab (&optab_table[OTI_ashl])
423 #define lshr_optab (&optab_table[OTI_lshr])
424 #define ashr_optab (&optab_table[OTI_ashr])
425 #define rotl_optab (&optab_table[OTI_rotl])
426 #define rotr_optab (&optab_table[OTI_rotr])
427 #define vashl_optab (&optab_table[OTI_vashl])
428 #define vlshr_optab (&optab_table[OTI_vlshr])
429 #define vashr_optab (&optab_table[OTI_vashr])
430 #define vrotl_optab (&optab_table[OTI_vrotl])
431 #define vrotr_optab (&optab_table[OTI_vrotr])
432 #define smin_optab (&optab_table[OTI_smin])
433 #define smax_optab (&optab_table[OTI_smax])
434 #define umin_optab (&optab_table[OTI_umin])
435 #define umax_optab (&optab_table[OTI_umax])
436 #define pow_optab (&optab_table[OTI_pow])
437 #define atan2_optab (&optab_table[OTI_atan2])
439 #define mov_optab (&optab_table[OTI_mov])
440 #define movstrict_optab (&optab_table[OTI_movstrict])
441 #define movmisalign_optab (&optab_table[OTI_movmisalign])
442 #define storent_optab (&optab_table[OTI_storent])
444 #define neg_optab (&optab_table[OTI_neg])
445 #define negv_optab (&optab_table[OTI_negv])
446 #define abs_optab (&optab_table[OTI_abs])
447 #define absv_optab (&optab_table[OTI_absv])
448 #define one_cmpl_optab (&optab_table[OTI_one_cmpl])
449 #define bswap_optab (&optab_table[OTI_bswap])
450 #define ffs_optab (&optab_table[OTI_ffs])
451 #define clz_optab (&optab_table[OTI_clz])
452 #define ctz_optab (&optab_table[OTI_ctz])
453 #define popcount_optab (&optab_table[OTI_popcount])
454 #define parity_optab (&optab_table[OTI_parity])
455 #define sqrt_optab (&optab_table[OTI_sqrt])
456 #define sincos_optab (&optab_table[OTI_sincos])
457 #define sin_optab (&optab_table[OTI_sin])
458 #define asin_optab (&optab_table[OTI_asin])
459 #define cos_optab (&optab_table[OTI_cos])
460 #define acos_optab (&optab_table[OTI_acos])
461 #define exp_optab (&optab_table[OTI_exp])
462 #define exp10_optab (&optab_table[OTI_exp10])
463 #define exp2_optab (&optab_table[OTI_exp2])
464 #define expm1_optab (&optab_table[OTI_expm1])
465 #define ldexp_optab (&optab_table[OTI_ldexp])
466 #define scalb_optab (&optab_table[OTI_scalb])
467 #define logb_optab (&optab_table[OTI_logb])
468 #define ilogb_optab (&optab_table[OTI_ilogb])
469 #define log_optab (&optab_table[OTI_log])
470 #define log10_optab (&optab_table[OTI_log10])
471 #define log2_optab (&optab_table[OTI_log2])
472 #define log1p_optab (&optab_table[OTI_log1p])
473 #define floor_optab (&optab_table[OTI_floor])
474 #define ceil_optab (&optab_table[OTI_ceil])
475 #define btrunc_optab (&optab_table[OTI_btrunc])
476 #define round_optab (&optab_table[OTI_round])
477 #define nearbyint_optab (&optab_table[OTI_nearbyint])
478 #define rint_optab (&optab_table[OTI_rint])
479 #define tan_optab (&optab_table[OTI_tan])
480 #define atan_optab (&optab_table[OTI_atan])
481 #define copysign_optab (&optab_table[OTI_copysign])
482 #define signbit_optab (&optab_table[OTI_signbit])
483 #define isinf_optab (&optab_table[OTI_isinf])
485 #define cmp_optab (&optab_table[OTI_cmp])
486 #define ucmp_optab (&optab_table[OTI_ucmp])
487 #define tst_optab (&optab_table[OTI_tst])
489 #define eq_optab (&optab_table[OTI_eq])
490 #define ne_optab (&optab_table[OTI_ne])
491 #define gt_optab (&optab_table[OTI_gt])
492 #define ge_optab (&optab_table[OTI_ge])
493 #define lt_optab (&optab_table[OTI_lt])
494 #define le_optab (&optab_table[OTI_le])
495 #define unord_optab (&optab_table[OTI_unord])
497 #define strlen_optab (&optab_table[OTI_strlen])
499 #define cbranch_optab (&optab_table[OTI_cbranch])
500 #define cmov_optab (&optab_table[OTI_cmov])
501 #define cstore_optab (&optab_table[OTI_cstore])
502 #define push_optab (&optab_table[OTI_push])
503 #define addcc_optab (&optab_table[OTI_addcc])
505 #define reduc_smax_optab (&optab_table[OTI_reduc_smax])
506 #define reduc_umax_optab (&optab_table[OTI_reduc_umax])
507 #define reduc_smin_optab (&optab_table[OTI_reduc_smin])
508 #define reduc_umin_optab (&optab_table[OTI_reduc_umin])
509 #define reduc_splus_optab (&optab_table[OTI_reduc_splus])
510 #define reduc_uplus_optab (&optab_table[OTI_reduc_uplus])
512 #define ssum_widen_optab (&optab_table[OTI_ssum_widen])
513 #define usum_widen_optab (&optab_table[OTI_usum_widen])
514 #define sdot_prod_optab (&optab_table[OTI_sdot_prod])
515 #define udot_prod_optab (&optab_table[OTI_udot_prod])
517 #define vec_set_optab (&optab_table[OTI_vec_set])
518 #define vec_extract_optab (&optab_table[OTI_vec_extract])
519 #define vec_extract_even_optab (&optab_table[OTI_vec_extract_even])
520 #define vec_extract_odd_optab (&optab_table[OTI_vec_extract_odd])
521 #define vec_interleave_high_optab (&optab_table[OTI_vec_interleave_high])
522 #define vec_interleave_low_optab (&optab_table[OTI_vec_interleave_low])
523 #define vec_init_optab (&optab_table[OTI_vec_init])
524 #define vec_shl_optab (&optab_table[OTI_vec_shl])
525 #define vec_shr_optab (&optab_table[OTI_vec_shr])
526 #define vec_realign_load_optab (&optab_table[OTI_vec_realign_load])
527 #define vec_widen_umult_hi_optab (&optab_table[OTI_vec_widen_umult_hi])
528 #define vec_widen_umult_lo_optab (&optab_table[OTI_vec_widen_umult_lo])
529 #define vec_widen_smult_hi_optab (&optab_table[OTI_vec_widen_smult_hi])
530 #define vec_widen_smult_lo_optab (&optab_table[OTI_vec_widen_smult_lo])
531 #define vec_unpacks_hi_optab (&optab_table[OTI_vec_unpacks_hi])
532 #define vec_unpacks_lo_optab (&optab_table[OTI_vec_unpacks_lo])
533 #define vec_unpacku_hi_optab (&optab_table[OTI_vec_unpacku_hi])
534 #define vec_unpacku_lo_optab (&optab_table[OTI_vec_unpacku_lo])
535 #define vec_unpacks_float_hi_optab (&optab_table[OTI_vec_unpacks_float_hi])
536 #define vec_unpacks_float_lo_optab (&optab_table[OTI_vec_unpacks_float_lo])
537 #define vec_unpacku_float_hi_optab (&optab_table[OTI_vec_unpacku_float_hi])
538 #define vec_unpacku_float_lo_optab (&optab_table[OTI_vec_unpacku_float_lo])
539 #define vec_pack_trunc_optab (&optab_table[OTI_vec_pack_trunc])
540 #define vec_pack_ssat_optab (&optab_table[OTI_vec_pack_ssat])
541 #define vec_pack_usat_optab (&optab_table[OTI_vec_pack_usat])
542 #define vec_pack_sfix_trunc_optab (&optab_table[OTI_vec_pack_sfix_trunc])
543 #define vec_pack_ufix_trunc_optab (&optab_table[OTI_vec_pack_ufix_trunc])
545 #define powi_optab (&optab_table[OTI_powi])
547 /* Conversion optabs have their own table and indexes. */
548 enum convert_optab_index
576 extern struct convert_optab convert_optab_table
[COI_MAX
];
578 #define sext_optab (&convert_optab_table[COI_sext])
579 #define zext_optab (&convert_optab_table[COI_zext])
580 #define trunc_optab (&convert_optab_table[COI_trunc])
581 #define sfix_optab (&convert_optab_table[COI_sfix])
582 #define ufix_optab (&convert_optab_table[COI_ufix])
583 #define sfixtrunc_optab (&convert_optab_table[COI_sfixtrunc])
584 #define ufixtrunc_optab (&convert_optab_table[COI_ufixtrunc])
585 #define sfloat_optab (&convert_optab_table[COI_sfloat])
586 #define ufloat_optab (&convert_optab_table[COI_ufloat])
587 #define lrint_optab (&convert_optab_table[COI_lrint])
588 #define lround_optab (&convert_optab_table[COI_lround])
589 #define lfloor_optab (&convert_optab_table[COI_lfloor])
590 #define lceil_optab (&convert_optab_table[COI_lceil])
591 #define fract_optab (&convert_optab_table[COI_fract])
592 #define fractuns_optab (&convert_optab_table[COI_fractuns])
593 #define satfract_optab (&convert_optab_table[COI_satfract])
594 #define satfractuns_optab (&convert_optab_table[COI_satfractuns])
596 /* These arrays record the insn_code of insns that may be needed to
597 perform input and output reloads of special objects. They provide a
598 place to pass a scratch register. */
599 extern enum insn_code reload_in_optab
[NUM_MACHINE_MODES
];
600 extern enum insn_code reload_out_optab
[NUM_MACHINE_MODES
];
602 /* Contains the optab used for each rtx code. */
603 extern optab code_to_optab
[NUM_RTX_CODE
+ 1];
606 typedef rtx (*rtxfun
) (rtx
);
608 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
609 gives the gen_function to make a branch to test that condition. */
611 extern rtxfun bcc_gen_fctn
[NUM_RTX_CODE
];
613 /* Indexed by the rtx-code for a conditional (e.g. EQ, LT,...)
614 gives the insn code to make a store-condition insn
615 to test that condition. */
617 extern enum insn_code setcc_gen_code
[NUM_RTX_CODE
];
619 #ifdef HAVE_conditional_move
620 /* Indexed by the machine mode, gives the insn code to make a conditional
623 extern enum insn_code movcc_gen_code
[NUM_MACHINE_MODES
];
626 /* Indexed by the machine mode, gives the insn code for vector conditional
629 extern enum insn_code vcond_gen_code
[NUM_MACHINE_MODES
];
630 extern enum insn_code vcondu_gen_code
[NUM_MACHINE_MODES
];
632 /* This array records the insn_code of insns to perform block moves. */
633 extern enum insn_code movmem_optab
[NUM_MACHINE_MODES
];
635 /* This array records the insn_code of insns to perform block sets. */
636 extern enum insn_code setmem_optab
[NUM_MACHINE_MODES
];
638 /* These arrays record the insn_code of two different kinds of insns
639 to perform block compares. */
640 extern enum insn_code cmpstr_optab
[NUM_MACHINE_MODES
];
641 extern enum insn_code cmpstrn_optab
[NUM_MACHINE_MODES
];
642 extern enum insn_code cmpmem_optab
[NUM_MACHINE_MODES
];
644 /* Synchronization primitives. This first set is atomic operation for
645 which we don't care about the resulting value. */
646 extern enum insn_code sync_add_optab
[NUM_MACHINE_MODES
];
647 extern enum insn_code sync_sub_optab
[NUM_MACHINE_MODES
];
648 extern enum insn_code sync_ior_optab
[NUM_MACHINE_MODES
];
649 extern enum insn_code sync_and_optab
[NUM_MACHINE_MODES
];
650 extern enum insn_code sync_xor_optab
[NUM_MACHINE_MODES
];
651 extern enum insn_code sync_nand_optab
[NUM_MACHINE_MODES
];
653 /* This second set is atomic operations in which we return the value
654 that existed in memory before the operation. */
655 extern enum insn_code sync_old_add_optab
[NUM_MACHINE_MODES
];
656 extern enum insn_code sync_old_sub_optab
[NUM_MACHINE_MODES
];
657 extern enum insn_code sync_old_ior_optab
[NUM_MACHINE_MODES
];
658 extern enum insn_code sync_old_and_optab
[NUM_MACHINE_MODES
];
659 extern enum insn_code sync_old_xor_optab
[NUM_MACHINE_MODES
];
660 extern enum insn_code sync_old_nand_optab
[NUM_MACHINE_MODES
];
662 /* This third set is atomic operations in which we return the value
663 that resulted after performing the operation. */
664 extern enum insn_code sync_new_add_optab
[NUM_MACHINE_MODES
];
665 extern enum insn_code sync_new_sub_optab
[NUM_MACHINE_MODES
];
666 extern enum insn_code sync_new_ior_optab
[NUM_MACHINE_MODES
];
667 extern enum insn_code sync_new_and_optab
[NUM_MACHINE_MODES
];
668 extern enum insn_code sync_new_xor_optab
[NUM_MACHINE_MODES
];
669 extern enum insn_code sync_new_nand_optab
[NUM_MACHINE_MODES
];
671 /* Atomic compare and swap. */
672 extern enum insn_code sync_compare_and_swap
[NUM_MACHINE_MODES
];
673 extern enum insn_code sync_compare_and_swap_cc
[NUM_MACHINE_MODES
];
675 /* Atomic exchange with acquire semantics. */
676 extern enum insn_code sync_lock_test_and_set
[NUM_MACHINE_MODES
];
678 /* Atomic clear with release semantics. */
679 extern enum insn_code sync_lock_release
[NUM_MACHINE_MODES
];
681 /* Define functions given in optabs.c. */
683 extern rtx
expand_widen_pattern_expr (tree exp
, rtx op0
, rtx op1
, rtx wide_op
,
684 rtx target
, int unsignedp
);
686 extern rtx
expand_ternary_op (enum machine_mode mode
, optab ternary_optab
,
687 rtx op0
, rtx op1
, rtx op2
, rtx target
,
690 /* Expand a binary operation given optab and rtx operands. */
691 extern rtx
expand_binop (enum machine_mode
, optab
, rtx
, rtx
, rtx
, int,
694 extern bool force_expand_binop (enum machine_mode
, optab
, rtx
, rtx
, rtx
, int,
697 /* Expand a binary operation with both signed and unsigned forms. */
698 extern rtx
sign_expand_binop (enum machine_mode
, optab
, optab
, rtx
, rtx
,
699 rtx
, int, enum optab_methods
);
701 /* Generate code to perform an operation on one operand with two results. */
702 extern int expand_twoval_unop (optab
, rtx
, rtx
, rtx
, int);
704 /* Generate code to perform an operation on two operands with two results. */
705 extern int expand_twoval_binop (optab
, rtx
, rtx
, rtx
, rtx
, int);
707 /* Generate code to perform an operation on two operands with two
708 results, using a library function. */
709 extern bool expand_twoval_binop_libfunc (optab
, rtx
, rtx
, rtx
, rtx
,
712 /* Expand a unary arithmetic operation given optab rtx operand. */
713 extern rtx
expand_unop (enum machine_mode
, optab
, rtx
, rtx
, int);
715 /* Expand the absolute value operation. */
716 extern rtx
expand_abs_nojump (enum machine_mode
, rtx
, rtx
, int);
717 extern rtx
expand_abs (enum machine_mode
, rtx
, rtx
, int, int);
719 /* Expand the copysign operation. */
720 extern rtx
expand_copysign (rtx
, rtx
, rtx
);
722 /* Generate an instruction with a given INSN_CODE with an output and
724 extern void emit_unop_insn (int, rtx
, rtx
, enum rtx_code
);
726 /* Excapsulate the block in REG_LIBCALL, and REG_RETVAL reg notes and add
727 REG_LIBCALL_ID notes to all insns in block. */
728 extern void maybe_encapsulate_block (rtx
, rtx
, rtx
);
730 /* Emit one rtl insn to compare two rtx's. */
731 extern void emit_cmp_insn (rtx
, rtx
, enum rtx_code
, rtx
, enum machine_mode
,
734 /* An extra flag to control optab_for_tree_code's behavior. This is needed to
735 distinguish between machines with a vector shift that takes a scalar for the
736 shift amount vs. machines that take a vector for the shift amount. */
744 /* Return the optab used for computing the given operation on the type given by
745 the second argument. The third argument distinguishes between the types of
746 vector shifts and rotates */
747 extern optab
optab_for_tree_code (enum tree_code
, const_tree
, enum optab_subtype
);
749 /* The various uses that a comparison can have; used by can_compare_p:
750 jumps, conditional moves, store flag operations. */
751 enum can_compare_purpose
758 /* Nonzero if a compare of mode MODE can be done straightforwardly
759 (without splitting it into pieces). */
760 extern int can_compare_p (enum rtx_code
, enum machine_mode
,
761 enum can_compare_purpose
);
763 /* Return the INSN_CODE to use for an extend operation. */
764 extern enum insn_code
can_extend_p (enum machine_mode
, enum machine_mode
, int);
766 /* Generate the body of an insn to extend Y (with mode MFROM)
767 into X (with mode MTO). Do zero-extension if UNSIGNEDP is nonzero. */
768 extern rtx
gen_extend_insn (rtx
, rtx
, enum machine_mode
,
769 enum machine_mode
, int);
771 /* Call this to reset the function entry for one optab. */
772 extern void set_optab_libfunc (optab
, enum machine_mode
, const char *);
773 extern void set_conv_libfunc (convert_optab
, enum machine_mode
,
774 enum machine_mode
, const char *);
776 /* Generate code for a FIXED_CONVERT_EXPR. */
777 extern void expand_fixed_convert (rtx
, rtx
, int, int);
779 /* Generate code for a FLOAT_EXPR. */
780 extern void expand_float (rtx
, rtx
, int);
782 /* Generate code for a FIX_EXPR. */
783 extern void expand_fix (rtx
, rtx
, int);
785 /* Generate code for float to integral conversion. */
786 extern bool expand_sfix_optab (rtx
, rtx
, convert_optab
);
788 /* Return tree if target supports vector operations for COND_EXPR. */
789 bool expand_vec_cond_expr_p (tree
, enum machine_mode
);
791 /* Generate code for VEC_COND_EXPR. */
792 extern rtx
expand_vec_cond_expr (tree
, rtx
);
794 /* Generate code for VEC_LSHIFT_EXPR and VEC_RSHIFT_EXPR. */
795 extern rtx
expand_vec_shift_expr (tree
, rtx
);
797 #define optab_handler(optab,mode) (&(optab)->handlers[(int) (mode)])
798 #define convert_optab_handler(optab,mode,mode2) \
799 (&(optab)->handlers[(int) (mode)][(int) (mode2)])
801 extern rtx
optab_libfunc (optab optab
, enum machine_mode mode
);
802 extern rtx
optab_libfunc (optab optab
, enum machine_mode mode
);
803 extern rtx
convert_optab_libfunc (convert_optab optab
, enum machine_mode mode1
,
804 enum machine_mode mode2
);
805 #endif /* GCC_OPTABS_H */