On Fri, Jul 07, 2006 at 04:25:08PM +0200, Petar Bajic wrote: > but my "movz" look like this > > if (c == 0) > a = b; > > or asm: movz r1, r2, r3 ;; ((if r3 == 0, move r2 to r1)) > > there is no 'else' branch. There _is_ an 'else' branch: if (r3 == 0) r1 = r2; else r1 = r1; With that, the insn definition is easy enough: (define_insn "*movz" [(set (match_operand:SI 0 "register_operand" "=d") (if_then_else (eq (match_operand:SI 1 "register_operand" "d") (const_int 0)) (match_operand:SI 2 "register_operand" "d") (match_operand:SI 3 "register_operand" "0")))] "" "movz\t%0, %2, %1" ) This is not all that different from the "*movsicc_noc" pattern in i386.md. You may want to add a reverse conditional pattern too, i.e. with (ne ...) instead of (eq ...) and operands 2 and 3 swapped. As for the expander, I don't know enough of our target machine to write one, and I'm not sure you need one. Passes such as combine, ce1, ce2 and ce3 may create "*movz". Having read the rest of the thread, I suggest you reread the documentation about define_expand, in particular the description of the DONE and FAIL macros for the preparation statements and how they affect the generation of the RTL template. -- Rask Ingemann Lambertsen