Skip to content
Snippets Groups Projects
Commit af19e46c authored by Richard Sandiford's avatar Richard Sandiford
Browse files

Try to simplify (X >> C1) * (C2 << C1) -> X * C2

This patch adds a rule to simplify (X >> C1) * (C2 << C1) -> X * C2
when the low C1 bits of X are known to be zero.  As with the earlier
X >> C1 << (C2 + C1) patch, any single conversion is allowed between
the shift and the multiplication.

gcc/
	* match.pd: Simplify (X >> C1) * (C2 << C1) -> X * C2 if the
	low C1 bits of X are zero.

gcc/testsuite/
	* gcc.dg/tree-ssa/shifts-3.c: New test.
	* gcc.dg/tree-ssa/shifts-4.c: Likewise.
	* gcc.target/aarch64/sve/cnt_fold_5.c: Likewise.
parent d6c4badf
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment