Commit bad41521 by Richard Henderson Committed by Richard Henderson

mn10300: Cleanup all arithmetic.

For addition and logicals, define an operation-plus-flags update pattern
in preparation for compare elimination.  In addition, clean up the way
we compare and validate CC_MODEs.  Define NEG in terms of NOT; this is
smaller and allows a non-clobbering destination alternative.

From-SVN: r169010
parent 9efb4993
2011-01-19 Richard Henderson <rth@redhat.com>
* config/mn10300/mn10300-modes.def (CCZN, CCZNC): New modes.
* config/mn10300/mn10300.c (CC_FLAG_Z): New.
(CC_FLAG_N, CC_FLAG_C, CC_FLAG_V): New.
(cc_flags_for_mode, cc_flags_for_code): New.
(mn10300_print_operand) ['B']: Use nc/ns for GE/LT when the
overflow flag is not valid. Validate that the flags we need
for the comparison are valid.
(mn10300_output_cmp): Remove.
(mn10300_output_add): New.
(mn10300_select_cc_mode): Use cc_flags_for_code.
(mn10300_split_cbranch): New.
(mn10300_match_ccmode): New.
(mn10300_split_and_operand_count): New.
* config/mn10300/mn10300.h (SELECT_CC_MODE): Pass all of the arguments
to the function.
* config/mn10300/mn10300.md (*am33_addsi3, *mn10300_addsi3): Merge...
(addsi3): ... here. Use mn10300_output_add.
(*addsi3_flags): New.
(*am33_subsi3, *mn10300_subsi3): Merge...
(subsi3): ... here. Use attribute isa.
(*subsi3_flags): New.
(negsi2): Rewrite from expander to insn_and_split. Use NOT+INC
when possible.
(*am33_andsi3, *mn10300_andsi3): Merge...
(andsi3): ... here.
(*andsi3_flags): New.
(andsi3 splitters): New.
(*am33_iorsi3, *mn10300_iorsi3): Merge...
(iorsi3): ... here.
(*iorsi3_flags): New.
(*am33_xorsi3, *mn10300_xorsi3): Merge...
(xorsi3): ... here.
(*xorsi3_flags): New.
(*am33_cmpsi2, *mn10300_cmplsi2): Merge...
(one_cmplsi2): ... here.
(*one_cmplsi2_flags): New.
(*cbranchsi4_cmp): Rename from cbranchsi4_post_reload. Use "r"
instead of "dax" in constraints. Use mn10300_split_cbranch.
(*cmpsi): Rename from cmpsi. Do not use mn10300_output_cmp. Do not
use matching constraints to eliminate a self-comparison.
(*integer_conditional_branch): Rename from integer_conditional_branch.
Use int_mode_flags to match CC_REG.
(*cbranchsi4_btst, *btstsi): New.
(*cbranchsf4_cmp): Rename from *cbranchsf4_post_reload. Use
mn10300_split_cbranch.
(*am33_cmpsf): Rename from am33_cmpsf.
(*float_conditional_branch): Rename from float_conditional_branch.
(*zero_extendqisi2_am33, *zero_extendqisi2_mn10300): Merge...
(zero_extendqisi2): ... here.
(*zero_extendhisi2_am33, *zero_extendhisi2_mn10300): Merge...
(zero_extendhisi2): ... here.
(*extendqisi2_am33, *extendqisi2_mn10300): Merge...
(extendqisi2): ... here.
(*extendhisi2_am33, *extendhisi2_mn10300): Merge...
(extendhisi2): ... here.
(*am33_ashlsi3, *mn10300_ashlsi3): Merge...
(ashlsi3): ... here.
(*am33_lshrsi3, *mn10300_lshrsi3): Merge...
(lshrsi3): ... here.
(*am33_ashrisi3, *mn10300_ashrsi3): Merge...
(ashrsi3): ... here.
(consecutive add peephole): Remove.
* config/mn10300/predicates.md (label_ref_operand): New.
(int_mode_flags): New.
(CCZN_comparison_operator): New.
* config/mn10300/mn10300.md (UNSPEC_EXT): New.
(throughput_42_latency_43): New reservation.
(mulsidi3, umulsidi3): New expanders.
......
......@@ -19,4 +19,6 @@
the Free Software Foundation, , Inc., 51 Franklin Street - Fifth
Floor, Boston, MA 02110-1301, USA. */
CC_MODE (CCZN);
CC_MODE (CCZNC);
CC_MODE (CC_FLOAT);
......@@ -32,13 +32,16 @@ extern int mn10300_get_live_callee_saved_regs (void);
extern bool mn10300_hard_regno_mode_ok (unsigned int, Mmode);
extern bool mn10300_legitimate_constant_p (rtx);
extern bool mn10300_modes_tieable (Mmode, Mmode);
extern Cstar mn10300_output_cmp (rtx, rtx);
extern Cstar mn10300_output_add (rtx[3], bool);
extern void mn10300_print_operand (FILE *, rtx, int);
extern void mn10300_print_operand_address (FILE *, rtx);
extern void mn10300_print_reg_list (FILE *, int);
extern Mmode mn10300_select_cc_mode (rtx);
extern Mmode mn10300_select_cc_mode (enum rtx_code, rtx, rtx);
extern int mn10300_store_multiple_operation (rtx, Mmode);
extern int mn10300_symbolic_operand (rtx, Mmode);
extern void mn10300_split_cbranch (Mmode, rtx, rtx);
extern int mn10300_split_and_operand_count (rtx);
extern bool mn10300_match_ccmode (rtx, Mmode);
#endif /* RTX_CODE */
extern bool mn10300_regno_in_class_p (unsigned, int, bool);
......
......@@ -600,7 +600,7 @@ do { \
/* Non-global SYMBOL_REFs have SYMBOL_REF_FLAG enabled. */
#define MN10300_GLOBAL_P(X) (! SYMBOL_REF_FLAG (X))
#define SELECT_CC_MODE(OP, X, Y) mn10300_select_cc_mode (X)
#define SELECT_CC_MODE(OP, X, Y) mn10300_select_cc_mode (OP, X, Y)
#define REVERSIBLE_CC_MODE(MODE) 0
/* Nonzero if access to memory by bytes or half words is no faster
......
......@@ -42,3 +42,19 @@
return XEXP (op, 0) == stack_pointer_rtx
|| XEXP (op, 1) == stack_pointer_rtx;
})
(define_predicate "label_ref_operand"
(match_code "label_ref"))
(define_special_predicate "int_mode_flags"
(match_code "reg")
{
if (REGNO (op) != CC_REG)
return false;
if (GET_MODE (op) == CC_FLOATmode)
return false;
return GET_MODE_CLASS (GET_MODE (op)) == MODE_CC;
})
(define_predicate "CCZN_comparison_operator"
(match_code "eq,ne,lt,ge"))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment