https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99396
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|libstdc++ |tree-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-03-05 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- return std::rotr(v,((unsigned int)t)&63); Fixes the problem .... int a = std::abs(t); a &= 63; return std::rotr(v,a); Also improves the situtation. I am thinking the std::rotr could be rewritten or we could optimize this at the tree level into the almost the intrinsics. Note I think I Might have gotten the above incorrect a little bit.