Commit b4d83be3 by Richard Henderson Committed by Richard Henderson

rx: Cleanup flags generation.

All arithmetic should only clobber the flags by default;
setting the flags to a useful value should be done by a
separate pattern.

From-SVN: r168924
parent d0acb939
2011-01-17 Richard Henderson <rth@redhat.com>
* config/rx/rx.c (rx_match_ccmode): New.
* config/rx/rx-protos.h: Update.
* config/rx/rx.md (abssi2): Clobber, don't set flags.
(addsi3, adddi3, andsi3, negsi2, one_cmplsi2, iorsi3): Likewise.
(rotlsi3, rotrsi3, ashrsi3, lshrsi3, ashlsi3): Likewise.
(subsi3, subdi3, xorsi3, addsf3, divsf3, mulsf3, subsf3): Likewise.
(fix_truncsfsi2, floatsisf2): Likewise.
(*abssi2_flags, *addsi3_flags, *andsi3_flags, *negsi2_flags): New.
(*one_cmplsi2_flags, *iorsi3_flags, *rotlsi3_flags): New.
(*rotrsi3_flags, *ashrsi3_flags, *lshrsi3_flags, *ashlsi3_flags): New.
(*subsi3_flags, *xorsi3_flags): New.
* config/rx/rx.md (cstoresf4, *cstoresf4): New patterns.
* config/rx/rx.c (rx_print_operand): Remove workaround for
......
......@@ -42,6 +42,7 @@ extern void rx_notice_update_cc (rtx body, rtx insn);
extern void rx_split_cbranch (Mmode, Rcode, rtx, rtx, rtx);
extern bool rx_split_fp_compare (Rcode, Rcode *, Rcode *);
extern Mmode rx_select_cc_mode (Rcode, rtx, rtx);
extern bool rx_match_ccmode (rtx, Mmode);
#endif
#endif /* GCC_RX_PROTOS_H */
......@@ -2755,6 +2755,34 @@ rx_split_cbranch (enum machine_mode cc_mode, enum rtx_code cmp1,
emit_jump_insn (x);
}
/* A helper function for matching parallels that set the flags. */
bool
rx_match_ccmode (rtx insn, enum machine_mode cc_mode)
{
rtx op1, flags;
enum machine_mode flags_mode;
gcc_checking_assert (XVECLEN (PATTERN (insn), 0) == 2);
op1 = XVECEXP (PATTERN (insn), 0, 1);
gcc_checking_assert (GET_CODE (SET_SRC (op1)) == COMPARE);
flags = SET_DEST (op1);
flags_mode = GET_MODE (flags);
if (GET_MODE (SET_SRC (op1)) != flags_mode)
return false;
if (GET_MODE_CLASS (flags_mode) != MODE_CC)
return false;
/* Ensure that the mode of FLAGS is compatible with CC_MODE. */
if (flags_from_mode (flags_mode) & ~flags_from_mode (cc_mode))
return false;
return true;
}
#undef TARGET_FUNCTION_VALUE
#define TARGET_FUNCTION_VALUE rx_function_value
......
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