aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-02-24 09:36:16 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2016-02-24 09:36:16 +0100
commit340fd4c9ce6f806f8943d01c89b1e03b314519e5 (patch)
treef97d67ca1002d6df826f5c5fa36b27dee372f699 /gcc
parent47d3fdb242c7374a6fe3e4b0981a70767bc585a2 (diff)
downloadgcc-340fd4c9ce6f806f8943d01c89b1e03b314519e5.zip
gcc-340fd4c9ce6f806f8943d01c89b1e03b314519e5.tar.gz
gcc-340fd4c9ce6f806f8943d01c89b1e03b314519e5.tar.bz2
re PR middle-end/69909 (wrong code with -Os and vectors @ x86_64)
PR middle-end/69909 * expr.c (expand_expr_real_1) <normal_inner_ref>: Avoid set_mem_attributes if tem is SSA_NAME which got expanded as a MEM. * gcc.dg/torture/pr69909.c: New test. Co-Authored-By: Richard Biener <rguenther@suse.de> From-SVN: r233656
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/expr.c6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr69909.c35
4 files changed, 53 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index dc87f1b..03f7a32 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2016-02-24 Jakub Jelinek <jakub@redhat.com>
+ Richard Biener <rguenth@suse.de>
+
+ PR middle-end/69909
+ * expr.c (expand_expr_real_1) <normal_inner_ref>: Avoid
+ set_mem_attributes if tem is SSA_NAME which got expanded
+ as a MEM.
+
2016-02-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/69907
diff --git a/gcc/expr.c b/gcc/expr.c
index 1b89a63..29d22b0 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -10521,7 +10521,11 @@ expand_expr_real_1 (tree exp, rtx target, machine_mode tmode,
if (op0 == orig_op0)
op0 = copy_rtx (op0);
- set_mem_attributes (op0, exp, 0);
+ /* Don't set memory attributes if the base expression is
+ SSA_NAME that got expanded as a MEM. In that case, we should
+ just honor its original memory attributes. */
+ if (TREE_CODE (tem) != SSA_NAME || !MEM_P (orig_op0))
+ set_mem_attributes (op0, exp, 0);
if (REG_P (XEXP (op0, 0)))
mark_reg_pointer (XEXP (op0, 0), MEM_ALIGN (op0));
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d716932..f09672b 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR middle-end/69909
+ * gcc.dg/torture/pr69909.c: New test.
+
2016-02-24 Richard Biener <rguenther@suse.de>
PR tree-optimization/69907
diff --git a/gcc/testsuite/gcc.dg/torture/pr69909.c b/gcc/testsuite/gcc.dg/torture/pr69909.c
new file mode 100644
index 0000000..fb36c80
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr69909.c
@@ -0,0 +1,35 @@
+/* PR middle-end/69909 */
+/* { dg-do run { target int128 } } */
+/* { dg-additional-options "-w" } */
+
+typedef unsigned V __attribute__ ((vector_size (32)));
+typedef __int128 T;
+typedef __int128 U __attribute__ ((vector_size (32)));
+
+__attribute__((noinline, noclone)) T
+foo (T a, V b, V c, V d, V e, U f)
+{
+ d[6] ^= 0x10;
+ f -= (U) d;
+ f[1] |= f[1] << (a & 127);
+ c ^= d;
+ return b[7] + c[2] + c[2] + d[6] + e[2] + f[1];
+}
+
+int
+main ()
+{
+ if (__CHAR_BIT__ != 8 || sizeof (unsigned) != 4 || sizeof (T) != 16)
+ return 0;
+
+ T x = foo (1, (V) { 9, 2, 5, 8, 1, 2, 9, 3 },
+ (V) { 1, 2, 3, 4, 5, 6, 7, 8 },
+ (V) { 4, 1, 2, 9, 8, 3, 5, 2 },
+ (V) { 3, 6, 1, 3, 2, 9, 4, 8 }, (U) { 3, 5 });
+ if (((unsigned long long) (x >> 64) != 0xffffffffffffffffULL
+ || (unsigned long long) x != 0xfffffffe0000001aULL)
+ && ((unsigned long long) (x >> 64) != 0xfffffffffffffffdULL
+ || (unsigned long long) x != 0xffffffff00000022ULL))
+ __builtin_abort ();
+ return 0;
+}