This backport contains 1 patch from gcc main stream tree. The commit id of these patchs list as following in the order of time. a0aeb7fb93da156b64fd08391c79ff35a69af7ba 0001-tree-vect-stmts.c-vectorizable_comparison-Swap-opera.patch diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index e921225b5ec..601a6f55fbf 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -10369,7 +10369,7 @@ vectorizable_comparison (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, if (!slp_node) { - if (swap_p) + if (swap_p && j == 0) std::swap (vec_rhs1, vec_rhs2); vec_oprnds0.quick_push (vec_rhs1); vec_oprnds1.quick_push (vec_rhs2);