alpha.c (some_small_symbolic_mem_operand): Look into (and:DI () (const_int -8)).
authorJakub Jelinek <jakub@redhat.com>
Wed, 16 Jan 2002 19:01:31 +0000 (20:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 16 Jan 2002 19:01:31 +0000 (20:01 +0100)
* config/alpha/alpha.c (some_small_symbolic_mem_operand): Look into
(and:DI () (const_int -8)).
(split_small_symbolic_mem_operand): Split
(mem (and:DI () (const_int -8)).

* gcc.dg/20020116-1.c: New test.

From-SVN: r48920

gcc/ChangeLog
gcc/config/alpha/alpha.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20020116-1.c [new file with mode: 0644]

index 17bc386..9cb28ee 100644 (file)
@@ -1,5 +1,12 @@
 2002-01-16  Jakub Jelinek  <jakub@redhat.com>
 
+       * config/alpha/alpha.c (some_small_symbolic_mem_operand): Look into
+       (and:DI () (const_int -8)).
+       (split_small_symbolic_mem_operand): Split
+       (mem (and:DI () (const_int -8)).
+
+2002-01-16  Jakub Jelinek  <jakub@redhat.com>
+
        PR target/5309:
         * config/sparc/sparc.c (ultrasparc_adjust_cost): Handle TYPE_IDIV the
        same way as TYPE_IMUL.
index c409fbb..8204c78 100644 (file)
@@ -1878,8 +1878,16 @@ some_small_symbolic_mem_operand (x, mode)
   while (GET_RTX_CLASS (GET_CODE (x)) == '1')
     x = XEXP (x, 0);
 
-  return (GET_CODE (x) == MEM
-         && small_symbolic_operand (XEXP (x, 0), Pmode));
+  if (GET_CODE (x) != MEM)
+    return 0;
+
+  x = XEXP (x, 0);
+  /* If this is an ldq_u type address, discard the outer AND.  */
+  if (GET_CODE (x) == AND && GET_MODE (x) == DImode
+      && GET_CODE (XEXP (x, 1)) == CONST_INT
+      && INTVAL (XEXP (x, 1)) == -8)
+    x = XEXP (x, 0);
+  return small_symbolic_operand (x, Pmode);
 }
 
 rtx
@@ -1890,7 +1898,17 @@ split_small_symbolic_mem_operand (x)
 
   if (GET_CODE (x) == MEM)
     {
-      rtx tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, XEXP (x, 0));
+      rtx tmp = XEXP (x, 0);
+
+      if (GET_CODE (tmp) == AND && GET_MODE (tmp) == DImode
+         && GET_CODE (XEXP (tmp, 1)) == CONST_INT
+         && INTVAL (XEXP (tmp, 1)) == -8)
+       {
+         tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, XEXP (tmp, 0));
+         tmp = gen_rtx_AND (DImode, tmp, GEN_INT (-8));
+       }
+      else
+       tmp = gen_rtx_LO_SUM (DImode, pic_offset_table_rtx, tmp);
       return replace_equiv_address (x, tmp);
     }
 
index 8aa2757..0e049be 100644 (file)
@@ -1,10 +1,10 @@
 2002-01-16  Jakub Jelinek  <jakub@redhat.com>
 
-       * gcc.dg/ultrasp4.c: New test.
+       * gcc.dg/20020116-2.c: New test.
 
-2002-01-16  Jakub Jelinek  <jakub@redhat.com>
+       * gcc.dg/ultrasp4.c: New test.
 
-       * gcc.dg/20020116-2.c: New test.
+       * gcc.dg/20020116-1.c: New test.
 
 2002-01-15  Geoffrey Keating  <geoffk@redhat.com>
 
diff --git a/gcc/testsuite/gcc.dg/20020116-1.c b/gcc/testsuite/gcc.dg/20020116-1.c
new file mode 100644 (file)
index 0000000..d554675
--- /dev/null
@@ -0,0 +1,16 @@
+/* This testcase ICEd on Alpha because ldq_u argument was not subject to
+   small_symbolic_mem_operand splitting.  */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-options "-O2 -fpic -mexplicit-relocs -mcpu=ev4" { target alpha*-*-* } } */
+
+static char a;
+char *b;
+
+void foo (void)
+{
+  register char *c;
+
+  c = b;
+  *c = a;
+}