s390.c (s390_secondary_output_reload_class): Adapt check for non-offsettable memory...
authorUlrich Weigand <uweigand@de.ibm.com>
Wed, 9 Mar 2005 22:05:15 +0000 (22:05 +0000)
committerUlrich Weigand <uweigand@gcc.gnu.org>
Wed, 9 Mar 2005 22:05:15 +0000 (22:05 +0000)
* config/s390/s390.c (s390_secondary_output_reload_class): Adapt check
for non-offsettable memory references to cope with outstanding reload
replacements.
* config/s390/s390.md ("reload_outti"): Call find_replacement to
avoid losing outstanding address reloads.
("reload_outdi", "reload_outdf"): Likewise.

testsuite/ChangeLog:

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

From-SVN: r96214

gcc/ChangeLog
gcc/config/s390/s390.c
gcc/config/s390/s390.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/20050309-1.c [new file with mode: 0644]

index dddd9ab..421d5c0 100644 (file)
@@ -1,3 +1,12 @@
+2005-03-09  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * config/s390/s390.c (s390_secondary_output_reload_class): Adapt check
+       for non-offsettable memory references to cope with outstanding reload
+       replacements.
+       * config/s390/s390.md ("reload_outti"): Call find_replacement to
+       avoid losing outstanding address reloads.
+       ("reload_outdi", "reload_outdf"): Likewise.
+
 2005-03-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * builtins.c (fold_builtin_cbrt, fold_builtin_pow): Rearrange
index a5896e8..3358f28 100644 (file)
@@ -2553,12 +2553,16 @@ enum reg_class
 s390_secondary_output_reload_class (enum reg_class class,
                                    enum machine_mode mode, rtx out)
 {
+  struct s390_address addr;
+
   if ((TARGET_64BIT ? mode == TImode
                     : (mode == DImode || mode == DFmode))
       && reg_classes_intersect_p (GENERAL_REGS, class)
       && GET_CODE (out) == MEM
-      && !offsettable_memref_p (out)
-      && !s_operand (out, VOIDmode))
+      && s390_decompose_address (XEXP (out, 0), &addr)
+      && addr.base && addr.indx
+      && addr.disp && GET_CODE (addr.disp) == CONST_INT
+      && !DISP_IN_RANGE (INTVAL (addr.disp) + GET_MODE_SIZE (mode) - 1))
     return ADDR_REGS;
 
   if (reg_classes_intersect_p (CC_REGS, class))
index a0b9a31..5bb9d4c 100644 (file)
   "TARGET_64BIT"
 {
   gcc_assert (MEM_P (operands[0]));
-  s390_load_address (operands[2], XEXP (operands[0], 0));
+  s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
   operands[0] = replace_equiv_address (operands[0], operands[2]);
   emit_move_insn (operands[0], operands[1]);
   DONE;
   "!TARGET_64BIT"
 {
   gcc_assert (MEM_P (operands[0]));
-  s390_load_address (operands[2], XEXP (operands[0], 0));
+  s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
   operands[0] = replace_equiv_address (operands[0], operands[2]);
   emit_move_insn (operands[0], operands[1]);
   DONE;
   "!TARGET_64BIT"
 {
   gcc_assert (MEM_P (operands[0]));
-  s390_load_address (operands[2], XEXP (operands[0], 0));
+  s390_load_address (operands[2], find_replacement (&XEXP (operands[0], 0)));
   operands[0] = replace_equiv_address (operands[0], operands[2]);
   emit_move_insn (operands[0], operands[1]);
   DONE;
index 9d40f91..2f2a431 100644 (file)
@@ -1,3 +1,7 @@
+2005-03-09  Ulrich Weigand  <uweigand@de.ibm.com>
+
+       * gcc.dg/20050309-1.c: New test.
+
 2005-03-09  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * gcc.dg/builtins-10.c: Reactivate disabled test.
diff --git a/gcc/testsuite/gcc.dg/20050309-1.c b/gcc/testsuite/gcc.dg/20050309-1.c
new file mode 100644 (file)
index 0000000..413930f
--- /dev/null
@@ -0,0 +1,37 @@
+/* This caused an ICE on s390 due to incorrect secondary
+   output reloads.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2 -fprofile-generate" } */
+
+char *
+test(char *ret, int *counter, void *schema,
+     const char* name, const char *namespace,
+     void *node, int topLevel)
+{
+  char buf[30];
+  int val;
+
+  if (counter == 0) return 0;
+  if (schema == 0) return 0;
+  if (name == 0) return 0;
+
+  __builtin_memset (ret, 0, 100);
+  lookup (schema, name, -1);
+  val = hash (schema, name, namespace, name, ret);
+  if (val == 0) return ret;
+
+  if (topLevel != 0)
+    {
+      error (1, 0, 0, node, "%s", name);
+      return 0;
+    }
+
+  __snprintf_chk (buf, 29, 1, 30, "#eCont %d", ++*counter);
+  val = hash (schema, name, buf, namespace, ret);
+  if (val == 0) return ret;
+
+  error (1, 0, 0, node, "%s", name);
+  return 0;
+}
+