]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/42448 (Wrong code with _Complex char in structure)
authorUros Bizjak <ubizjak@gmail.com>
Sat, 2 Jan 2010 14:32:23 +0000 (15:32 +0100)
committerUros Bizjak <uros@gcc.gnu.org>
Sat, 2 Jan 2010 14:32:23 +0000 (15:32 +0100)
PR target/42448
* config/alpha/predicates.md (aligned_memory_operand): Return false
for CQImode.
(unaligned_memory_operand): Return true for CQImode.
* config/alpha/alpha.c (get_aligned_mem): Assert that location
doesn not cross aligned SImode word boundary.

testsuite/ChangeLog:

PR target/42448
* gcc.target/alpha/pr42448-1.c: New test.
* gcc.target/alpha/pr42448-2.c: Ditto.

From-SVN: r155568

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/config/alpha/predicates.md
gcc/testsuite/gcc.target/alpha/pr42448-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/alpha/pr42448-2.c [new file with mode: 0644]

index 4d020f8b45254164c84dd6c3d45131afca7a1cfb..19276b5100062884eb7021e933030afce003d36a 100644 (file)
@@ -1,3 +1,12 @@
+2010-01-02  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/42448
+       * config/alpha/predicates.md (aligned_memory_operand): Return false
+       for CQImode.
+       (unaligned_memory_operand): Return true for CQImode.
+       * config/alpha/alpha.c (get_aligned_mem): Assert that location
+       doesn not cross aligned SImode word boundary.
+
 2009-12-30  Ian Lance Taylor  <iant@google.com>
 
        PR middle-end/42099
index 3faeb0745fb4a038e94053f7da05c0b80b694c97..06a6a27b24c00c6328fdc9391aa2d543c1cf4e39 100644 (file)
@@ -1456,6 +1456,10 @@ get_aligned_mem (rtx ref, rtx *paligned_mem, rtx *pbitnum)
   else
     offset = disp & 3;
 
+  /* The location should not cross aligned word boundary.  */
+  gcc_assert (offset + GET_MODE_SIZE (GET_MODE (ref))
+             <= GET_MODE_SIZE (SImode));
+
   /* Access the entire aligned word.  */
   *paligned_mem = widen_memory_access (ref, SImode, -offset);
 
index e8379e73dc0611c31be2ae528efd1f67f9c345e3..f7c231822a102c4049ba99c20ec1a64f9e7787d9 100644 (file)
 
   if (MEM_ALIGN (op) >= 32)
     return 1;
+
+  if (mode == CQImode)
+    return 0;
+
   op = XEXP (op, 0);
 
   /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo)
 
   if (MEM_ALIGN (op) >= 32)
     return 0;
+
+  if (mode == CQImode)
+    return 1;
+
   op = XEXP (op, 0);
 
   /* LEGITIMIZE_RELOAD_ADDRESS creates (plus (plus reg const_hi) const_lo)
diff --git a/gcc/testsuite/gcc.target/alpha/pr42448-1.c b/gcc/testsuite/gcc.target/alpha/pr42448-1.c
new file mode 100644 (file)
index 0000000..4e2c376
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-mcpu=21064 -O0" } */
+
+extern void abort (void);
+
+struct S2180
+{
+  char t;
+  _Complex char u[2];
+};
+
+struct S2180 s2180;
+
+int
+main (void)
+{
+  volatile struct S2180 x;
+
+  s2180.u[1] = 3 + 4i;
+
+  x.u[1] = s2180.u[1];
+
+  if (x.u[1] != s2180.u[1])
+    abort ();
+
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/alpha/pr42448-2.c b/gcc/testsuite/gcc.target/alpha/pr42448-2.c
new file mode 100644 (file)
index 0000000..aeebad2
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do run } */
+/* { dg-options "-mcpu=21064 -O0" } */
+
+extern void abort (void);
+
+struct S2180
+{
+  char t;
+  _Complex char u[4];
+};
+
+struct S2180 s2180;
+
+int
+main (void)
+{
+  volatile struct S2180 x;
+
+  s2180.u[3] = 3 + 4i;
+
+  x.u[3] = s2180.u[3];
+
+  if (x.u[3] != s2180.u[3])
+    abort ();
+
+  return 0;
+}