This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: fr30: Do not split immediate loads unless the destination is a register


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]