https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69810
--- Comment #7 from David Edelsohn <dje at gcc dot gnu.org> --- Created attachment 37755 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37755&action=edit extqihi patch Because this idiom occurs so rarely (like never, except for an artificial csmith testcase :-), the easiest solution that preserves the optimization seems to be a patch that changes the splitter to a normal combiner pattern and emits the extend and compare instructions as a single output template. The operand is correctly sign-extended to SImode, the "HImode" temporary holds an SImode value, and the compare instruction can use the "HImode" value as input, but it is difficult to represent this in a pattern. So punt.