https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99396
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to cqwrteur from comment #2) > I would like to see __builtin_cpp_rotl and __builtin_cpp_rotr to allow more > aggressive optimizations since rotl and rotr are so important for > cryptography. You don't need them. The following code will already produce the rotate instruction: auto f3(std::size_t v, int t) { return (v<<t) | (v>>(sizeof(v)*8 - t)); } Note std::rotl/std::rotr has specific behavior dealing with 0 and negative values and all.