[Patch match.pd] Fold (A / (1 << B)) to (A >> B)
For the testcase in the patch:
unsigned long
f2 (unsigned long a, int b)
{
unsigned long x = 1UL << b;
return a / x;
}
We currently generate an unsigned division and a left shift, where
we could instead generate a right shift.
gcc/
2017-06-21 James Greenhalgh <james.greenhalgh@arm.com>
* match.pd (A / (1 << B) -> A >> B): New.
* generic-match-head.c: Include optabs-tree.h.
* gimple-match-head.c: Likewise.
* optabs-tree.h (target_supports_op_p): New.
* optabs-tree.c (target_supports_op_p): New.
gcc/testsuite/
2017-06-21 James Greenhalgh <james.greenhalgh@arm.com>
* gcc.dg/tree-ssa/forwprop-37.c: New.
From-SVN: r249502