On Mon, Aug 7, 2017 at 5:22 PM, Christopher Li <sparse@xxxxxxxxxxx> wrote: > > Why (A>>S) & (M >>S) is easier to simplify? > > The original has two instruction but the result has three. No, M and S are constants, so the end result also has just two ("lsr" and "and"). And the simplified form has a smaller constant. So I think that optimization makes a lot of sense. It *might* result in further simplifications just because the final 'and' might be simpler, and even the "A >> S" might now be something you can simplify (for example "A >> 16" could be turned into a 16-bit load if the source of A is a 32-bit load). But even in the absence of such further simplification, the smaller constant thing likely makes it worth it. Almost all architectures have an easier time with smaller constants, and doing (a >> 24) & 255; is often noticeably more efficient than (a & 0xff000000) >> 24; just because of the constant issue. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html