> 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 ? > Consider the move pattern you have included (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" ) Here, the last constraints caters the case for loading immediate operand into register. I think the problem could be with eliminating FP against SP. I have also defined the move patterns as mentioned above and I am able to successfully compiled the test case as mentioned in e.c. Please check. On Tue, 2009-03-03 at 10:40 +0100, Florent DEFAY wrote: > 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