m68k.c (output_btst): Use `movew to ccr' when useful.

2007-04-18  Philippe De Muyter  <phdm@macqel.be>

	* config/m68k/m68k.c (output_btst): Use `movew to ccr' when useful.

From-SVN: r123959
This commit is contained in:
Philippe De Muyter 2007-04-18 22:51:42 +02:00 committed by Philippe De Muyter
parent 05fb69e4c9
commit 5083912dfa
2 changed files with 25 additions and 0 deletions

View file

@ -1,3 +1,7 @@
2007-04-18 Philippe De Muyter <phdm@macqel.be>
* config/m68k/m68k.c (output_btst): Use `movew to ccr' when useful.
2007-04-18 Dirk Mueller <dmueller@suse.de>
PR diagnostic/31227

View file

@ -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;
}