GCC won`t emit my instriction

Segher Boessenkool segher@kernel.crashing.org
Fri Jun 7 16:34:00 GMT 2019


Hi Alex,

On Fri, Jun 07, 2019 at 07:42:26AM +0300, Alex Hill via gcc-help wrote:
> I wrote a pattern in machine description file *.md to avoid branches:
>     (define_insn "smin<GPR:mode>3"
>       [
>         (set 
>           (match_operand:GPR 0 "register_operand" "=r")
>             (if_then_else:GPR
>           (lt:GPR 
>             (match_operand:GPR 1 "register_operand" " r")
>             (match_operand:GPR 2 "register_operand" " r"))
>         (match_dup 1)
>         (match_dup 2)))
>       ]
>       ""
>       "min\t%0,%1,%2"
>       [(set_attr "type" "move")
>        (set_attr "mode" "<MODE>")]) 

You could just do

(define_insn "smin<mode>3"
  [(set (match_operand:GPR 0 "register_operand" "=r")
        (smin:GPR (match_operand:GPR 1 "register_operand" "r")
                  (match_operand:GPR 2 "register_operand" "r")))]
  ""
  "min\t%0,%1,%2"
  [(set_attr "type" "move")
   (set_attr "mode" "<MODE>")])

Does that work better?


Segher



More information about the Gcc-help mailing list