aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2017-01-25 12:30:41 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2017-01-25 12:30:41 +0000
commitc287389223fd552ef5b5d126f0b38d3a61337477 (patch)
tree08b96969ab8ba3ee47ab40747bc7b01a1188b120 /gcc
parentb3f1c7e908c2505e52bd090a4b40346daa4f8851 (diff)
downloadgcc-c287389223fd552ef5b5d126f0b38d3a61337477.zip
gcc-c287389223fd552ef5b5d126f0b38d3a61337477.tar.gz
gcc-c287389223fd552ef5b5d126f0b38d3a61337477.tar.bz2
re PR target/69264 (ICE building spidermonkey -mcpu=970 -maltivec -O3: rs6000_builtin_vectorization_cost, at config/rs6000/rs6000.c:4350)
2017-01-25 Richard Biener <rguenther@suse.de> PR tree-optimization/69264 * target.def (vector_alignment_reachable): Improve documentation. * doc/tm.texi: Regenerate. * targhooks.c (default_builtin_vector_alignment_reachable): Simplify and add a comment. * tree-vect-data-refs.c (vect_supportable_dr_alignment): Revert earlier changes with respect to TYPE_USER_ALIGN. (vector_alignment_reachable_p): Likewise. Improve dumping. * g++.dg/torture/pr69264.C: New testcase. From-SVN: r244897
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/doc/tm.texi2
-rw-r--r--gcc/target.def4
-rw-r--r--gcc/targhooks.c16
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/torture/pr69264.C81
-rw-r--r--gcc/tree-vect-data-refs.c21
7 files changed, 111 insertions, 29 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6bd1c69..7e0b4c6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2017-01-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69264
+ * target.def (vector_alignment_reachable): Improve documentation.
+ * doc/tm.texi: Regenerate.
+ * targhooks.c (default_builtin_vector_alignment_reachable): Simplify
+ and add a comment.
+ * tree-vect-data-refs.c (vect_supportable_dr_alignment): Revert
+ earlier changes with respect to TYPE_USER_ALIGN.
+ (vector_alignment_reachable_p): Likewise. Improve dumping.
+
2016-01-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/79145
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 4b62e05..909589c 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -5745,7 +5745,7 @@ misalignment value (@var{misalign}).
@end deftypefn
@deftypefn {Target Hook} bool TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE (const_tree @var{type}, bool @var{is_packed})
-Return true if vector alignment is reachable (by peeling N iterations) for the given type.
+Return true if vector alignment is reachable (by peeling N iterations) for the given scalar type @var{type}. @var{is_packed} is false if the scalar access using @var{type} is known to be naturally aligned.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_VECTORIZE_VEC_PERM_CONST_OK (machine_mode, const unsigned char *@var{sel})
diff --git a/gcc/target.def b/gcc/target.def
index 0443390..7308da1 100644
--- a/gcc/target.def
+++ b/gcc/target.def
@@ -1801,10 +1801,10 @@ misalignment value (@var{misalign}).",
default_builtin_vectorization_cost)
/* Return true if vector alignment is reachable (by peeling N
- iterations) for the given type. */
+ iterations) for the given scalar type. */
DEFHOOK
(vector_alignment_reachable,
- "Return true if vector alignment is reachable (by peeling N iterations) for the given type.",
+ "Return true if vector alignment is reachable (by peeling N iterations) for the given scalar type @var{type}. @var{is_packed} is false if the scalar access using @var{type} is known to be naturally aligned.",
bool, (const_tree type, bool is_packed),
default_builtin_vector_alignment_reachable)
diff --git a/gcc/targhooks.c b/gcc/targhooks.c
index 2f2abd3..1cdec06 100644
--- a/gcc/targhooks.c
+++ b/gcc/targhooks.c
@@ -1127,20 +1127,12 @@ default_vector_alignment (const_tree type)
return align;
}
+/* By default assume vectors of element TYPE require a multiple of the natural
+ alignment of TYPE. TYPE is naturally aligned if IS_PACKED is false. */
bool
-default_builtin_vector_alignment_reachable (const_tree type, bool is_packed)
+default_builtin_vector_alignment_reachable (const_tree /*type*/, bool is_packed)
{
- if (is_packed)
- return false;
-
- /* Assuming that types whose size is > pointer-size are not guaranteed to be
- naturally aligned. */
- if (tree_int_cst_compare (TYPE_SIZE (type), bitsize_int (POINTER_SIZE)) > 0)
- return false;
-
- /* Assuming that types whose size is <= pointer-size
- are naturally aligned. */
- return true;
+ return ! is_packed;
}
/* By default, assume that a target supports any factor of misalignment
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9eb748f..43e18fe 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-25 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/69264
+ * g++.dg/torture/pr69264.C: New testcase.
+
2016-01-25 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
PR target/79145
diff --git a/gcc/testsuite/g++.dg/torture/pr69264.C b/gcc/testsuite/g++.dg/torture/pr69264.C
new file mode 100644
index 0000000..4375380
--- /dev/null
+++ b/gcc/testsuite/g++.dg/torture/pr69264.C
@@ -0,0 +1,81 @@
+// { dg-do compile }
+// { dg-additional-options "-mcpu=970 -maltivec" { target powerpc*-*-* } }
+
+typedef union {
+ long int asBits;
+} jsval_layout;
+static jsval_layout STRING_TO_JSVAL_IMPL() {}
+
+typedef __attribute__ ((aligned(sizeof (long int)))) long int jsval;
+class Value {
+public:
+ void setString() {
+ data = STRING_TO_JSVAL_IMPL();
+ }
+ jsval_layout data;
+} __attribute__ ((aligned(8)));
+
+static Value StringValue()
+{
+ Value v;
+ v.setString();
+ return v;
+}
+
+static const jsval & Jsvalify(const Value & v)
+{
+ return (const jsval &)v;
+}
+
+static Value *Valueify(jsval *v)
+{
+ return (Value *) v;
+}
+
+struct JSObject {
+ void getQNameLocalName();
+};
+static Value IdToValue(int id)
+{
+ if (id)
+ return StringValue();
+}
+
+static jsval IdToJsval(int id)
+{
+ return Jsvalify(IdToValue(id));
+}
+
+class AutoGCRooter;
+struct JSContext {
+ AutoGCRooter *autoGCRooters;
+};
+class AutoGCRooter {
+public:
+ AutoGCRooter(JSContext *cx) {}
+};
+class AutoArrayRooter:AutoGCRooter {
+public:
+ AutoArrayRooter(JSContext *cx, Value *vec):AutoGCRooter(cx)
+ {
+ array = vec;
+ cx->autoGCRooters = this;
+ }
+ Value *array;
+};
+
+static void PutProperty(JSContext *cx, int id, jsval *vp)
+{
+ JSObject *nameobj;
+ jsval roots[3];
+ roots[1] = IdToJsval(id);
+ roots[2] = *vp;
+ AutoArrayRooter tvr(cx, Valueify(roots));
+ nameobj->getQNameLocalName();
+}
+
+void xml_defineProperty(JSContext *cx, int id, const Value *v)
+{
+ jsval tmp = Jsvalify(*v);
+ PutProperty(cx, id, &tmp);
+}
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index c1fbbc9..33a32b8 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -1098,12 +1098,9 @@ vector_alignment_reachable_p (struct data_reference *dr)
bool is_packed = not_size_aligned (DR_REF (dr));
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Unknown misalignment, is_packed = %d\n",is_packed);
- if ((TYPE_USER_ALIGN (type) && !is_packed)
- || targetm.vectorize.vector_alignment_reachable (type, is_packed))
- return true;
- else
- return false;
+ "Unknown misalignment, %snaturally aligned\n",
+ is_packed ? "not " : "");
+ return targetm.vectorize.vector_alignment_reachable (type, is_packed);
}
return true;
@@ -6153,10 +6150,8 @@ vect_supportable_dr_alignment (struct data_reference *dr,
if (!known_alignment_for_access_p (dr))
is_packed = not_size_aligned (DR_REF (dr));
- if ((TYPE_USER_ALIGN (type) && !is_packed)
- || targetm.vectorize.
- support_vector_misalignment (mode, type,
- DR_MISALIGNMENT (dr), is_packed))
+ if (targetm.vectorize.support_vector_misalignment
+ (mode, type, DR_MISALIGNMENT (dr), is_packed))
/* Can't software pipeline the loads, but can at least do them. */
return dr_unaligned_supported;
}
@@ -6168,10 +6163,8 @@ vect_supportable_dr_alignment (struct data_reference *dr,
if (!known_alignment_for_access_p (dr))
is_packed = not_size_aligned (DR_REF (dr));
- if ((TYPE_USER_ALIGN (type) && !is_packed)
- || targetm.vectorize.
- support_vector_misalignment (mode, type,
- DR_MISALIGNMENT (dr), is_packed))
+ if (targetm.vectorize.support_vector_misalignment
+ (mode, type, DR_MISALIGNMENT (dr), is_packed))
return dr_unaligned_supported;
}