<[email protected]> writes:
> What I was trying to describe is the handling of a memcpy operation in the
> .md file, where the operands are the memory pointers and (in my case) I want
> to tell the machinery that the registers it's using to pass in the addresses
> no longer have those addresses in them on completion. So I put in clobbers
> to say that. What I really wanted to do is express that the pointer
> registers, on completion, point just past the buffer, so the optimizer could
> take advantage of that, but it wasn't clear how one would do that.
The i386 rep_movqi insn is an example:
(define_insn "*rep_movqi"
[(set (match_operand:P 2 "register_operand" "=c") (const_int 0))
(set (match_operand:P 0 "register_operand" "=D")
(plus:P (match_operand:P 3 "register_operand" "0")
(match_operand:P 5 "register_operand" "2")))
(set (match_operand:P 1 "register_operand" "=S")
(plus:P (match_operand:P 4 "register_operand" "1") (match_dup 5)))
(set (mem:BLK (match_dup 3))
(mem:BLK (match_dup 4)))
(use (match_dup 5))]
"!(fixed_regs[CX_REG] || fixed_regs[SI_REG] || fixed_regs[DI_REG])"
"%^rep{%;} movsb"
[(set_attr "type" "str")
(set_attr "prefix_rep" "1")
(set_attr "memory" "both")
(set_attr "mode" "QI")])
Note that since this is a define_insn, the four SETs in the pattern are
run in parallel. The input operands are 3 (destination pointer), 4
(source pointer), 5 (count). The output operands are 0 (pointer past
destination block), 1 (pointer past source block), 2 (set to zero).
Matching constraints are used to put each input operand in the same
register as the corresponding output operand.
Ian