This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Optimize X << Y with low bits of Y known to be 0 (PR tree-optimization/71563)
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Richard Biener <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Dec 2016 21:30:17 +0100 (CET)
- Subject: Re: [PATCH] Optimize X << Y with low bits of Y known to be 0 (PR tree-optimization/71563)
- Authentication-results: sourceware.org; auth=none
- References: <20161220190933.GO21933@tucnak>
- Reply-to: gcc-patches at gcc dot gnu dot org
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