This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH GCC]Move simplification from fold-cond.c to match.pd and extend it


Hi,
This is a rework of https://gcc.gnu.org/ml/gcc-patches/2016-10/msg02005.html.  According to review comment, I extended the original patch and made it covering last kind simplification of fold_cond_expr_with_comparison (Well, this patch handles <, <=, > and >=.  == will be handled by a follow up).  This patch also adds several tests, some tests are for existing fold_cond_expr_with_comparison simplification but not covered yet; others are for new extension.
Bootstrap and test on x86_64 and AArch64 along with following patches, is it OK?

Thanks,
bin

2016-11-16  Bin Cheng  <bin.cheng@arm.com>

	* fold-const.c (fold_cond_expr_with_comparison): Move simplification
	for A cmp C1 ? A : C2 to below, also simplify remaining code.
	* match.pd: Move and extend simplification from above to here:
	(cond (cmp (convert1? x) c1) (convert2? x) c2) -> (minmax (x c)).
	* tree-if-conv.c (ifcvt_follow_ssa_use_edges): New func.
	(predicate_scalar_phi): Call fold_stmt using the new valueize func.

gcc/testsuite/ChangeLog
2016-11-16  Bin Cheng  <bin.cheng@arm.com>

	* gcc.dg/fold-cond_expr-1.c: New test.
	* gcc.dg/fold-condcmpconv-1.c: New test.
	* gcc.dg/fold-condcmpconv-2.c: New test.
	* gcc.dg/tree-ssa/pr66726.c: Adjust test strings.

Attachment: 02-simplify-cond_expr-to-minmax-20161117.txt
Description: 02-simplify-cond_expr-to-minmax-20161117.txt


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]