https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103905
--- Comment #2 from Uroš Bizjak <ubizjak at gmail dot com> --- The referred patch adds: +;; Pack/unpack vector modes +(define_mode_attr mmxpackmode + [(V4HI "V8QI") (V2SI "V4HI")]) + +(define_expand "vec_pack_trunc_<mode>" + [(match_operand:<mmxpackmode> 0 "register_operand") + (match_operand:MMXMODE24 1 "register_operand") + (match_operand:MMXMODE24 2 "register_operand")] + "TARGET_MMX_WITH_SSE" +{ + rtx op1 = gen_lowpart (<mmxpackmode>mode, operands[1]); + rtx op2 = gen_lowpart (<mmxpackmode>mode, operands[2]); + ix86_expand_vec_extract_even_odd (operands[0], op1, op2, 0); + DONE; +}) Can you confirm by disabling the above expander (add "0 &&" before TARGET_MMX_WITH_SSE) that this is the real problem? Also, this expander can be split in order to figure out which mode is the problematic one. Other than that, can you debug if there is a difference in what ix86_expand_vec_extract_even_odd passes to expand_vec_perm_1 and expand_vec_perm_even_odd_1 when compiled with -O2 vs -O3?