This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[committed] Re: [RHBZ#150115, s390] reload_out* patterns emit unrecognizable insn


> Here's the patch (untested as of now).  Once testing completes
> I'll be checking it in:

Here's the version I've committed.

Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux 
on mainline and 4.0 branch, committed to both.

Bye,
Ulrich


ChangeLog:

	* 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.


Index: gcc/config/s390/s390.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.c,v
retrieving revision 1.217
diff -c -p -r1.217 s390.c
*** gcc/config/s390/s390.c	17 Feb 2005 20:40:12 -0000	1.217
--- gcc/config/s390/s390.c	8 Mar 2005 22:32:40 -0000
*************** enum reg_class
*** 2553,2564 ****
  s390_secondary_output_reload_class (enum reg_class class,
  				    enum machine_mode mode, rtx out)
  {
    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))
      return ADDR_REGS;
  
    if (reg_classes_intersect_p (CC_REGS, class))
--- 2553,2568 ----
  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
!       && 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: gcc/config/s390/s390.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390.md,v
retrieving revision 1.154
diff -c -p -r1.154 s390.md
*** gcc/config/s390/s390.md	18 Feb 2005 21:11:04 -0000	1.154
--- gcc/config/s390/s390.md	8 Mar 2005 22:32:41 -0000
***************
*** 833,839 ****
    "TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[0]));
!   s390_load_address (operands[2], XEXP (operands[0], 0));
    operands[0] = replace_equiv_address (operands[0], operands[2]);
    emit_move_insn (operands[0], operands[1]);
    DONE;
--- 833,839 ----
    "TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[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;
***************
*** 992,998 ****
    "!TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[0]));
!   s390_load_address (operands[2], XEXP (operands[0], 0));
    operands[0] = replace_equiv_address (operands[0], operands[2]);
    emit_move_insn (operands[0], operands[1]);
    DONE;
--- 992,998 ----
    "!TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[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;
***************
*** 1451,1457 ****
    "!TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[0]));
!   s390_load_address (operands[2], XEXP (operands[0], 0));
    operands[0] = replace_equiv_address (operands[0], operands[2]);
    emit_move_insn (operands[0], operands[1]);
    DONE;
--- 1451,1457 ----
    "!TARGET_64BIT"
  {
    gcc_assert (MEM_P (operands[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;
*** /dev/null	Tue Oct 26 21:02:43 2004
--- gcc/testsuite/gcc.dg/20050309-1.c	Wed Mar  9 16:01:55 2005
***************
*** 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;
+ }
+ 


-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]