https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110235
--- Comment #4 from ktkachov at gcc dot gnu.org --- (In reply to Hongtao.liu from comment #3) > (In reply to Hongtao.liu from comment #2) > > FAIL: gcc.target/i386/avx2-vpackssdw-2.c execution test > > > > This one is about sign saturation which should match rtl SS_TRUNCATE. > > I realize for 256-bit/512-bit vpackssdw, it's an 128-bit iterleave of src1 > and src2, and then ss_truncate to the dest, not just vec_concat src1 and > src2. So the simplification exposed the bug. Thanks for looking at it. I think it'd make sense for someone with x86/sse/avx experience to rewrite the RTL representation of the patterns involved to match the correct semantics for saturation and lane behaviour. Alternatively, a quick solution would be to convert uses of us_truncate/ss_truncate in the problematic patterns to an x86-specific UNSPEC, which would make things work like they did before the simplification was added. That would be just a stop-gap solution as it's better to use standard RTL operations where possible.