aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/m68k/m68k.c
diff options
context:
space:
mode:
authorPeter Barada <peter@the-baradas.com>2004-06-16 21:53:46 +0000
committerBernardo Innocenti <bernie@gcc.gnu.org>2004-06-16 23:53:46 +0200
commit5e04daf3171dcb6095a9ee91fe09bf5a70df43a0 (patch)
tree43559396a2e98ef9733950984ee8c75db769667c /gcc/config/m68k/m68k.c
parent8c16199578ee7b0bcc94a807373569055678d042 (diff)
downloadgcc-5e04daf3171dcb6095a9ee91fe09bf5a70df43a0.zip
gcc-5e04daf3171dcb6095a9ee91fe09bf5a70df43a0.tar.gz
gcc-5e04daf3171dcb6095a9ee91fe09bf5a70df43a0.tar.bz2
m68k.md (movsi_cfv4): New pattern to allow mov3q.
* config/m68k/m68k.md (movsi_cfv4): New pattern to allow mov3q. (movsi_cf): Make named, don't match TARGET_CFV4. (pushexthisi_const): Use mov3q if possible. (extendhisi2, cvf4_extendhisi2): Split extendhisi2 pattern to special case mvz.w for ColdFire V4. (extendqisi2, cvf4_extendqisi2): Split extendhisi2 pattern to special case mvz.b for ColdFire V4. (udivmodhi4, divmodhi4): Use mvz to zero extend arg for divide. (iorsi3, xorsi3, andsi3): Use bitfield instructions if possible. * config/m68k/m68k.c(valid_mov3q_const): New function. (const_method): SWAP is valid for ColdFire. (MULL_COST, MULW_COST): Fix costs for ColdFire V3/V4. * config/m68k/m68k-protos.h (valid_mov3q_const): Prototype here. From-SVN: r83266
Diffstat (limited to 'gcc/config/m68k/m68k.c')
-rw-r--r--gcc/config/m68k/m68k.c45
1 files changed, 37 insertions, 8 deletions
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index da17f65..8ad252f 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -1447,12 +1447,13 @@ const_method (rtx constant)
/* This is the only value where neg.w is useful */
if (i == -65408)
return NEGW;
- /* Try also with swap */
- u = i;
- if (USE_MOVQ ((u >> 16) | (u << 16)))
- return SWAP;
}
+ /* Try also with swap. */
+ u = i;
+ if (USE_MOVQ ((u >> 16) | (u << 16)))
+ return SWAP;
+
if (TARGET_CFV4)
{
/* Try using MVZ/MVS with an immediate value to load constants. */
@@ -1524,9 +1525,9 @@ m68k_rtx_costs (rtx x, int code, int outer_code, int *total)
for add and the time for shift, taking away a little more because
sometimes move insns are needed. */
/* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms. */
-#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : TARGET_CFV3 ? 3 : TARGET_COLDFIRE ? 10 : 13)
+#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : (TARGET_COLDFIRE && !TARGET_5200) ? 3 : TARGET_COLDFIRE ? 10 : 13)
#define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : \
- TARGET_CFV3 ? 2 : 5)
+ (TARGET_COLDFIRE && !TARGET_5200) ? 2 : 5)
#define DIVW_COST (TARGET_68020 ? 27 : TARGET_CF_HWDIV ? 11 : 12)
case PLUS:
@@ -1651,6 +1652,23 @@ output_move_const_into_data_reg (rtx *operands)
}
}
+/* Return 1 if 'constant' can be represented by
+ mov3q on a ColdFire V4 core. */
+int
+valid_mov3q_const (rtx constant)
+{
+ int i;
+
+ if (TARGET_CFV4 && GET_CODE (constant) == CONST_INT)
+ {
+ i = INTVAL (constant);
+ if ((i == -1) || (i >= 1 && i <= 7))
+ return 1;
+ }
+ return 0;
+}
+
+
const char *
output_move_simode_const (rtx *operands)
{
@@ -1663,6 +1681,9 @@ output_move_simode_const (rtx *operands)
|| !(GET_CODE (operands[0]) == MEM
&& MEM_VOLATILE_P (operands[0]))))
return "clr%.l %0";
+ else if ((GET_MODE (operands[0]) == SImode)
+ && valid_mov3q_const (operands[1]))
+ return "mov3q%.l %1,%0";
else if (operands[1] == const0_rtx
&& ADDRESS_REG_P (operands[0]))
return "sub%.l %0,%0";
@@ -1671,13 +1692,21 @@ output_move_simode_const (rtx *operands)
else if (ADDRESS_REG_P (operands[0])
&& INTVAL (operands[1]) < 0x8000
&& INTVAL (operands[1]) >= -0x8000)
- return "move%.w %1,%0";
+ {
+ if (valid_mov3q_const (operands[1]))
+ return "mov3q%.l %1,%0";
+ return "move%.w %1,%0";
+ }
else if (GET_CODE (operands[0]) == MEM
&& GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
&& REGNO (XEXP (XEXP (operands[0], 0), 0)) == STACK_POINTER_REGNUM
&& INTVAL (operands[1]) < 0x8000
&& INTVAL (operands[1]) >= -0x8000)
- return "pea %a1";
+ {
+ if (valid_mov3q_const (operands[1]))
+ return "mov3q%.l %1,%-";
+ return "pea %a1";
+ }
return "move%.l %1,%0";
}