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]

MIPS patch for gcc.c-torture/compile/20010107-1.c is wrong


Hi Richard,

Your patch

http://gcc.gnu.org/ml/gcc-patches/2001-06/msg01349.html

is incorrect. For

typedef void  *(*T)(void);
f1 ()
{
  ((T) 0)();
}

I got

# gcc -c -O calls.i
/tmp/ccW9Qp7b.s: Assembler messages:
/tmp/ccW9Qp7b.s:21: Error: opcode not supported on this processor: R3000 (MIPS1) `dla $25,0'


This updated patch works fine for me.


H.J.
---
2001-06-23  H.J. Lu <hjl@gnu.org>

        * config/mips/mips.md (call_internal1): Check CONST_INT first.
        (call_internal2): Likewise.
        (call_value_internal1): Likewise.
        (call_value_internal2): Likewise.
        (call_value_multiple_internal1): Likewise.
        (call_value_multiple_internal2): Likewise.

2001-06-21  Richard Sandiford  <rsandifo@redhat.com>

        * config/mips/mips.md (call_internal1): Use CONSTANT_ADDRESS_P
	to check for constant addresses.
        (call_internal2): Likewise.
        (call_value_internal1): Likewise.
        (call_value_internal2): Likewise.
        (call_value_multiple_internal1): Likewise.
        (call_value_multiple_internal2): Likewise.

--- gcc/config/mips/mips.md.call	Sat Jun 23 09:14:32 2001
+++ gcc/config/mips/mips.md	Sat Jun 23 09:17:25 2001
@@ -9519,10 +9519,10 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[0];
 
-  if (GET_CODE (target) == SYMBOL_REF)
-    return \"%*jal\\t%0\";
-  else if (GET_CODE (target) == CONST_INT)
+  if (GET_CODE (target) == CONST_INT)
     return \"%[li\\t%@,%0\\n\\t%*jal\\t%2,%@%]\";
+  else if (CONSTANT_ADDRESS_P (target))
+    return \"%*jal\\t%0\";
   else
     return \"%*jal\\t%2,%0\";
 }"
@@ -9538,15 +9538,15 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[0];
 
-  if (GET_CODE (target) == SYMBOL_REF)
+  if (GET_CODE (target) == CONST_INT)
+    return \"li\\t%^,%0\\n\\tjal\\t%2,%^\";
+  else if (CONSTANT_ADDRESS_P (target))
     {
       if (GET_MODE (target) == SImode)
 	return \"la\\t%^,%0\\n\\tjal\\t%2,%^\";
       else
 	return \"dla\\t%^,%0\\n\\tjal\\t%2,%^\";
     }
-  else if (GET_CODE (target) == CONST_INT)
-    return \"li\\t%^,%0\\n\\tjal\\t%2,%^\";
   else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
     return \"move\\t%^,%0\\n\\tjal\\t%2,%^\";
   else
@@ -9726,10 +9726,10 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[1];
 
-  if (GET_CODE (target) == SYMBOL_REF)
-    return \"%*jal\\t%1\";
-  else if (GET_CODE (target) == CONST_INT)
+  if (GET_CODE (target) == CONST_INT)
     return \"%[li\\t%@,%1\\n\\t%*jal\\t%3,%@%]\";
+  else if (CONSTANT_ADDRESS_P (target))
+    return \"%*jal\\t%1\";
   else
     return \"%*jal\\t%3,%1\";
 }"
@@ -9746,15 +9746,15 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[1];
 
-  if (GET_CODE (target) == SYMBOL_REF)
+  if (GET_CODE (target) == CONST_INT)
+    return \"li\\t%^,%1\\n\\tjal\\t%3,%^\";
+  else if (CONSTANT_ADDRESS_P (target))
     {
       if (GET_MODE (target) == SImode)
 	return \"la\\t%^,%1\\n\\tjal\\t%3,%^\";
       else
 	return \"dla\\t%^,%1\\n\\tjal\\t%3,%^\";
     }
-  else if (GET_CODE (target) == CONST_INT)
-    return \"li\\t%^,%1\\n\\tjal\\t%3,%^\";
   else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
     return \"move\\t%^,%1\\n\\tjal\\t%3,%^\";
   else
@@ -9858,10 +9858,10 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[1];
 
-  if (GET_CODE (target) == SYMBOL_REF)
-    return \"%*jal\\t%1\";
-  else if (GET_CODE (target) == CONST_INT)
+  if (GET_CODE (target) == CONST_INT)
     return \"%[li\\t%@,%1\\n\\t%*jal\\t%4,%@%]\";
+  else if (CONSTANT_ADDRESS_P (target))
+    return \"%*jal\\t%1\";
   else
     return \"%*jal\\t%4,%1\";
 }"
@@ -9881,15 +9881,15 @@ ld\\t%2,%1-%S1(%2)\;daddu\\t%2,%2,$31\;j
 {
   register rtx target = operands[1];
 
-  if (GET_CODE (target) == SYMBOL_REF)
+  if (GET_CODE (target) == CONST_INT)
+    return \"li\\t%^,%1\\n\\tjal\\t%4,%^\";
+  else if (CONSTANT_ADDRESS_P (target))
     {
       if (GET_MODE (target) == SImode)
 	return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
       else
 	return \"la\\t%^,%1\\n\\tjal\\t%4,%^\";
     }
-  else if (GET_CODE (target) == CONST_INT)
-    return \"li\\t%^,%1\\n\\tjal\\t%4,%^\";
   else if (REGNO (target) != PIC_FUNCTION_ADDR_REGNUM)
     return \"move\\t%^,%1\\n\\tjal\\t%4,%^\";
   else


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