https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120553
--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> --- (In reply to Richard Biener from comment #1) > might be also interesting on x86-64 when using bts can use a smaller > immediate than the now used orq and thus improve instruction size (but it > clobbers flags). Sorry for hijacking this PR to implement the above suggestion. I hope that x86 implementation can serve as an example for RISC-V. BTW: Please note that for 32-bit immediates the size difference between OR and BTS is one single byte on x86_64, but BTS is slightly slower than OR. For 64-bit exact-log2 immediates, the patched compiler can avoid CMOV and MOVABS, and even for non-exact-log2 immediates, it can avoid somehow problematic CMOV.