move patterns, emit_move_insn
Florent DEFAY
spira.inhabitant@gmail.com
Tue Mar 3 09:40:00 GMT 2009
Thank you for your help.
Regarding your advice, I tried this implementation:
___________________________________________________
;; movhi
(define_expand "movhi"
[(set (match_operand:HI 0 "nonimmediate_operand" "")
(match_operand:HI 1 "general_operand" "")
)]
""
""
)
(define_insn "movhi1"
[(set (match_operand:HI 0 "register_operand" "=r,r,m,r")
(match_operand:HI 1 "general_operand" "r,m,r,i")
)]
""
"@
movew\t%1,%0
movew\t%1,%0
movew\t%1,%0
movew\t%1,%0"
)
____________________________________________________
But I get this error then:
e.c:7: error: unrecognizable insn:
(insn 7 6 8 3 e.c:4 (set (mem/c/i:HI (reg/f:HI 14) [0 i+0 S2 A16])
(const_int 3 [0x3])) -1 (nil))
I think GCC has to put immediate into memory. The arch can't do that
directly. GCC should put the immediate in register and then register
to memory.
It succeded with old implementation (with a lot of define_insn). What
should I change in the new implementation to get it right ?
Another question, I wonder how to deal with access modes ?
For example, to obtain such an ASM instruction
movew r1,8(r2)
should it come from a define_insn like movhi1 and then treated by
print_operand ?
Thank you.
Regards.
Florent
More information about the Gcc-help
mailing list