On Thu, Oct 14, 2021 at 11:06 AM Andrew MacLeod via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > As the PR observes, if the first operand of a right shift is 0 or -1, > operand 2 doesn't matter and the result will be the same as op1, so it > can be turned into a copy. > > This patch checks for that condition and performs the operation in EVRP. > > Bootstrapped on x86_64-pc-linux-gnu with no regressions. Pushed. > > Andrew >
/* PR tree-optimization/102738 */ +/* { dg-options "-O2 -fdump-tree-evrp" } */ + +/* Remove arithmetic shift right when the LHS is known to be 0 or -1. */ + +int a1(__int128 f, int g) Missing /* { dg-do compile { target int128 } } */ -- H.J.