[SH][committed] Handle cmoves in sh_treg_combine pass

Oleg Endo oleg.endo@t-online.de
Wed Dec 17 23:14:00 GMT 2014


Hi,

The test case gcc.target/sh/pr52933-2.c has been failing for a while.
This is because the sh_treg_combine pass optimizes only cbranches but
not cmoves, which on SH are zero-displacement cbranches.  The attached
patch makes sh_treg_combine also handle cmoves.  This eliminates the
need for some combine patterns in sh.md and fixes the failing test case.
Tested with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r218850.

Cheers,
Oleg

gcc/ChangeLog:
	PR target/51244
	* config/sh/sh_treg_combine.cc (is_conditional_insn): New function.
	(cbranch_trace): Add member rtx* condition_rtx_in_insn, initialize it
	accordingly in constructor.
	(cbranch_trace::branch_condition_rtx_ref): New function.
	(cbranch_trace::branch_condition_rtx): Use branch_condition_rtx_ref.
	(sh_treg_combine::try_invert_branch_condition): Invert condition rtx
	in insn using reversed_comparison_code and validate_change instead of
	invert_jump_1.
	(sh_treg_combine::execute): Look for conditional insns in basic blocks
	in addition to conditional branches.
	* config/sh/sh.md (*movsicc_div0s): Remove combine patterns.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sh_pr51244_13_handle_cmoves.patch
Type: text/x-patch
Size: 5550 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20141217/4389cdb9/attachment.bin>


More information about the Gcc-patches mailing list