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 PR34114/1]More multiple_of_p cases.


Hi,
This is prerequisite patch for fixing PR34114 which reveals a weakness of GCC in analyzing niter for loop with NE_EXPR exit condition.  For such loops, we quite often need to check if delta (final - start) of loop range is multiple of IV's step.  This patch proves multiple_of_p (top, bottom) for more cases:
  1) Handle (X + 4294967293) as (X - 3) if the expression is of unsigned int type.  At the moment it's not recognized because (4294967293 % 3 != 0)
  2) Handle top var if it's defined as:
       top = (X & ~(bottom - 1) ; bottom is power of 2
  3) Handle top var if it's defined as:
       Y = X % bottom
       top = X - Y

Bootstrap and test on x86_64 and AArch64 along with next patch.  Is it OK?

Thanks,
bin

2016-07-27  Bin Cheng  <bin.cheng@arm.com>

	* fold-const.c (multiple_of_p): Improve MULT_EXPR, PLUS_EXPR,
	PLUS_EXPR case.  Handle SSA_NAME case.

Attachment: more-multiple_of_p-cases-20160724.txt
Description: more-multiple_of_p-cases-20160724.txt


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