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]

Re: [PATCH] Fix simplify_shift_const_1 once more (PR rtl-optimization/70429)


On 03/29/2016 11:21 AM, Jakub Jelinek wrote:
Hi!

This is a case similar to the LSHIFTRT I've fixed recently.
But, unlike LSHIFTRT, which can be handled by masking at the outer level,
ASHIFTRT would need outer sign extension, so most of the time 2 outer
operations in addition to the kept two inner shifts, which is IMHO very
unlikely to ever be successfully combined on any target nor actually
beneficial.  So this patch just avoids that optimization for ASHIFTRT
if there are different modes.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2016-03-29  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/70429
	* combine.c (simplify_shift_const_1): For ASHIFTRT don't optimize
	(cst1 >> count) >> cst2 into (cst1 >> cst2) >> count if
	mode != result_mode.

	* gcc.c-torture/execute/pr70429.c: New test.
But isn't the point of this code that cst1 >> cst2 turns into a compile time constant just leaving one runtime shift of the result by count?


Jeff


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