https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89954
--- Comment #8 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Uroš Bizjak from comment #7) > Created attachment 51496 [details] > Prototype patch +;; convert (sign_extend:WIDE (any_logic:NARROW (memory, immediate))) +;; to (any_logic:WIDE (sign_extend (memory)), (sign_extend (immediate))). +;; This eliminates sign extension after logic operation. + +(define_split + [(set (match_operand:SWI248 0 "register_operand") + (sign_extend:SWI248 + (any_logic:QI (match_operand:QI 1 "memory_operand") + (match_operand:QI 2 "const_int_operand"))))] + "" + [(set (match_dup 0) (any_logic:SWI248 (match_dup 0) (match_dup 2)))] + "convert_move (operands[0], operands[1], false);") Shouldn't we make sure (any_logic op1 const_int) would change sign bit of op1?