On Tue, Apr 8, 2008 at 8:32 PM, Ian Lance Taylor <[EMAIL PROTECTED]> wrote:
> "Mohamed Shafi" <[EMAIL PROTECTED]> writes:
>
>
> > Like you said i tried to split the move_immediate pattern after
> > reload. This is how i did this :
> >
> > (define_split
> > [(set (match_operand:HI 0 "register_operand" "")
> > (match_operand:HI 1 "immediate_operand" ""))]
> > "reload_completed"
> > [(set (match_dup 0) (unspec:HI [(match_dup 2)] UNSPEC_LIL))
> > (set (match_dup 0) (unspec:HI [(match_dup 3)] UNSPEC_LIU))]
> > "
> > {
> > operands[2] = GEN_INT (INTVAL (operands[1]) & 0x00ff);
> > operands[3] = GEN_INT ((INTVAL (operands[1]) >> 8) & 0x00ff);
> > }"
> > )
> >
> > But after the instruction is split 'lil_pattern' get deleted for every
> > split. This is because both the newly generated patterns are
> > same, even though the value of the immediate constant is different for
> > the patterns. This happens in the 'CSA' pass.
> > How can i make this work?
>
> You are writing insns that look like they set the whole register, but
> they don't. Don't do that. I also don't see why you need an unspec
> here. Write something like
>
> (set (strict_low_part (match_dup 4)) (match_dup 2))
>
> operands[2] = GEN_INT (...)
> operands[4] = simplify_gen_subreg (QImode, operands[0], HImode, 0);
>
> That is, express in the RTL what the instruction is really doing.
Thanks for the reply.
I did like what you suggested i.e in define_split i generated this pattern
(set (strict_low_part (match_dup 4)) (match_dup 2))
where
operands[2] = GEN_INT ((int)((INTVAL (operands[1])) & 0xff)); and
operands[4] = simplify_gen_subreg (QImode, operands[0], HImode, 0);
The define_insn pattern that matches this is something like this:
(define_insn "mov_const_lil"
[(set (strict_low_part (match_operand:QI 0 "register_operand" "+r"))
(match_operand:QI 1 "immediate_operand" "i"))]
""
"lil\\t%0, %1"
)
I get unrecognized error when the operands[1] is define_split pattern is say -6.
That was because the immediate_operand predicate in the define_insn is
rejecting the values which in this case is 250.
How will i be able to resolve this issue ?
Thanks for your time.
Regards,
Shafi