https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125567
--- Comment #2 from Zhongyao Chen <chenzhongyao.hit at gmail dot com> --- current swap logic is guarded by `!vect_def_types_match (oprnd_info->first_dt, dt)` in vect_get_and_check_slp_defs. in this testcase, _7 and tmp.1_8 are both internal type, so didn't triger swap. maybe we can add a small heuristic here: even if the types match, if swapping the current lane makes one operand line up exactly with the same operand column of the first lane, then we still swap. Here, after swapping, `tmp.1_8` lines up exactly with the same operand column as in the first lane. Of course, that does not have to be the only rule, we can extend it later.
