From: Philippe De Muyter Date: Wed, 18 Apr 2007 20:51:42 +0000 (+0200) Subject: m68k.c (output_btst): Use `movew to ccr' when useful. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5083912dfabb0c52a01aa5d1a8f13f176d93d719;p=gcc.git m68k.c (output_btst): Use `movew to ccr' when useful. 2007-04-18 Philippe De Muyter * config/m68k/m68k.c (output_btst): Use `movew to ccr' when useful. From-SVN: r123959 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index db9ff5cf837..584dd82a9c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2007-04-18 Philippe De Muyter + + * config/m68k/m68k.c (output_btst): Use `movew to ccr' when useful. + 2007-04-18 Dirk Mueller PR diagnostic/31227 diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c index b450a424d68..2df2a7c8904 100644 --- a/gcc/config/m68k/m68k.c +++ b/gcc/config/m68k/m68k.c @@ -1550,6 +1550,27 @@ output_btst (rtx *operands, rtx countop, rtx dataop, rtx insn, int signpos) if (count == 7 && next_insn_tests_no_inequality (insn)) return "tst%.b %1"; + /* Try to use `movew to ccr' followed by the appropriate branch insn. + On some m68k variants unfortunately that's slower than btst. + On 68000 and higher, that should also work for all HImode operands. */ + if (TUNE_CPU32 || TARGET_COLDFIRE || optimize_size) + { + if (count == 3 && DATA_REG_P (operands[1]) + && next_insn_tests_no_inequality (insn)) + { + cc_status.flags = CC_NOT_NEGATIVE | CC_Z_IN_NOT_N | CC_NO_OVERFLOW; + return "move%.w %1,%%ccr"; + } + if (count == 2 && DATA_REG_P (operands[1]) + && next_insn_tests_no_inequality (insn)) + { + cc_status.flags = CC_NOT_NEGATIVE | CC_INVERTED | CC_NO_OVERFLOW; + return "move%.w %1,%%ccr"; + } + /* count == 1 followed by bvc/bvs and + count == 0 followed by bcc/bcs are also possible, but need + m68k-specific CC_Z_IN_NOT_V and CC_Z_IN_NOT_C flags. */ + } cc_status.flags = CC_NOT_NEGATIVE; }