https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93512
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Segher said he thinks that ROTATE/ROTATERT on all targets will do the truncation, so it is just a matter of proving that. Sure, one can add explictly patterns like (define_insn "rotl<mode>3_cntmask" [(set (match_operand:GPR 0 "gpc_reg_operand" "=r") (rotate:GPR (match_operand:GPR 1 "gpc_reg_operand" "r") (and:SI (match_operand:SI 2 "reg_or_cint_operand" "rn") (match_operand:SI 3 "const_int_operand" "n")))] "UINTVAL (operands[3]) == GET_MODE_MASK (<MODE>mode)" "rotl<wd>%I2 %0,%1,%<hH>2" [(set_attr "type" "shift") (set_attr "maybe_var_shift" "yes")]) and e.g. i386 target already does for a few patterns (but not all). But: $ find config -name \*.md | xargs grep '(rotate:' | wc -l 139 $ find config -name \*.md | xargs grep '(rotatert:' | wc -l 64 and that still doesn't include when rotates are macroized.