PR80131: Simplification of 1U << (31 - x)
commit4349b15f97fcbb6b7cdd96bb5bff0af1eb78e653
authorSudakshina Das <sudi.das@arm.com>
Tue, 7 Nov 2017 12:23:38 +0000 (7 12:23 +0000)
committerWilco Dijkstra <wilco@gcc.gnu.org>
Tue, 7 Nov 2017 12:23:38 +0000 (7 12:23 +0000)
tree42fa37718305129f4e755dba2412234ea69883f1
parente268a77b59cb788637d6db4829f0fd1ddf63f6f2
PR80131: Simplification of 1U << (31 - x)

Currently the code A << (B - C) is not simplified.
However at least a more specific case of 1U << (C -x) where
C = precision(type) - 1 can be simplified to (1 << C) >> x.

This is done by adding a new simplification rule in match.pd.

2017-11-07  Sudakshina Das  <sudi.das@arm.com>

    gcc/
PR middle-end/80131
* match.pd: Simplify 1 << (C - x) where C = precision (x) - 1.

    testsuite/
PR middle-end/80131
* testsuite/gcc.dg/pr80131-1.c: New Test.

From-SVN: r254496
gcc/ChangeLog
gcc/match.pd
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr80131-1.c [new file with mode: 0644]