]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/16719 ([ColdFire] Illegal move of byte itno address register...
authorBernardo Innocenti <bernie@develer.com>
Tue, 26 Jul 2005 20:32:25 +0000 (22:32 +0200)
committerBernardo Innocenti <bernie@gcc.gnu.org>
Tue, 26 Jul 2005 20:32:25 +0000 (22:32 +0200)
Backport from mainline:
2005-07-12  Peter Barada  <peter@the-baradas.com>
PR middle-end/16719
PR middle-end/18421
* config/m68k/m68k.h (HARD_REGNO_MODE_OK): Disallow bytes
in address registers.
* config/m68k/m68k.c (hard_regno_mode_ok): Likewise.
* config/m68k/m68k.md: Replace 's' with 'i' in 4th
alternative of addsi3_5200.

From-SVN: r102396

gcc/ChangeLog
gcc/config/m68k/m68k-protos.h
gcc/config/m68k/m68k.c
gcc/config/m68k/m68k.h
gcc/config/m68k/m68k.md

index 6cf42ad2ebf04a43d6c67fbce6560a7697379911..72fba35bca1498cff7d8c20e3b276055ea92ea00 100644 (file)
@@ -1,3 +1,15 @@
+2005-07-26  Bernardo Innocenti  <bernie@develer.com>
+
+       Backport from mainline:
+       2005-07-12  Peter Barada  <peter@the-baradas.com>
+       PR middle-end/16719
+       PR middle-end/18421
+       * config/m68k/m68k.h (HARD_REGNO_MODE_OK): Disallow bytes
+       in address registers.
+       * config/m68k/m68k.c (hard_regno_mode_ok): Likewise.
+       * config/m68k/m68k.md: Replace 's' with 'i' in 4th
+       alternative of addsi3_5200.
+
 2005-07-21  Janis Johnson  <janis187@us.ibm.com>
 
        PR target/20191
index 52aa89726dbdaa676fff9109ad28b0ca0bba418a..9a55d314c2bda96d15e528c0e559dc042b50de73 100644 (file)
@@ -62,6 +62,7 @@ extern rtx legitimize_pic_address (rtx, enum machine_mode, rtx);
 
 #endif /* RTX_CODE */
 
+extern bool m68k_regno_mode_ok (int, enum machine_mode);
 extern int flags_in_68881 (void);
 extern bool use_return_insn (void);
 extern void override_options (void);
index c1595f98e5fec21552330cdcffc5da70cd57ca50..800fa3962c4c3bba7440e6526f25f88a50e112ac 100644 (file)
@@ -3541,3 +3541,36 @@ m68k_hard_regno_rename_ok (unsigned int old_reg ATTRIBUTE_UNUSED,
 
   return 1;
 }
+
+/* Value is true if hard register REGNO can hold a value of machine-mode MODE.
+   On the 68000, the cpu registers can hold any mode except bytes in address
+   registers, but the 68881 registers can hold only SFmode or DFmode.  */
+bool
+m68k_regno_mode_ok (int regno, enum machine_mode mode)
+{
+  if (regno < 8)
+    {
+       /* Data Registers, can hold aggregate if fits in.  */
+       if (regno + GET_MODE_SIZE (mode) / 4 <= 8)
+         return true;
+    }
+  else if (regno < 16)
+    {
+       /* Address Registers, can't hold bytes, can hold aggregate if
+          fits in.  */
+       if (GET_MODE_SIZE (mode) == 1)
+         return false;
+       if (regno + GET_MODE_SIZE (mode) / 4 <= 16)
+         return true;
+    }
+  else if (regno < 24)
+    {
+      /* FPU registers, hold float or complex float of long double or
+          smaller.  */
+       if ((GET_MODE_CLASS (mode) == MODE_FLOAT
+            || GET_MODE_CLASS (mode) == MODE_COMPLEX_FLOAT)
+           && GET_MODE_UNIT_SIZE (mode) <= 12)
+         return true;
+    }
+  return false;
+}
index e2252446e8f8a662218f451b71f081e849c4673e..f5fb1914a5036ae48cb22ce5fc5274a0c8dac3a8 100644 (file)
@@ -555,17 +555,11 @@ extern int target_flags;
   m68k_hard_regno_rename_ok (OLD_REG, NEW_REG)
 
 /* Value is 1 if hard register REGNO can hold a value of machine-mode MODE.
-   On the 68000, the cpu registers can hold any mode but the 68881 registers
-   can hold only SFmode or DFmode.  */
+   On the 68000, the cpu registers can hold any mode except bytes in
+   address registers, the 68881 registers can hold only SFmode or DFmode.  */
 
 #define HARD_REGNO_MODE_OK(REGNO, MODE) \
-  (((REGNO) < 16                                       \
-    && !((REGNO) < 8 && (REGNO) + GET_MODE_SIZE (MODE) / 4 > 8))       \
-   || ((REGNO) >= 16 && (REGNO) < 24                                   \
-       && (GET_MODE_CLASS (MODE) == MODE_FLOAT         \
-          || GET_MODE_CLASS (MODE) == MODE_COMPLEX_FLOAT)              \
-       && GET_MODE_UNIT_SIZE (MODE) <= 12))
-
+  m68k_regno_mode_ok ((REGNO), (MODE))
 
 /* Value is 1 if it is a good idea to tie two pseudo registers
    when one has mode MODE1 and one has mode MODE2.
index f6bea19c75a6efa01b83aefd068a0e68d7049bb3..68ea933007d83aa1928f4c278c3cf743b3344f5e 100644 (file)
 (define_insn "*addsi3_5200"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=m,?a,?a,r")
        (plus:SI (match_operand:SI 1 "general_operand" "%0,a,rJK,0")
-                (match_operand:SI 2 "general_src_operand" "d,rJK,a,mrIKLs")))]
+                (match_operand:SI 2 "general_src_operand" "d,rJK,a,mrIKLi")))]
   "TARGET_COLDFIRE"
   "* return output_addsi3 (operands);")