This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [m68k] Add 'R' constraint for ColdFire V4 mov3q.l instruction
- From: Hans-Peter Nilsson <hp at bitrange dot com>
- To: Peter Barada <peter at the-baradas dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 Sep 2004 22:35:08 -0400 (EDT)
- Subject: Re: [m68k] Add 'R' constraint for ColdFire V4 mov3q.l instruction
- References: <20040729154225.545E1990F4@baradas.org>
On Thu, 29 Jul 2004, Peter Barada wrote:
> This patch adds the 'R' constriant to qualify mov3q.l constants as a
> source for the ColdFire V4 mov3q.l instruction
>
> Built uberbaum tree with it.
>
> gcc/
> 2004-07-29 Peter Barada <peter@the-baradas.com>
>
> * config/m68k/m68k.h: (EXTRA_CONSTRAINT): Add 'R' for mov3q
> constants
Looks like nobody reviewed this?
> Index: gcc/config/m68k/m68k.h
> ===================================================================
> RCS file: /cvs/uberbaum/gcc/config/m68k/m68k.h,v
> retrieving revision 1.119
> diff -c -3 -p -r1.119 m68k.h
> *** gcc/config/m68k/m68k.h 27 Jul 2004 21:41:21 -0000 1.119
> --- gcc/config/m68k/m68k.h 29 Jul 2004 15:37:48 -0000
> *************** extern enum reg_class regno_reg_class[];
> *** 595,604 ****
> --- 595,610 ----
> ((C) == 'G' ? ! (TARGET_68881 && standard_68881_constant_p (VALUE)) : 0 )
>
> /* `Q' means address register indirect addressing mode.
> + `R' is for operands that are valid constants of mov3q.l
> `S' is for operands that satisfy 'm' when -mpcrel is in effect.
> `T' is for operands that satisfy 's' when -mpcrel is not in effect.
> `U' is for register offset addressing. */
> #define EXTRA_CONSTRAINT(OP,CODE) \
> + ((((CODE) == 'R') && TARGET_CFV4) \
> + ? (GET_CODE (OP) == CONST_INT \
> + && (INTVAL (OP) == -1 \
> + || (INTVAL (OP) >= 1 && INTVAL (OP) <= 7))) \
> + : \
Since this is a CONST_INT, and you're out of
CONST_OK_FOR_LETTER_P letters, I'd recommend defining
CONST_OK_FOR_CONSTRAINT_P instead (and making one of the
existing CONST_OK_FOR_LETTER_P letters multi-letter).
Benefit: GCC will know that only a CONST_INT can match.
Caveat: editing...
Beware: you can't have both CONST_OK_FOR_LETTER_P and
CONST_OK_FOR_CONSTRAINT_P and there's no check for that; the
CONST_OK_FOR_LETTER_P definition will be unused.
(You might have considered this, but you didn't mention that.)
brgds, H-P