Re[2]: GCC won`t emit my instriction
Alex Hill via gcc-help
gcc-help@gcc.gnu.org
Mon Jun 10 06:15:00 GMT 2019
>Пятница, 7 июня 2019, 21:34 +05:00 от Segher Boessenkool <segher@kernel.crashing.org>:
>
>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
Of course i tried this before, but its not work.
I found some decision, i used flags -fexceptions -fnon-call-exceptions and it emits max insn, now i try to understand why this happens.
Here is the max it emits:
(define_insn "smax<GPR:mode>3"
[(set (match_operand:GPR 0 "register_operand" "=r")
(smax:GPR (match_operand:GPR 1 "register_operand" " r")
(match_operand:GPR 2 "register_operand" " r")))]
""
"max\t%0,%1,%2"
[(set_attr "type" "move")
(set_attr "mode" "<MODE>")])
Kind regards Alex Hill.
More information about the Gcc-help
mailing list