"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.

Ian

Reply via email to