[ColdFire 39/63] Fix mov3q handling

Richard Sandiford richard@codesourcery.com
Wed Jan 10 11:53:00 GMT 2007


m68k.md has a separate *movsi_cfv4 pattern that differs *movsi_cf
only in the addition of 'R' constraints.  It seems fairly obvious
from context that 'R' was supposed to be a mov3q constant, but
nothing actually defines it.

This patch maps 'R' to valid_mov3q_const.  Because valid_mov3q_const
checks the architecture itself, there's no need for a separate pattern;
we can use the *movsi_cfv4 form for other ColdFire targets too.
Also, the 'R' in the first *movsi_cfv4 alternative is redundant,
as 'R' implies 'g'.

Richard


gcc/
200x-xx-xx  Richard Sandiford  <richard@codesourcery.com>
	    Julian Brown  <julian@codesourcery.com>

	* config/m68k/m68k.h (CONST_OK_FOR_LETTER_P): Add an 'R' case.
	* config/m68k/m68k.md (*movsi_cfv4): Fold into...
	(*movsi_cf): ...here.  Remove unnecessary 'R' from 'Rg'.
	Add commentary.

Index: gcc/config/m68k/m68k.h
===================================================================
--- gcc/config/m68k/m68k.h	2007-01-09 15:02:15.000000000 +0000
+++ gcc/config/m68k/m68k.h	2007-01-09 15:02:17.000000000 +0000
@@ -494,7 +494,8 @@ #define REG_CLASS_FROM_LETTER(C) \
    `M' is for numbers that moveq+notb can't handle.
    'N' is for range 24 to 31, rotatert:SI 8 to 1 expressed as rotate.
    'O' is for 16 (for rotate using swap).
-   'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate.  */
+   'P' is for range 8 to 15, rotatert:HI 8 to 1 expressed as rotate.
+   'R' is for numbers that mov3q can handle.  */
 #define CONST_OK_FOR_LETTER_P(VALUE, C) \
   ((C) == 'I' ? (VALUE) > 0 && (VALUE) <= 8 : \
    (C) == 'J' ? (VALUE) >= -0x8000 && (VALUE) <= 0x7FFF : \
@@ -503,7 +504,8 @@ #define CONST_OK_FOR_LETTER_P(VALUE, C) 
    (C) == 'M' ? (VALUE) < -0x100 || (VALUE) >= 0x100 : \
    (C) == 'N' ? (VALUE) >= 24 && (VALUE) <= 31 : \
    (C) == 'O' ? (VALUE) == 16 : \
-   (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : 0)
+   (C) == 'P' ? (VALUE) >= 8 && (VALUE) <= 15 : \
+   (C) == 'R' ? valid_mov3q_const (VALUE) : 0)
 
 /* "G" defines all of the floating constants that are *NOT* 68881
    constants.  This is so 68881 constants get reloaded and the
Index: gcc/config/m68k/m68k.md
===================================================================
--- gcc/config/m68k/m68k.md	2007-01-09 15:02:16.000000000 +0000
+++ gcc/config/m68k/m68k.md	2007-01-09 15:02:17.000000000 +0000
@@ -696,16 +696,11 @@ (define_insn "*movsi_smallconst"
   return output_move_simode (operands);
 })
 
+;; ColdFire move instructions can have at most one operand of mode >= 6.
 (define_insn "*movsi_cf"
   [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
-	(match_operand:SI 1 "general_operand" "g,r<Q>,U"))]
-  "TARGET_COLDFIRE && !TARGET_ISAB"
-  "* return output_move_simode (operands);")
-
-(define_insn "*movsi_cfv4"
-  [(set (match_operand:SI 0 "nonimmediate_operand" "=r<Q>,g,U")
-	(match_operand:SI 1 "general_operand" "Rg,Rr<Q>,U"))]
-  "TARGET_ISAB"
+	(match_operand:SI 1 "general_operand" "g,Rr<Q>,U"))]
+  "TARGET_COLDFIRE"
   "* return output_move_simode (operands);")
 
 ;; Special case of fullword move, where we need to get a non-GOT PIC



More information about the Gcc-patches mailing list