Committed (vectorizable_comparison): Swap operands only once.

Message ID 5D250EA8.90102@riscy-ip.com
State New
Headers show
Series
  • Committed (vectorizable_comparison): Swap operands only once.
Related show

Commit Message

Joern Wolfgang Rennecke July 9, 2019, 10:01 p.m.
For gcc.dg/vect/vect-bool-cmp.c, vectorizable_comparison would swap the 
comparison operands
in fn7 once for each copy, thus all odd copies would end up unswapped.
Regression tested on x86_64-pc-linux-gnu.
Committed as obvious.
2019-07-09  Joern Rennecke  <joern.rennecke@riscy-ip.com>

	* tree-vect-stmts.c (vectorizable_comparison) <!slp_node>:
	Swap operands only once.

Patch

Index: tree-vect-stmts.c
===================================================================
--- tree-vect-stmts.c	(revision 273313)
+++ tree-vect-stmts.c	(working copy)
@@ -10369,7 +10369,7 @@  vectorizable_comparison (stmt_vec_info s
 
       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);