aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2015-11-10 09:43:54 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2015-11-10 09:43:54 +0000
commita6524bba206a001a83e60548007f92c701cd0a86 (patch)
tree3b9cc5b589d61eba67688f2a1f9cc1e6c00f7ebf /gcc
parent3204ac9868cc02eacd88abf30b7e64a479beb3fe (diff)
downloadgcc-a6524bba206a001a83e60548007f92c701cd0a86.zip
gcc-a6524bba206a001a83e60548007f92c701cd0a86.tar.gz
gcc-a6524bba206a001a83e60548007f92c701cd0a86.tar.bz2
re PR tree-optimization/56118 (Piecewise vector / complex initialization from constants not combined)
2015-11-10 Richard Biener <rguenther@suse.de> PR tree-optimization/56118 * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Make equal cost favor vectorized version. * gcc.target/i386/pr56118.c: New testcase. From-SVN: r230091
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.target/i386/pr56118.c17
-rw-r--r--gcc/tree-vect-slp.c9
4 files changed, 34 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 5a7e44c..6816374 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/56118
+ * tree-vect-slp.c (vect_bb_vectorization_profitable_p): Make equal
+ cost favor vectorized version.
+
2015-11-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.md (<neg_not_op><mode>cc): New define_expand.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5c258f4..bbaf9a3 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-10 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/56118
+ * gcc.target/i386/pr56118.c: New testcase.
+
2015-11-10 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/cond_op_imm_1.c: New test.
diff --git a/gcc/testsuite/gcc.target/i386/pr56118.c b/gcc/testsuite/gcc.target/i386/pr56118.c
new file mode 100644
index 0000000..11a543c
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr56118.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -msse2" } */
+
+#include <emmintrin.h>
+
+__m128d f()
+{
+ __m128d r={3,4};
+ r[0]=1;
+ r[1]=2;
+ return r;
+}
+
+/* We want to "vectorize" this to a aligned vector load from the
+ constant pool. */
+
+/* { dg-final { scan-assembler "movapd" } } */
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 954b85e..6dda2ec 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2317,9 +2317,12 @@ vect_bb_vectorization_profitable_p (bb_vec_info bb_vinfo)
dump_printf (MSG_NOTE, " Scalar cost of basic block: %d\n", scalar_cost);
}
- /* Vectorization is profitable if its cost is less than the cost of scalar
- version. */
- if (vec_outside_cost + vec_inside_cost >= scalar_cost)
+ /* Vectorization is profitable if its cost is more than the cost of scalar
+ version. Note that we err on the vector side for equal cost because
+ the cost estimate is otherwise quite pessimistic (constant uses are
+ free on the scalar side but cost a load on the vector side for
+ example). */
+ if (vec_outside_cost + vec_inside_cost > scalar_cost)
return false;
return true;