Hi,

the problem has been already discussed some time
ago "upstream", now ocatve triggered the bug so
it seems the fix should be backported to 3.3

octave problem
  http://lists.debian.org/debian-68k/2005/02/msg00049.html

gcc discussion
  http://gcc.gnu.org/ml/gcc/2004-03/msg00940.html
  http://gcc.gnu.org/ml/gcc/2004-03/msg01007.html
  http://gcc.gnu.org/ml/gcc/2004-03/msg01011.html

Attached patches, one per 3.3 and 3.4. I am leaving
tomorrow so the patches are essentially untested
although I have used very similar patch for 3.4 
since almost a year.

Richard
--- gcc-3.3.1/gcc/config/m68k/m68k.md.rz        Wed Mar  2 00:49:35 2005
+++ gcc-3.3.1/gcc/config/m68k/m68k.md   Wed Mar  2 01:06:29 2005
@@ -1750,11 +1750,20 @@
   "*
 {
   CC_STATUS_INIT;
-  operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
-  if (TARGET_68020 || TARGET_5200)
-    return \"move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0\";
+  if (ADDRESS_REG_P(operands[1]))
+    {
+      if (TARGET_68020 || TARGET_5200)
+        return \"move%.w %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0\";
+      else
+        return \"move%.w %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi 
%0\";
+    }
   else
-    return \"move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0\";
+    {
+      if (TARGET_68020 || TARGET_5200)
+        return \"move%.b %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0\";
+      else
+        return \"move%.b %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi 
%0\";
+    }
 }")
 
 (define_insn "extendhidi2"
--- gcc-3.4-20040218/gcc/config/m68k/m68k.md.rz Wed Mar  2 00:17:11 2005
+++ gcc-3.4-20040218/gcc/config/m68k/m68k.md    Wed Mar  2 00:21:36 2005
@@ -1454,11 +1454,20 @@
   ""
 {
   CC_STATUS_INIT;
-  operands[2] = gen_rtx_REG (SImode, REGNO (operands[0]) + 1);
-  if (TARGET_68020 || TARGET_COLDFIRE)
-    return "move%.b %1,%2\;extb%.l %2\;smi %0\;extb%.l %0";
+  if (ADDRESS_REG_P(operands[1]))
+    {
+      if (TARGET_68020 || TARGET_COLDFIRE)
+        return "move%.w %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0";
+      else
+        return "move%.w %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi 
%0";
+    }
   else
-    return "move%.b %1,%2\;ext%.w %0\;ext%.l %2\;move%.l %2,%0\;smi %0";
+    {
+      if (TARGET_68020 || TARGET_COLDFIRE)
+        return "move%.b %1,%R0\;extb%.l %R0\;smi %0\;extb%.l %0";
+      else
+        return "move%.b %1,%R0\;ext%.w %R0\;ext%.l %R0\;move%.l %R0,%0\;smi 
%0";
+    }
 })
 
 (define_insn "extendhidi2"

Reply via email to