https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120553
--- Comment #6 from Jeffrey A. Law <law at gcc dot gnu.org> --- Note there's a variety of other twiddles that can be done here. If we want to select between -1 and any simm12, then that's srai+ori. We can select between any constant with a single bit off and 0 using srai+bclr. We can select between a simm12 and 0 using sria+andi. We can select between any constant with just high bits set and 0 with srai+slli. We can select between any constant with just low bits set and 0 with srai+srli. The last is particularly important for division by a power of 2 and is the subject of my next patch in this space :-) And there are almost certainly some 3 instruction sequences as well, though they are harder to handle if a purely target approach is taken.