This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
movsi on a 16 bit machine
- From: Florent Defay <spira dot inhabitant at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 20 Jul 2009 15:33:04 +0200
- Subject: movsi on a 16 bit machine
Hello,
I am working on a new port for a 16-bit machine.
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.
I would like to modify the implementation to fix it but I do not know how.
Please help.
Regards,
Florent.