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] Optimize X << Y with low bits of Y known to be 0 (PR tree-optimization/71563)


On Tue, 20 Dec 2016, Jakub Jelinek wrote:

If the shift count has enough known zero low bits (non-zero bits only
above the ceil_log2 (precision)), then the only valid shift count that
is not out of bounds is 0, so we can as well fold it into the first
argument of the shift.  This resolves a regression introduced by partly
optimizing it at the gimple level, which results in it not being optimized
at the RTL level that managed to do that completely.

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

2016-12-20  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/71563
	* match.pd: Simplify X << Y into X if Y is known to be 0 or
	out of range value - has low bits known to be zero.

Hello,

would it make sense to extend it to rotates later?

Note that you can write (shift @0 SSA_NAME@1) in the pattern instead of a separate test.

--
Marc Glisse


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