https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99396
--- Comment #4 from cqwrteur <unlvsur at live dot com> --- (In reply to Andrew Pinski from comment #3) > (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. but if it is constant, it would get optimized to just ror or rol