On Tue, 10 Oct 2023, Roger Sayle wrote:
> > This patch is the middle-end piece of an improvement to PRs 101955 and > 106245, that adds a missing simplification to the RTL optimizers. > This transformation is to simplify (char)(x << 7) != 0 as x & 1. Random observation: So, why restrict to shifts of LEN-1 and mask 1? It's always the case that (type-of-LEN)(x << S)) != 0 === (x & ((1 << (LEN - S)) - 1)) != 0. E.g. (char)(x << 5) != 0 === (x & 7) != 0. (Eventually the mask will be a constant that's too costly to compute if S is target-dependendly too small, but all else being equal avoiding shifts seems sensible) Ciao, Michael.