Re: adding movz to machine description

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Petar Bajic" <petar.bajic@xxxxxxxxxxxxxxx> writes:

> I need to add conditional move instructions to gcc dlx port.
> I found implemented pattern 'movmodecc' for conditional move
> instruction that look like this:
> if (condition)
>     a = b;
> else
>    a = c;
> 
> 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.
> 
> In md file it's easy to describe first case:
> 
> (define_insn "movsicc_internal"
>   [(set (match_operand:SI 0 "register_operand" "=d,d")
>   (if_then_else:SI
>   (match_operator 1 "comparison_operator" [(match_operand:SI 4
> "register_operand" "=d,d") (const_int 0)])
>   (match_operand:SI 2 "register_operand" "=d,d")
>   (match_operand:SI 3 "register_operand" "=d,d")))]
> 
> "movc\\t%0, %2, %3, %1" ;;theoretic conditional move with else branch
> [(set_attr "mode" "SI")]
> 
> But I can't seem to describe what I need: conditional move without
> else branch.
> Any help is appreciated. Im new here.

Write it as a define_expand which generates, more or less,
    (set a c)
    (set a (if_then_else (eq b 0) d (match_dup a)))

Ian

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux