https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119539
--- Comment #3 from Uroš Bizjak <ubizjak at gmail dot com> --- Comment on attachment 60925 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=60925 Untested fix >+;; Avoid useless masking of count operand. >+(define_insn_and_split "*<insn><mode>3_mask_nf" >+ [(set (match_operand:SWI 0 "nonimmediate_operand") >+ (any_rotate:SWI >+ (match_operand:SWI 1 "nonimmediate_operand") >+ (subreg:QI >+ (and >+ (match_operand 2 "int248_register_operand" "c") >+ (match_operand 3 "const_int_operand")) 0)))] >+ "ix86_binary_operator_ok (<CODE>, <MODE>mode, operands) >+ && (INTVAL (operands[3]) & (GET_MODE_BITSIZE (<MODE>mode)-1)) >+ == GET_MODE_BITSIZE (<MODE>mode)-1 >+ && ix86_pre_reload_split ()" >+ "#" >+ "&& 1" >+ [(set (match_dup 0) >+ (any_rotate:SWI (match_dup 1) >+ (match_dup 2)))] >+{ >+ operands[2] = force_reg (GET_MODE (operands[2]), operands[2]); >+ operands[2] = gen_lowpart (QImode, operands[2]); Here you can use force_lowpart_subreg.