This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fr30: Do not split immediate loads unless the destination is a register
- From: Richard Henderson <rth at redhat dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 16 May 2002 23:50:37 -0700
- Subject: Re: fr30: Do not split immediate loads unless the destination is a register
- References: <m3znz4mi8z.fsf@north-pole.nickc.cambridge.redhat.com>
On Mon, May 13, 2002 at 11:53:16AM +0100, Nick Clifton wrote:
> - "INTVAL (operands[1]) <= -1 && INTVAL (operands[1]) >= -128"
> + "INTVAL (operands[1]) <= -1 && INTVAL (operands[1]) >= -128
> + && GET_CODE (operands[0]) == REG"
> [(set:SI (match_dup 0) (match_dup 2))
> (set:SI (match_dup 0) (sign_extend:SI (subreg:QI (match_dup 0) 0)))]
The correct solution is to not blindly add the subreg,
but rather to use gen_lowpart. I.e.
(define_split
[(set (match_operand:SI 0 "register_operand" "")
(match_operand:SI 1 "const_int_operand" ""))]
"INTVAL (operands[1]) <= -1 && INTVAL (operands[1]) >= -128"
[(set:SI (match_dup 0) (match_dup 1))
(set:SI (match_dup 0) (sign_extend:SI (match_dup 2)))]
{
operands[1] = GEN_INT (INTVAL (operands[1]) & 0xff);
operands[2] = gen_lowpart (QImode, operands[0]);
})
Note also the use of const_int_operand instead of immediate_operand.
r~