diff options
Diffstat (limited to 'gcc/config/crx')
-rw-r--r-- | gcc/config/crx/crx-protos.h | 4 | ||||
-rw-r--r-- | gcc/config/crx/crx.c | 41 | ||||
-rw-r--r-- | gcc/config/crx/crx.h | 7 | ||||
-rw-r--r-- | gcc/config/crx/crx.md | 79 |
4 files changed, 27 insertions, 104 deletions
diff --git a/gcc/config/crx/crx-protos.h b/gcc/config/crx/crx-protos.h index 0be641dd89e..386fab9fe43 100644 --- a/gcc/config/crx/crx-protos.h +++ b/gcc/config/crx/crx-protos.h @@ -62,10 +62,6 @@ extern void crx_print_operand (FILE *, rtx, int); extern void crx_print_operand_address (FILE *, rtx); /* Misc functions called from crx.md. */ -extern rtx crx_expand_compare (enum rtx_code, enum machine_mode); -extern void crx_expand_branch (enum rtx_code, rtx); -extern void crx_expand_scond (enum rtx_code, rtx); - extern void crx_expand_movmem_single (rtx, rtx, rtx, rtx, rtx, unsigned HOST_WIDE_INT *); extern int crx_expand_movmem (rtx, rtx, rtx, rtx); #endif /* RTX_CODE */ diff --git a/gcc/config/crx/crx.c b/gcc/config/crx/crx.c index 6f10afd2e5f..cc3248fb5ee 100644 --- a/gcc/config/crx/crx.c +++ b/gcc/config/crx/crx.c @@ -124,10 +124,6 @@ static enum machine_mode output_memory_reference_mode; /* Table of machine attributes. */ const struct attribute_spec crx_attribute_table[]; -/* Test and compare insns use these globals to generate branch insns. */ -rtx crx_compare_op0 = NULL_RTX; -rtx crx_compare_op1 = NULL_RTX; - /*****************************************************************************/ /* TARGETM FUNCTION PROTOTYPES */ /*****************************************************************************/ @@ -1217,43 +1213,6 @@ crx_expand_movmem (rtx dstbase, rtx srcbase, rtx count_exp, rtx align_exp) return 1; } -rtx -crx_expand_compare (enum rtx_code code, enum machine_mode mode) -{ - rtx op0, op1, cc_reg, ret; - - op0 = crx_compare_op0; - op1 = crx_compare_op1; - - /* Emit the compare that writes into CC_REGNUM) */ - cc_reg = gen_rtx_REG (CCmode, CC_REGNUM); - ret = gen_rtx_COMPARE (CCmode, op0, op1); - emit_insn (gen_rtx_SET (VOIDmode, cc_reg, ret)); - /* debug_rtx (get_last_insn ()); */ - - /* Return the rtx for using the result in CC_REGNUM */ - return gen_rtx_fmt_ee (code, mode, cc_reg, const0_rtx); -} - -void -crx_expand_branch (enum rtx_code code, rtx label) -{ - rtx tmp = crx_expand_compare (code, VOIDmode); - tmp = gen_rtx_IF_THEN_ELSE (VOIDmode, tmp, - gen_rtx_LABEL_REF (VOIDmode, label), - pc_rtx); - emit_jump_insn (gen_rtx_SET (VOIDmode, pc_rtx, tmp)); - /* debug_rtx (get_last_insn ()); */ -} - -void -crx_expand_scond (enum rtx_code code, rtx dest) -{ - rtx tmp = crx_expand_compare (code, GET_MODE (dest)); - emit_move_insn (dest, tmp); - /* debug_rtx (get_last_insn ()); */ -} - static void mpushpop_str (char *stringbuffer, const char *mnemonic, char *mask) { diff --git a/gcc/config/crx/crx.h b/gcc/config/crx/crx.h index 69065f3795b..cac465701bf 100644 --- a/gcc/config/crx/crx.h +++ b/gcc/config/crx/crx.h @@ -520,11 +520,4 @@ struct cumulative_args #define FUNCTION_MODE QImode -/*****************************************************************************/ -/* EXTERNAL DECLARATIONS FOR VARIABLES DEFINED IN CRX.C */ -/*****************************************************************************/ - -extern rtx crx_compare_op0; /* operand 0 for comparisons */ -extern rtx crx_compare_op1; /* operand 1 for comparisons */ - #endif /* ! GCC_CRX_H */ diff --git a/gcc/config/crx/crx.md b/gcc/config/crx/crx.md index b9655544ffc..229e345d32f 100644 --- a/gcc/config/crx/crx.md +++ b/gcc/config/crx/crx.md @@ -63,6 +63,10 @@ (ior (match_code "symbol_ref") (match_operand 0 "register_operand"))) +(define_predicate "cc_reg_operand" + (and (match_code "reg") + (match_test "REGNO (op) == CC_REGNUM"))) + (define_predicate "nosp_reg_operand" (and (match_operand 0 "register_operand") (match_test "REGNO (op) != SP_REGNUM"))) @@ -107,8 +111,6 @@ (define_code_iterator mima_oprnd [smax umax smin umin]) (define_code_attr mimaIsa [(smax "maxs") (umax "maxu") (smin "mins") (umin "minu")]) -(define_code_iterator any_cond [eq ne gt gtu lt ltu ge geu le leu]) - ;; Addition Instructions (define_insn "adddi3" @@ -522,9 +524,21 @@ ;; Compare and Branch Instructions +(define_insn "cbranchcc4" + [(set (pc) + (if_then_else (match_operator 0 "ordered_comparison_operator" + [(match_operand:CC 1 "cc_reg_operand" "r") + (match_operand 2 "cst4_operand" "L")]) + (label_ref (match_operand 3 "")) + (pc)))] + "" + "b%d0\t%l3" + [(set_attr "length" "6")] +) + (define_insn "cbranch<mode>4" [(set (pc) - (if_then_else (match_operator 0 "comparison_operator" + (if_then_else (match_operator 0 "ordered_comparison_operator" [(match_operand:CRXIM 1 "register_operand" "r") (match_operand:CRXIM 2 "reg_or_cst4_operand" "rL")]) (label_ref (match_operand 3 "" "")) @@ -535,18 +549,18 @@ [(set_attr "length" "6")] ) -;; Compare Instructions -(define_expand "cmp<mode>" +;; Scond Instructions + +(define_expand "cstore<mode>4" [(set (reg:CC CC_REGNUM) - (compare:CC (match_operand:CRXIM 0 "register_operand" "") - (match_operand:CRXIM 1 "nonmemory_operand" "")))] + (compare:CC (match_operand:CRXIM 2 "register_operand" "") + (match_operand:CRXIM 3 "nonmemory_operand" ""))) + (set (match_operand:SI 0 "register_operand") + (match_operator:SI 1 "ordered_comparison_operator" + [(reg:CC CC_REGNUM) (const_int 0)]))] + "" "" - { - crx_compare_op0 = operands[0]; - crx_compare_op1 = operands[1]; - DONE; - } ) (define_insn "cmp<mode>_internal" @@ -558,48 +572,9 @@ [(set_attr "length" "2,<lImmArith>")] ) -;; Conditional Branch Instructions - -(define_expand "b<code>" - [(set (pc) - (if_then_else (any_cond (reg:CC CC_REGNUM) - (const_int 0)) - (label_ref (match_operand 0 "")) - (pc)))] - "" - { - crx_expand_branch (<CODE>, operands[0]); - DONE; - } -) - -(define_insn "bCOND_internal" - [(set (pc) - (if_then_else (match_operator 0 "comparison_operator" - [(reg:CC CC_REGNUM) - (const_int 0)]) - (label_ref (match_operand 1 "")) - (pc)))] - "" - "b%d0\t%l1" - [(set_attr "length" "6")] -) - -;; Scond Instructions - -(define_expand "s<code>" - [(set (match_operand:SI 0 "register_operand") - (any_cond:SI (reg:CC CC_REGNUM) (const_int 0)))] - "" - { - crx_expand_scond (<CODE>, operands[0]); - DONE; - } -) - (define_insn "sCOND_internal" [(set (match_operand:SI 0 "register_operand" "=r") - (match_operator:SI 1 "comparison_operator" + (match_operator:SI 1 "ordered_comparison_operator" [(reg:CC CC_REGNUM) (const_int 0)]))] "" "s%d1\t%0" |