Commit e65bf4e8 by Kyrylo Tkachov Committed by Kyrylo Tkachov

[RTL-ifcvt] Make non-conditional execution if-conversion more aggressive

	* ifcvt.c (struct noce_if_info): Add then_simple, else_simple,
	then_cost, else_cost fields.  Change branch_cost field to unsigned
	int.
	(end_ifcvt_sequence): Call set_used_flags on each insn in the
	sequence.
	Include rtl-iter.h.
	(noce_simple_bbs): New function.
	(noce_try_move): Bail if basic blocks are not simple.
	(noce_try_store_flag): Likewise.
	(noce_try_store_flag_constants): Likewise.
	(noce_try_addcc): Likewise.
	(noce_try_store_flag_mask): Likewise.
	(noce_try_cmove): Likewise.
	(noce_try_minmax): Likewise.
	(noce_try_abs): Likewise.
	(noce_try_sign_mask): Likewise.
	(noce_try_bitop): Likewise.
	(bbs_ok_for_cmove_arith): New function.
	(noce_emit_all_but_last): Likewise.
	(noce_emit_insn): Likewise.
	(noce_emit_bb): Likewise.
	(noce_try_cmove_arith): Handle non-simple basic blocks.
	(insn_valid_noce_process_p): New function.
	(contains_mem_rtx_p): Likewise.
	(bb_valid_for_noce_process_p): Likewise.
	(noce_process_if_block): Allow non-simple basic blocks
	where appropriate.

	* gcc.dg/ifcvt-1.c: New test.
	* gcc.dg/ifcvt-2.c: Likewise.
	* gcc.dg/ifcvt-3.c: Likewise.

From-SVN: r227368
parent 26742138
2015-09-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* ifcvt.c (struct noce_if_info): Add then_simple, else_simple,
then_cost, else_cost fields. Change branch_cost field to unsigned
int.
(end_ifcvt_sequence): Call set_used_flags on each insn in the
sequence.
Include rtl-iter.h.
(noce_simple_bbs): New function.
(noce_try_move): Bail if basic blocks are not simple.
(noce_try_store_flag): Likewise.
(noce_try_store_flag_constants): Likewise.
(noce_try_addcc): Likewise.
(noce_try_store_flag_mask): Likewise.
(noce_try_cmove): Likewise.
(noce_try_minmax): Likewise.
(noce_try_abs): Likewise.
(noce_try_sign_mask): Likewise.
(noce_try_bitop): Likewise.
(bbs_ok_for_cmove_arith): New function.
(noce_emit_all_but_last): Likewise.
(noce_emit_insn): Likewise.
(noce_emit_bb): Likewise.
(noce_try_cmove_arith): Handle non-simple basic blocks.
(insn_valid_noce_process_p): New function.
(contains_mem_rtx_p): Likewise.
(bb_valid_for_noce_process_p): Likewise.
(noce_process_if_block): Allow non-simple basic blocks
where appropriate.
2015-08-31 Alan Lawrence <alan.lawrence@arm.com>
* tree-ssa-dom.c (record_equivalences_from_phis,
......
2015-09-01 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.dg/ifcvt-1.c: New test.
* gcc.dg/ifcvt-2.c: Likewise.
* gcc.dg/ifcvt-3.c: Likewise.
2015-09-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
PR libfortran/67412
......
/* { dg-do compile { target aarch64*-*-* x86_64-*-* } } */
/* { dg-options "-fdump-rtl-ce1 -O2" } */
int
foo (int x)
{
return x > 100 ? x - 2 : x - 1;
}
/* { dg-final { scan-rtl-dump "3 true changes made" "ce1" } } */
/* { dg-do compile { target aarch64*-*-* x86_64-*-* } } */
/* { dg-options "-fdump-rtl-ce1 -O2" } */
typedef unsigned char uint8_t;
typedef unsigned int uint16_t;
uint8_t
_xtime (const uint8_t byte, const uint16_t generator)
{
if (byte & 0x80)
return byte ^ generator;
else
return byte << 1;
}
/* { dg-final { scan-rtl-dump "3 true changes made" "ce1" } } */
/* { dg-do compile { target aarch64*-*-* x86_64-*-* } } */
/* { dg-options "-fdump-rtl-ce1 -O2" } */
typedef long long s64;
int
foo (s64 a, s64 b, s64 c)
{
s64 d = a - b;
if (d == 0)
return a + c;
else
return b + d + c;
}
/* This test can be reduced to just return a + c; */
/* { dg-final { scan-rtl-dump "3 true changes made" "ce1" } } */
/* { dg-final { scan-assembler-not "sub\.*\tx\[0-9\]+, x\[0-9\]+, x\[0-9\]+\.*" { target { aarch64*-*-* } } } } */
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