00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef GCC_OPTABS_H
00023 #define GCC_OPTABS_H
00024
00025 #include "insn-codes.h"
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 struct optab_handlers GTY(())
00043 {
00044 enum insn_code insn_code;
00045 rtx libfunc;
00046 };
00047
00048 struct optab GTY(())
00049 {
00050 enum rtx_code code;
00051 struct optab_handlers handlers[NUM_MACHINE_MODES];
00052 };
00053 typedef struct optab * optab;
00054
00055
00056
00057
00058 struct convert_optab GTY(())
00059 {
00060 enum rtx_code code;
00061 struct optab_handlers handlers[NUM_MACHINE_MODES][NUM_MACHINE_MODES];
00062 };
00063 typedef struct convert_optab *convert_optab;
00064
00065
00066
00067 #define GEN_FCN(CODE) (insn_data[CODE].genfun)
00068
00069
00070 enum optab_index
00071 {
00072 OTI_add,
00073 OTI_addv,
00074 OTI_sub,
00075 OTI_subv,
00076
00077
00078 OTI_smul,
00079 OTI_smulv,
00080
00081 OTI_smul_highpart,
00082 OTI_umul_highpart,
00083
00084 OTI_smul_widen,
00085 OTI_umul_widen,
00086
00087 OTI_usmul_widen,
00088
00089
00090 OTI_sdiv,
00091 OTI_sdivv,
00092
00093 OTI_sdivmod,
00094 OTI_udiv,
00095 OTI_udivmod,
00096
00097 OTI_smod,
00098 OTI_umod,
00099
00100 OTI_fmod,
00101 OTI_drem,
00102
00103 OTI_ftrunc,
00104
00105
00106 OTI_and,
00107
00108 OTI_ior,
00109
00110 OTI_xor,
00111
00112
00113 OTI_ashl,
00114
00115 OTI_lshr,
00116
00117 OTI_ashr,
00118
00119 OTI_rotl,
00120
00121 OTI_rotr,
00122
00123 OTI_smin,
00124
00125 OTI_smax,
00126
00127 OTI_umin,
00128
00129 OTI_umax,
00130
00131 OTI_pow,
00132
00133 OTI_atan2,
00134
00135
00136 OTI_mov,
00137
00138 OTI_movstrict,
00139
00140 OTI_movmisalign,
00141
00142
00143
00144 OTI_neg,
00145 OTI_negv,
00146
00147 OTI_abs,
00148 OTI_absv,
00149
00150 OTI_one_cmpl,
00151
00152 OTI_ffs,
00153 OTI_clz,
00154 OTI_ctz,
00155 OTI_popcount,
00156 OTI_parity,
00157
00158 OTI_sqrt,
00159
00160 OTI_sincos,
00161
00162 OTI_sin,
00163
00164 OTI_asin,
00165
00166 OTI_cos,
00167
00168 OTI_acos,
00169
00170 OTI_exp,
00171
00172 OTI_exp10,
00173
00174 OTI_exp2,
00175
00176 OTI_expm1,
00177
00178 OTI_ldexp,
00179
00180 OTI_logb,
00181 OTI_ilogb,
00182
00183 OTI_log,
00184
00185 OTI_log10,
00186
00187 OTI_log2,
00188
00189 OTI_log1p,
00190
00191 OTI_floor,
00192 OTI_lfloor,
00193 OTI_ceil,
00194 OTI_lceil,
00195 OTI_btrunc,
00196 OTI_round,
00197 OTI_nearbyint,
00198 OTI_rint,
00199 OTI_lrint,
00200
00201 OTI_tan,
00202
00203 OTI_atan,
00204
00205 OTI_copysign,
00206
00207
00208 OTI_cmp,
00209
00210 OTI_ucmp,
00211
00212 OTI_tst,
00213
00214
00215 OTI_eq,
00216 OTI_ne,
00217 OTI_gt,
00218 OTI_ge,
00219 OTI_lt,
00220 OTI_le,
00221 OTI_unord,
00222
00223
00224 OTI_strlen,
00225
00226
00227 OTI_cbranch,
00228 OTI_cmov,
00229 OTI_cstore,
00230
00231
00232 OTI_push,
00233
00234
00235 OTI_addcc,
00236
00237
00238 OTI_reduc_smax,
00239 OTI_reduc_umax,
00240 OTI_reduc_smin,
00241 OTI_reduc_umin,
00242 OTI_reduc_splus,
00243 OTI_reduc_uplus,
00244
00245
00246 OTI_ssum_widen,
00247 OTI_usum_widen,
00248
00249
00250 OTI_sdot_prod,
00251 OTI_udot_prod,
00252
00253
00254 OTI_vec_set,
00255
00256 OTI_vec_extract,
00257
00258 OTI_vec_init,
00259
00260 OTI_vec_shl,
00261 OTI_vec_shr,
00262
00263 OTI_vec_realign_load,
00264
00265
00266 OTI_powi,
00267
00268 OTI_MAX
00269 };
00270
00271 extern GTY(()) optab optab_table[OTI_MAX];
00272
00273 #define add_optab (optab_table[OTI_add])
00274 #define sub_optab (optab_table[OTI_sub])
00275 #define smul_optab (optab_table[OTI_smul])
00276 #define addv_optab (optab_table[OTI_addv])
00277 #define subv_optab (optab_table[OTI_subv])
00278 #define smul_highpart_optab (optab_table[OTI_smul_highpart])
00279 #define umul_highpart_optab (optab_table[OTI_umul_highpart])
00280 #define smul_widen_optab (optab_table[OTI_smul_widen])
00281 #define umul_widen_optab (optab_table[OTI_umul_widen])
00282 #define usmul_widen_optab (optab_table[OTI_usmul_widen])
00283 #define sdiv_optab (optab_table[OTI_sdiv])
00284 #define smulv_optab (optab_table[OTI_smulv])
00285 #define sdivv_optab (optab_table[OTI_sdivv])
00286 #define sdivmod_optab (optab_table[OTI_sdivmod])
00287 #define udiv_optab (optab_table[OTI_udiv])
00288 #define udivmod_optab (optab_table[OTI_udivmod])
00289 #define smod_optab (optab_table[OTI_smod])
00290 #define umod_optab (optab_table[OTI_umod])
00291 #define fmod_optab (optab_table[OTI_fmod])
00292 #define drem_optab (optab_table[OTI_drem])
00293 #define ftrunc_optab (optab_table[OTI_ftrunc])
00294 #define and_optab (optab_table[OTI_and])
00295 #define ior_optab (optab_table[OTI_ior])
00296 #define xor_optab (optab_table[OTI_xor])
00297 #define ashl_optab (optab_table[OTI_ashl])
00298 #define lshr_optab (optab_table[OTI_lshr])
00299 #define ashr_optab (optab_table[OTI_ashr])
00300 #define rotl_optab (optab_table[OTI_rotl])
00301 #define rotr_optab (optab_table[OTI_rotr])
00302 #define smin_optab (optab_table[OTI_smin])
00303 #define smax_optab (optab_table[OTI_smax])
00304 #define umin_optab (optab_table[OTI_umin])
00305 #define umax_optab (optab_table[OTI_umax])
00306 #define pow_optab (optab_table[OTI_pow])
00307 #define atan2_optab (optab_table[OTI_atan2])
00308
00309 #define mov_optab (optab_table[OTI_mov])
00310 #define movstrict_optab (optab_table[OTI_movstrict])
00311 #define movmisalign_optab (optab_table[OTI_movmisalign])
00312
00313 #define neg_optab (optab_table[OTI_neg])
00314 #define negv_optab (optab_table[OTI_negv])
00315 #define abs_optab (optab_table[OTI_abs])
00316 #define absv_optab (optab_table[OTI_absv])
00317 #define one_cmpl_optab (optab_table[OTI_one_cmpl])
00318 #define ffs_optab (optab_table[OTI_ffs])
00319 #define clz_optab (optab_table[OTI_clz])
00320 #define ctz_optab (optab_table[OTI_ctz])
00321 #define popcount_optab (optab_table[OTI_popcount])
00322 #define parity_optab (optab_table[OTI_parity])
00323 #define sqrt_optab (optab_table[OTI_sqrt])
00324 #define sincos_optab (optab_table[OTI_sincos])
00325 #define sin_optab (optab_table[OTI_sin])
00326 #define asin_optab (optab_table[OTI_asin])
00327 #define cos_optab (optab_table[OTI_cos])
00328 #define acos_optab (optab_table[OTI_acos])
00329 #define exp_optab (optab_table[OTI_exp])
00330 #define exp10_optab (optab_table[OTI_exp10])
00331 #define exp2_optab (optab_table[OTI_exp2])
00332 #define expm1_optab (optab_table[OTI_expm1])
00333 #define ldexp_optab (optab_table[OTI_ldexp])
00334 #define logb_optab (optab_table[OTI_logb])
00335 #define ilogb_optab (optab_table[OTI_ilogb])
00336 #define log_optab (optab_table[OTI_log])
00337 #define log10_optab (optab_table[OTI_log10])
00338 #define log2_optab (optab_table[OTI_log2])
00339 #define log1p_optab (optab_table[OTI_log1p])
00340 #define floor_optab (optab_table[OTI_floor])
00341 #define lfloor_optab (optab_table[OTI_lfloor])
00342 #define ceil_optab (optab_table[OTI_ceil])
00343 #define lceil_optab (optab_table[OTI_lceil])
00344 #define btrunc_optab (optab_table[OTI_btrunc])
00345 #define round_optab (optab_table[OTI_round])
00346 #define nearbyint_optab (optab_table[OTI_nearbyint])
00347 #define rint_optab (optab_table[OTI_rint])
00348 #define lrint_optab (optab_table[OTI_lrint])
00349 #define tan_optab (optab_table[OTI_tan])
00350 #define atan_optab (optab_table[OTI_atan])
00351 #define copysign_optab (optab_table[OTI_copysign])
00352
00353 #define cmp_optab (optab_table[OTI_cmp])
00354 #define ucmp_optab (optab_table[OTI_ucmp])
00355 #define tst_optab (optab_table[OTI_tst])
00356
00357 #define eq_optab (optab_table[OTI_eq])
00358 #define ne_optab (optab_table[OTI_ne])
00359 #define gt_optab (optab_table[OTI_gt])
00360 #define ge_optab (optab_table[OTI_ge])
00361 #define lt_optab (optab_table[OTI_lt])
00362 #define le_optab (optab_table[OTI_le])
00363 #define unord_optab (optab_table[OTI_unord])
00364
00365 #define strlen_optab (optab_table[OTI_strlen])
00366
00367 #define cbranch_optab (optab_table[OTI_cbranch])
00368 #define cmov_optab (optab_table[OTI_cmov])
00369 #define cstore_optab (optab_table[OTI_cstore])
00370 #define push_optab (optab_table[OTI_push])
00371 #define addcc_optab (optab_table[OTI_addcc])
00372
00373 #define reduc_smax_optab (optab_table[OTI_reduc_smax])
00374 #define reduc_umax_optab (optab_table[OTI_reduc_umax])
00375 #define reduc_smin_optab (optab_table[OTI_reduc_smin])
00376 #define reduc_umin_optab (optab_table[OTI_reduc_umin])
00377 #define reduc_splus_optab (optab_table[OTI_reduc_splus])
00378 #define reduc_uplus_optab (optab_table[OTI_reduc_uplus])
00379
00380 #define ssum_widen_optab (optab_table[OTI_ssum_widen])
00381 #define usum_widen_optab (optab_table[OTI_usum_widen])
00382 #define sdot_prod_optab (optab_table[OTI_sdot_prod])
00383 #define udot_prod_optab (optab_table[OTI_udot_prod])
00384
00385 #define vec_set_optab (optab_table[OTI_vec_set])
00386 #define vec_extract_optab (optab_table[OTI_vec_extract])
00387 #define vec_init_optab (optab_table[OTI_vec_init])
00388 #define vec_shl_optab (optab_table[OTI_vec_shl])
00389 #define vec_shr_optab (optab_table[OTI_vec_shr])
00390 #define vec_realign_load_optab (optab_table[OTI_vec_realign_load])
00391
00392 #define powi_optab (optab_table[OTI_powi])
00393
00394
00395 enum convert_optab_index
00396 {
00397 COI_sext,
00398 COI_zext,
00399 COI_trunc,
00400
00401 COI_sfix,
00402 COI_ufix,
00403
00404 COI_sfixtrunc,
00405 COI_ufixtrunc,
00406
00407 COI_sfloat,
00408 COI_ufloat,
00409
00410 COI_MAX
00411 };
00412
00413 extern GTY(()) convert_optab convert_optab_table[COI_MAX];
00414
00415 #define sext_optab (convert_optab_table[COI_sext])
00416 #define zext_optab (convert_optab_table[COI_zext])
00417 #define trunc_optab (convert_optab_table[COI_trunc])
00418 #define sfix_optab (convert_optab_table[COI_sfix])
00419 #define ufix_optab (convert_optab_table[COI_ufix])
00420 #define sfixtrunc_optab (convert_optab_table[COI_sfixtrunc])
00421 #define ufixtrunc_optab (convert_optab_table[COI_ufixtrunc])
00422 #define sfloat_optab (convert_optab_table[COI_sfloat])
00423 #define ufloat_optab (convert_optab_table[COI_ufloat])
00424
00425
00426
00427
00428 extern enum insn_code reload_in_optab[NUM_MACHINE_MODES];
00429 extern enum insn_code reload_out_optab[NUM_MACHINE_MODES];
00430
00431
00432 extern GTY(()) optab code_to_optab[NUM_RTX_CODE + 1];
00433
00434
00435 typedef rtx (*rtxfun) (rtx);
00436
00437
00438
00439
00440 extern rtxfun bcc_gen_fctn[NUM_RTX_CODE];
00441
00442
00443
00444
00445
00446 extern enum insn_code setcc_gen_code[NUM_RTX_CODE];
00447
00448 #ifdef HAVE_conditional_move
00449
00450
00451
00452 extern enum insn_code movcc_gen_code[NUM_MACHINE_MODES];
00453 #endif
00454
00455
00456
00457
00458 extern enum insn_code vcond_gen_code[NUM_MACHINE_MODES];
00459 extern enum insn_code vcondu_gen_code[NUM_MACHINE_MODES];
00460
00461
00462 extern enum insn_code movmem_optab[NUM_MACHINE_MODES];
00463
00464
00465 extern enum insn_code setmem_optab[NUM_MACHINE_MODES];
00466
00467
00468
00469 extern enum insn_code cmpstr_optab[NUM_MACHINE_MODES];
00470 extern enum insn_code cmpstrn_optab[NUM_MACHINE_MODES];
00471 extern enum insn_code cmpmem_optab[NUM_MACHINE_MODES];
00472
00473
00474
00475 extern enum insn_code sync_add_optab[NUM_MACHINE_MODES];
00476 extern enum insn_code sync_sub_optab[NUM_MACHINE_MODES];
00477 extern enum insn_code sync_ior_optab[NUM_MACHINE_MODES];
00478 extern enum insn_code sync_and_optab[NUM_MACHINE_MODES];
00479 extern enum insn_code sync_xor_optab[NUM_MACHINE_MODES];
00480 extern enum insn_code sync_nand_optab[NUM_MACHINE_MODES];
00481
00482
00483
00484 extern enum insn_code sync_old_add_optab[NUM_MACHINE_MODES];
00485 extern enum insn_code sync_old_sub_optab[NUM_MACHINE_MODES];
00486 extern enum insn_code sync_old_ior_optab[NUM_MACHINE_MODES];
00487 extern enum insn_code sync_old_and_optab[NUM_MACHINE_MODES];
00488 extern enum insn_code sync_old_xor_optab[NUM_MACHINE_MODES];
00489 extern enum insn_code sync_old_nand_optab[NUM_MACHINE_MODES];
00490
00491
00492
00493 extern enum insn_code sync_new_add_optab[NUM_MACHINE_MODES];
00494 extern enum insn_code sync_new_sub_optab[NUM_MACHINE_MODES];
00495 extern enum insn_code sync_new_ior_optab[NUM_MACHINE_MODES];
00496 extern enum insn_code sync_new_and_optab[NUM_MACHINE_MODES];
00497 extern enum insn_code sync_new_xor_optab[NUM_MACHINE_MODES];
00498 extern enum insn_code sync_new_nand_optab[NUM_MACHINE_MODES];
00499
00500
00501 extern enum insn_code sync_compare_and_swap[NUM_MACHINE_MODES];
00502 extern enum insn_code sync_compare_and_swap_cc[NUM_MACHINE_MODES];
00503
00504
00505 extern enum insn_code sync_lock_test_and_set[NUM_MACHINE_MODES];
00506
00507
00508 extern enum insn_code sync_lock_release[NUM_MACHINE_MODES];
00509
00510
00511
00512 extern rtx expand_widen_pattern_expr (tree exp, rtx op0, rtx op1, rtx wide_op,
00513 rtx target, int unsignedp);
00514
00515 extern rtx expand_ternary_op (enum machine_mode mode, optab ternary_optab,
00516 rtx op0, rtx op1, rtx op2, rtx target,
00517 int unsignedp);
00518
00519
00520 extern rtx expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
00521 enum optab_methods);
00522
00523 extern bool force_expand_binop (enum machine_mode, optab, rtx, rtx, rtx, int,
00524 enum optab_methods);
00525
00526
00527 extern rtx sign_expand_binop (enum machine_mode, optab, optab, rtx, rtx,
00528 rtx, int, enum optab_methods);
00529
00530
00531 extern int expand_twoval_unop (optab, rtx, rtx, rtx, int);
00532
00533
00534 extern int expand_twoval_binop (optab, rtx, rtx, rtx, rtx, int);
00535
00536
00537
00538 extern bool expand_twoval_binop_libfunc (optab, rtx, rtx, rtx, rtx,
00539 enum rtx_code);
00540
00541
00542 extern rtx expand_unop (enum machine_mode, optab, rtx, rtx, int);
00543
00544
00545 extern rtx expand_abs_nojump (enum machine_mode, rtx, rtx, int);
00546 extern rtx expand_abs (enum machine_mode, rtx, rtx, int, int);
00547
00548
00549 extern rtx expand_copysign (rtx, rtx, rtx);
00550
00551
00552
00553 extern void emit_unop_insn (int, rtx, rtx, enum rtx_code);
00554
00555
00556
00557 extern rtx emit_no_conflict_block (rtx, rtx, rtx, rtx, rtx);
00558
00559
00560 extern void emit_cmp_insn (rtx, rtx, enum rtx_code, rtx, enum machine_mode,
00561 int);
00562
00563
00564
00565 enum can_compare_purpose
00566 {
00567 ccp_jump,
00568 ccp_cmov,
00569 ccp_store_flag
00570 };
00571
00572
00573
00574 extern optab optab_for_tree_code (enum tree_code, tree);
00575
00576
00577
00578 extern int can_compare_p (enum rtx_code, enum machine_mode,
00579 enum can_compare_purpose);
00580
00581
00582 extern enum insn_code can_extend_p (enum machine_mode, enum machine_mode, int);
00583
00584
00585
00586 extern rtx gen_extend_insn (rtx, rtx, enum machine_mode,
00587 enum machine_mode, int);
00588
00589
00590 extern void set_optab_libfunc (optab, enum machine_mode, const char *);
00591 extern void set_conv_libfunc (convert_optab, enum machine_mode,
00592 enum machine_mode, const char *);
00593
00594
00595 extern void expand_float (rtx, rtx, int);
00596
00597
00598 extern void expand_fix (rtx, rtx, int);
00599
00600
00601 bool expand_vec_cond_expr_p (tree, enum machine_mode);
00602
00603
00604 extern rtx expand_vec_cond_expr (tree, rtx);
00605
00606
00607 extern rtx expand_vec_shift_expr (tree, rtx);
00608
00609 #endif