Thumb1 has very limited immediate modes, so turning an "and" into a shift can save multiple instructions.
It's possible to simplify the generated code for test2 and test3 in cmp-and-fold.ll a little more, but I'll implement that as a followup.
Differential D65175
[ARM] Transform compare of masked value to shift on Thumb1. efriedma on Jul 23 2019, 5:06 PM. Authored by
Details Thumb1 has very limited immediate modes, so turning an "and" into a shift can save multiple instructions. It's possible to simplify the generated code for test2 and test3 in cmp-and-fold.ll a little more, but I'll implement that as a followup.
Diff Detail
Event Timeline
Comment Actions Any reason why not to use this for thumb2 as well? It looks like it would be useful for T2 codesize. Comment Actions
You can't save any instructions this way on Thumb2; every AND which can be transformed is a legal and/bic/bfc. I guess a narrow lsls+cmp is still two bytes shorter than bic+cmp.
|
I don't see any code implementing this case. Instead, there is a check that Mask > 65535, but this looks like it should still be profitable for masks between 255 and 65535.