Re: movsi on a 16 bit machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Florent Defay <spira.inhabitant@xxxxxxxxx> writes:

> I have trouble with movsi.
>
> As the machine is 16-bit, movsi cannot be done in one shot. So I split
> it into two movhi:
>
> (define_insn_and_split "movsi"
>   [(set (match_operand:SI 0 "nonimmediate_operand" "=r,m")
>         (match_operand:SI 1 "general_operand" "rim,r"))]
>   ""
>   "#"
>   "reload_completed"
>  [(set (match_dup 2)
>        (match_dup 3))
>   (set (match_dup 4)
>        (match_dup 5))]
>   {
>     operands[2] = simplify_gen_subreg(HImode,operands[0],SImode,0);
>     operands[4] = simplify_gen_subreg(HImode,operands[0],SImode,2);
>     operands[3] = simplify_gen_subreg(HImode,operands[1],SImode,0);
>     operands[5] = simplify_gen_subreg(HImode,operands[1],SImode,2);
>   }
> )
>
> But there is a problem (rare) when the following case is encountered:
>
> move 4(R0),R0
> move 6(R0),R1
>
> Here, the operands considered are:
> operand0: R0:R1  (16 bits + 16 bits)
> operand1: 4(R0):6(R0)  (16 bits + 16 bits)
>
> this should be moving operand1 into operand0 but operand1 is addressed
> by R0 and R0 is modified at first line, so second line is false.

You need to make your split a little more complicated so that when the
registers overlap, it generates
    move 6(R0),R1
    move 4(R0),R0
A define_insn_and_split is permitted to generate the actual instructions
to use followed by DONE, just as in define_expand.

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux