Hi, it works. But the constrains are really long.
I use "U" for memory operands with address "R18+offset", and "S" for memory operands with address "R16" or "R17", and "Q" for memory operands with constant address(such as symbol ref, or const_int), the all combinations are as more as 43 types, and I have to change "MAX_RECOG_ALTERNATIVES" from "30" to be larger constants in "recog.h". (define_insn "*iorqi3_noimm_to_reg" [(set (match_operand:QI 0 "register_mem_operand" "=r,r,r,r,r,r,r,r,r,r,r,r,r,U,U,U,S,S,S,Q,Q,Q,U,S,Q,U,U,U,U,U,U,S,S,S,S,S,S,Q,Q,Q,Q,Q,Q") (ior:QI (match_operand:QI 1 "register_mem_operand" "%0,0,0,0,U,U,U,S,S,S,Q,Q,Q,r,r,r,r,r,r,r,r,r,r,r,r,U,U,U,S,Q,Q,U,U,U,S,Q,Q,U,U,U,S,Q,Q") (match_operand:QI 2 "register_mem_operand" "U,S,Q,r,U,S,Q,U,S,Q,U,S,Q,U,S,Q,U,S,Q,U,S,Q,r,r,r,U,S,Q,S,S,Q,U,S,Q,S,S,Q,U,S,Q,S,S,Q")))] "" "..." [( set_attr "length" "3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3" ) ( set_attr "clobberb" "no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no,no" )]) Is there any suggestions about this "long" constraints? Thanks! 2010/7/23 Ian Lance Taylor <i...@google.com>: > redriver jiang <jiang.redri...@gmail.com> writes: > >> Hi, >> >> You mean I should define insn like this: >> >> (define_insn "*iorqi3_imm" >> [(set (mem:QI (match_operand:HI 0 "register_operand" "b")) >> (ior:QI (mem:QI (match_operand:HI 1 "register_operand" "b") >> (mem:QI (plus: HI (match_operand:HI 2 >> "register_operand" "f") >> (match_operand: 3 HI >> "immediate_operand" "K") ))))] >> "" >> "..." >> [( set_attr "length" "1" )]) >> >> "b" for R16,R17,R18, and "f" for R18, "K" for immediate operand with >> range "0-127"? > > Sort of, but you shouldn't write the PLUS in the insn. Instead, write a > new constraint which accepts either a R16, R17, or R18 plus an offset. > Also, write the insn with three alternatives, with the offset constraint > in each position. > > Ian >