diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-05 16:31:49 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-05 16:31:49 +0000 |
commit | b3a15ba67f89e45c9e3c1cc5630249353a242ca5 (patch) | |
tree | ef1c0ed207c9a04740d15d901f47845160bb2f66 /gcc/optabs.c | |
parent | 987dbf11bbbc4bda364d8ec38bd7752142296dce (diff) | |
download | gcc-b3a15ba67f89e45c9e3c1cc5630249353a242ca5.tar.gz |
* optabs.c (HAVE_conditional_trap): Provide default.
(gen_conditional_trap): Likewise.
(init_optabs): Merge init_traps.
(gen_cond_trap): Use prepare_operand. Restructure and avoid ifdef.
* gcc.c-torture/compile/20030605-1.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67497 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 74 |
1 files changed, 33 insertions, 41 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index c693e80079a..8b7f3ea0481 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -88,6 +88,11 @@ enum insn_code setcc_gen_code[NUM_RTX_CODE]; enum insn_code movcc_gen_code[NUM_MACHINE_MODES]; #endif +/* The insn generating function can not take an rtx_code argument. + TRAP_RTX is used as an rtx argument. Its code is replaced with + the code to be used in the trap insn and all other fields are ignored. */ +static GTY(()) rtx trap_rtx; + static int add_equal_note PARAMS ((rtx, rtx, enum rtx_code, rtx, rtx)); static rtx widen_operand PARAMS ((rtx, enum machine_mode, enum machine_mode, int, int)); @@ -114,9 +119,6 @@ static inline optab init_optabv PARAMS ((enum rtx_code)); static void init_libfuncs PARAMS ((optab, int, int, const char *, int)); static void init_integral_libfuncs PARAMS ((optab, const char *, int)); static void init_floating_libfuncs PARAMS ((optab, const char *, int)); -#ifdef HAVE_conditional_trap -static void init_traps PARAMS ((void)); -#endif static void emit_cmp_and_jump_insn_1 PARAMS ((rtx, rtx, enum machine_mode, enum rtx_code, int, rtx)); static void prepare_float_lib_cmp PARAMS ((rtx *, rtx *, enum rtx_code *, @@ -128,6 +130,11 @@ static rtx expand_vector_unop PARAMS ((enum machine_mode, optab, rtx, rtx, int)); static rtx widen_clz PARAMS ((enum machine_mode, rtx, rtx)); static rtx expand_parity PARAMS ((enum machine_mode, rtx, rtx)); + +#ifndef HAVE_conditional_trap +#define HAVE_conditional_trap 0 +#define gen_conditional_trap(a,b) (abort (), NULL_RTX) +#endif /* Add a REG_EQUAL note to the last insn in INSNS. TARGET is being set to the result of operation CODE applied to OP0 (and OP1 if it is a binary @@ -5806,9 +5813,8 @@ init_optabs () gcov_flush_libfunc = init_one_libfunc ("__gcov_flush"); gcov_init_libfunc = init_one_libfunc ("__gcov_init"); -#ifdef HAVE_conditional_trap - init_traps (); -#endif + if (HAVE_conditional_trap) + trap_rtx = gen_rtx_fmt_ee (EQ, VOIDmode, NULL_RTX, NULL_RTX); #ifdef INIT_TARGET_OPTABS /* Allow the target to add more libcalls or rename some, etc. */ @@ -5816,24 +5822,6 @@ init_optabs () #endif } -static GTY(()) rtx trap_rtx; - -#ifdef HAVE_conditional_trap -/* The insn generating function can not take an rtx_code argument. - TRAP_RTX is used as an rtx argument. Its code is replaced with - the code to be used in the trap insn and all other fields are - ignored. */ - -static void -init_traps () -{ - if (HAVE_conditional_trap) - { - trap_rtx = gen_rtx_fmt_ee (EQ, VOIDmode, NULL_RTX, NULL_RTX); - } -} -#endif - /* Generate insns to trap with code TCODE if OP1 and OP2 satisfy condition CODE. Return 0 on failure. */ @@ -5843,30 +5831,34 @@ gen_cond_trap (code, op1, op2, tcode) rtx op1, op2 ATTRIBUTE_UNUSED, tcode ATTRIBUTE_UNUSED; { enum machine_mode mode = GET_MODE (op1); + enum insn_code icode; + rtx insn; + + if (!HAVE_conditional_trap) + return 0; if (mode == VOIDmode) return 0; -#ifdef HAVE_conditional_trap - if (HAVE_conditional_trap - && cmp_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing) + icode = cmp_optab->handlers[(int) mode].insn_code; + if (icode == CODE_FOR_nothing) + return 0; + + start_sequence (); + op1 = prepare_operand (icode, op1, 0, mode, mode, 0); + op2 = prepare_operand (icode, op2, 0, mode, mode, 0); + emit_insn (GEN_FCN (icode) (op1, op2)); + + PUT_CODE (trap_rtx, code); + insn = gen_conditional_trap (trap_rtx, tcode); + if (insn) { - rtx insn; - start_sequence (); - emit_insn (GEN_FCN (cmp_optab->handlers[(int) mode].insn_code) (op1, op2)); - PUT_CODE (trap_rtx, code); - insn = gen_conditional_trap (trap_rtx, tcode); - if (insn) - { - emit_insn (insn); - insn = get_insns (); - } - end_sequence (); - return insn; + emit_insn (insn); + insn = get_insns (); } -#endif + end_sequence (); - return 0; + return insn; } #include "gt-optabs.h" |