aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c19
-rw-r--r--gcc/tree-vect-patterns.c21
4 files changed, 42 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index fd187b9..6793838 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
+ * tree-vect-patterns.c: Include predict.h.
+ (vect_recog_divmod_pattern): Restrict check for division support
+ to when optimizing for size.
+
+2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
+
* doc/sourcebuild.texi (vect_double_cond_arith: Document.
* gimple-match.h (gimple_match_op::MAX_NUM_OPS): Bump to 4.
(gimple_match_op::gimple_match_op): Add an overload for 4 operands.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c5b2c63..66296db 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
+ * gcc.dg/vect/bb-slp-div-1.c: New XFAILed test.
+
+2018-05-25 Richard Sandiford <richard.sandiford@linaro.org>
+
* lib/target-supports.exp
(check_effective_target_vect_double_cond_arith): New proc.
* gcc.dg/vect/vect-cond-arith-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c b/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c
new file mode 100644
index 0000000..65d83a4
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/bb-slp-div-1.c
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-msve-vector-bits=256" { target aarch64_sve } } */
+
+int x[8];
+
+void
+f (void)
+{
+ x[0] /= 2;
+ x[1] /= 3;
+ x[2] /= 4;
+ x[3] /= 5;
+ x[4] /= 6;
+ x[5] /= 7;
+ x[6] /= 8;
+ x[7] /= 9;
+}
+
+/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" { xfail *-*-* } } } */
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 75bf84b..6da784c 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "attribs.h"
#include "cgraph.h"
#include "omp-simd-clone.h"
+#include "predict.h"
/* Pattern recognition functions */
static gimple *vect_recog_widen_sum_pattern (vec<gimple *> *, tree *,
@@ -2674,15 +2675,19 @@ vect_recog_divmod_pattern (vec<gimple *> *stmts,
if (vectype == NULL_TREE)
return NULL;
- /* If the target can handle vectorized division or modulo natively,
- don't attempt to optimize this. */
- optab = optab_for_tree_code (rhs_code, vectype, optab_default);
- if (optab != unknown_optab)
+ if (optimize_bb_for_size_p (gimple_bb (last_stmt)))
{
- machine_mode vec_mode = TYPE_MODE (vectype);
- int icode = (int) optab_handler (optab, vec_mode);
- if (icode != CODE_FOR_nothing)
- return NULL;
+ /* If the target can handle vectorized division or modulo natively,
+ don't attempt to optimize this, since native division is likely
+ to give smaller code. */
+ optab = optab_for_tree_code (rhs_code, vectype, optab_default);
+ if (optab != unknown_optab)
+ {
+ machine_mode vec_mode = TYPE_MODE (vectype);
+ int icode = (int) optab_handler (optab, vec_mode);
+ if (icode != CODE_FOR_nothing)
+ return NULL;
+ }
}
prec = TYPE_PRECISION (itype);