On Tue, Aug 8, 2017 at 3:00 AM, Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote: > 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. In truth, my real motivation is only apparent when looking at this patch and the following. The original complete pattern was: ((X << S) & (M' << S)) >> S with A = (X << S) and M = (M' << S) which now give: ((X << S) >> S) & M' and with the next patch will give (X & M'') & M' which will simplify to X & M''' But yes, these optimizations are worthwhile by themselves too because they create small(er) masks. -- Luc (A & M) >> S to (A >> S) & (M >> S) -- 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