From: Alexander Ivchenko Date: Wed, 10 Sep 2014 06:28:03 +0000 (+0000) Subject: AVX-512. Extend FMA patterns. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e274629ef852151bc3cf9c2b1547ff2108dd3d75;p=gcc.git AVX-512. Extend FMA patterns. gcc/ * config/i386/sse.md (define_mode_iterator VF_AVX512VL): New. (define_mode_iterator FMAMODEM): Allow 128/256bit EVEX version. (define_mode_iterator FMAMODE_AVX512): New. (define_mode_iterator FMAMODE): Remove conditions. (define_expand "fma4i_fmadd_"): Use FMAMODE_AVX512 mode iterator. (define_expand "_fmadd__maskz"): Rename from "_fmadd__maskz" and use VF_AVX512VL mode iterator. (define_mode_iterator FMAMODE_NOVF512): Remove. (define_insn "*fma_fmadd_"): Rename from "fma_fmadd_" and use FMAMODE mode iterator. (define_mode_iterator VF_SF_AVX512VL): New. (define_insn "fma_fmadd_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fmadd__mask"): Rename from "avx512f_fmadd__mask" and use VF_AVX512VL mode iterator. (define_insn "_fmadd__mask3"): Rename from "avx512f_fmadd__mask3" and use VF_AVX512VL mode iterator. (define_insn "*fma_fmsub_"): Rename from "fma_fmsub_" and use FMAMODE mode iterator. (define_insn "fma_fmsub_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fmsub__mask"): Rename from "avx512f_fmsub__mask" and use VF_AVX512VL mode iterator. (define_insn "_fmsub__mask3"): Rename from "avx512f_fmsub__mask3" and use VF_AVX512VL mode iterator. (define_insn "*fma_fnmadd_"): Rename from "fma_fnmadd_" and use FMAMODE mode iterator. (define_insn "fma_fnmadd_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fnmadd__mask"): Rename from "avx512f_fnmadd__mask" and use VF_AVX512VL mode iterator. (define_insn "_fnmadd__mask3"): Rename from "avx512f_fnmadd__mask3" and use VF_AVX512VL mode iterator. (define_insn "*fma_fnmsub_"): Rename from "fma_fnmsub_" and use FMAMODE mode iterator. (define_insn "fma_fnmsub_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fnmsub__mask"): Rename from "avx512f_fnmsub__mask" and use VF_AVX512VL mode iterator. (define_insn "_fnmsub__mask3"): Rename from "avx512f_fnmsub__mask3" and use VF_AVX512VL mode iterator. (define_expand "_fmaddsub__maskz"): Rename from "avx512f_fmaddsub__maskz" and use VF_AVX512VL mode iterator. (define_insn "*fma_fmaddsub_"): Rename from "fma_fmaddsub_" and remove subst usage. (define_insn "fma_fmaddsub_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fmaddsub__mask"): Rename from "avx512f_fmaddsub__mask" and use VF_AVX512VL mode iterator. (define_insn "_fmaddsub__mask3"): Rename from "avx512f_fmaddsub__mask3" and use VF_AVX512VL mode iterator. (define_insn "*fma_fmsubadd_"): Rename from "fma_fmsubadd_" and remove usage of subst. (define_insn "fma_fmsubadd_"): Use VF_SF_AVX512VL mode iterator. (define_insn "_fmsubadd__mask"): Rename from "avx512f_fmsubadd__mask" and use VF_AVX512VL mode iterator. (define_insn "_fmsubadd__mask3"): Rename from "avx512f_fmsubadd__mask3" and use VF_AVX512VL mode iterator. Co-Authored-By: Andrey Turetskiy Co-Authored-By: Anna Tikhonova Co-Authored-By: Ilya Tocar Co-Authored-By: Ilya Verbin Co-Authored-By: Kirill Yukhin Co-Authored-By: Maxim Kuznetsov Co-Authored-By: Michael Zolotukhin From-SVN: r215104 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 24667358ef3..9357a6f9748 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,92 @@ +2014-09-10 Alexander Ivchenko + Maxim Kuznetsov + Anna Tikhonova + Ilya Tocar + Andrey Turetskiy + Ilya Verbin + Kirill Yukhin + Michael Zolotukhin + + * config/i386/sse.md (define_mode_iterator VF_AVX512VL): New. + (define_mode_iterator FMAMODEM): Allow 128/256bit EVEX version. + (define_mode_iterator FMAMODE_AVX512): New. + (define_mode_iterator FMAMODE): Remove conditions. + (define_expand "fma4i_fmadd_"): Use FMAMODE_AVX512 mode iterator. + (define_expand "_fmadd__maskz"): Rename + from "_fmadd__maskz" and use VF_AVX512VL + mode iterator. + (define_mode_iterator FMAMODE_NOVF512): Remove. + (define_insn "*fma_fmadd_"): Rename from + "fma_fmadd_" and use + FMAMODE mode iterator. + (define_mode_iterator VF_SF_AVX512VL): New. + (define_insn "fma_fmadd_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fmadd__mask"): Rename from + "avx512f_fmadd__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fmadd__mask3"): Rename from + "avx512f_fmadd__mask3" and use VF_AVX512VL mode + iterator. + (define_insn "*fma_fmsub_"): Rename from + "fma_fmsub_" and use + FMAMODE mode iterator. + (define_insn "fma_fmsub_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fmsub__mask"): Rename from + "avx512f_fmsub__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fmsub__mask3"): Rename from + "avx512f_fmsub__mask3" and use VF_AVX512VL mode + iterator. + (define_insn "*fma_fnmadd_"): Rename from + "fma_fnmadd_" and + use FMAMODE mode iterator. + (define_insn "fma_fnmadd_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fnmadd__mask"): Rename from + "avx512f_fnmadd__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fnmadd__mask3"): Rename from + "avx512f_fnmadd__mask3" and use VF_AVX512VL mode + iterator. + (define_insn "*fma_fnmsub_"): Rename from + "fma_fnmsub_" and use + FMAMODE mode iterator. + (define_insn "fma_fnmsub_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fnmsub__mask"): Rename from + "avx512f_fnmsub__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fnmsub__mask3"): Rename from + "avx512f_fnmsub__mask3" and use VF_AVX512VL mode + iterator. + (define_expand "_fmaddsub__maskz"): + Rename from "avx512f_fmaddsub__maskz" and + use VF_AVX512VL mode iterator. + (define_insn "*fma_fmaddsub_"): Rename from + "fma_fmaddsub_" and + remove subst usage. + (define_insn "fma_fmaddsub_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fmaddsub__mask"): Rename from + "avx512f_fmaddsub__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fmaddsub__mask3"): Rename from + "avx512f_fmaddsub__mask3" and use VF_AVX512VL mode + iterator. + (define_insn "*fma_fmsubadd_"): Rename from + "fma_fmsubadd_" and + remove usage of subst. + (define_insn "fma_fmsubadd_"): + Use VF_SF_AVX512VL mode iterator. + (define_insn "_fmsubadd__mask"): Rename from + "avx512f_fmsubadd__mask" and use VF_AVX512VL mode + iterator. + (define_insn "_fmsubadd__mask3"): Rename from + "avx512f_fmsubadd__mask3" and use VF_AVX512VL mode + iterator. + 2014-09-10 Kugan Vivekanandarajah Revert r213751: diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 8287b3b7792..604c0dc1c55 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -239,6 +239,10 @@ [V16SI (V8SI "TARGET_AVX512VL") (V4SI "TARGET_AVX512VL") V8DI (V4DI "TARGET_AVX512VL") (V2DI "TARGET_AVX512VL")]) +(define_mode_iterator VF_AVX512VL + [V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL") + V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")]) + (define_mode_iterator VF2_AVX512VL [V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")]) @@ -2960,10 +2964,10 @@ (define_mode_iterator FMAMODEM [(SF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)") (DF "TARGET_SSE_MATH && (TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F)") - (V4SF "TARGET_FMA || TARGET_FMA4") - (V2DF "TARGET_FMA || TARGET_FMA4") - (V8SF "TARGET_FMA || TARGET_FMA4") - (V4DF "TARGET_FMA || TARGET_FMA4") + (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") (V16SF "TARGET_AVX512F") (V8DF "TARGET_AVX512F")]) @@ -2996,30 +3000,33 @@ (neg:FMAMODEM (match_operand:FMAMODEM 3 "nonimmediate_operand"))))]) ;; The builtins for intrinsics are not constrained by SSE math enabled. +(define_mode_iterator FMAMODE_AVX512 + [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") + (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") + (V4SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V2DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V8SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V4DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512VL") + (V16SF "TARGET_AVX512F") + (V8DF "TARGET_AVX512F")]) + (define_mode_iterator FMAMODE - [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") - (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") - (V4SF "TARGET_FMA || TARGET_FMA4") - (V2DF "TARGET_FMA || TARGET_FMA4") - (V8SF "TARGET_FMA || TARGET_FMA4") - (V4DF "TARGET_FMA || TARGET_FMA4") - (V16SF "TARGET_AVX512F") - (V8DF "TARGET_AVX512F")]) + [SF DF V4SF V2DF V8SF V4DF]) (define_expand "fma4i_fmadd_" - [(set (match_operand:FMAMODE 0 "register_operand") - (fma:FMAMODE - (match_operand:FMAMODE 1 "nonimmediate_operand") - (match_operand:FMAMODE 2 "nonimmediate_operand") - (match_operand:FMAMODE 3 "nonimmediate_operand")))]) - -(define_expand "avx512f_fmadd__maskz" - [(match_operand:VF_512 0 "register_operand") - (match_operand:VF_512 1 "") - (match_operand:VF_512 2 "") - (match_operand:VF_512 3 "") + [(set (match_operand:FMAMODE_AVX512 0 "register_operand") + (fma:FMAMODE_AVX512 + (match_operand:FMAMODE_AVX512 1 "nonimmediate_operand") + (match_operand:FMAMODE_AVX512 2 "nonimmediate_operand") + (match_operand:FMAMODE_AVX512 3 "nonimmediate_operand")))]) + +(define_expand "_fmadd__maskz" + [(match_operand:VF_AVX512VL 0 "register_operand") + (match_operand:VF_AVX512VL 1 "") + (match_operand:VF_AVX512VL 2 "") + (match_operand:VF_AVX512VL 3 "") (match_operand: 4 "register_operand")] - "TARGET_AVX512F" + "TARGET_AVX512F && " { emit_insn (gen_fma_fmadd__maskz_1 ( operands[0], operands[1], operands[2], operands[3], @@ -3027,56 +3034,52 @@ DONE; }) -(define_mode_iterator FMAMODE_NOVF512 - [(SF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") - (DF "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") - (V4SF "TARGET_FMA || TARGET_FMA4") - (V2DF "TARGET_FMA || TARGET_FMA4") - (V8SF "TARGET_FMA || TARGET_FMA4") - (V4DF "TARGET_FMA || TARGET_FMA4")]) - -(define_insn "fma_fmadd_" - [(set (match_operand:FMAMODE_NOVF512 0 "register_operand" "=v,v,v,x,x") - (fma:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 1 "" "%0,0,v,x,x") - (match_operand:FMAMODE_NOVF512 2 "" ",v,,x,m") - (match_operand:FMAMODE_NOVF512 3 "" "v,,0,xm,x")))] - " && " +(define_insn "*fma_fmadd_" + [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x") + (fma:FMAMODE + (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x") + (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m") + (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))] + "TARGET_FMA || TARGET_FMA4" "@ - vfmadd132\t{%2, %3, %0|%0, %3, %2} - vfmadd213\t{%3, %2, %0|%0, %2, %3} - vfmadd231\t{%2, %1, %0|%0, %1, %2} + vfmadd132\t{%2, %3, %0|%0, %3, %2} + vfmadd213\t{%3, %2, %0|%0, %2, %3} + vfmadd231\t{%2, %1, %0|%0, %1, %2} vfmadd\t{%3, %2, %1, %0|%0, %1, %2, %3} vfmadd\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) +;; Suppose AVX-512F as baseline +(define_mode_iterator VF_SF_AVX512VL + [SF V16SF (V8SF "TARGET_AVX512VL") (V4SF "TARGET_AVX512VL") + DF V8DF (V4DF "TARGET_AVX512VL") (V2DF "TARGET_AVX512VL")]) + (define_insn "fma_fmadd_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (fma:VF_512 - (match_operand:VF_512 1 "" "%0,0,v") - (match_operand:VF_512 2 "" ",v,") - (match_operand:VF_512 3 "" "v,,0")))] - " && " + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (fma:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 1 "" "%0,0,v") + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (match_operand:VF_SF_AVX512VL 3 "" "v,,0")))] + "TARGET_AVX512F && && " "@ vfmadd132\t{%2, %3, %0|%0, %3, %2} vfmadd213\t{%3, %2, %0|%0, %2, %3} vfmadd231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmadd__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (fma:VF_512 - (match_operand:VF_512 1 "register_operand" "0,0") - (match_operand:VF_512 2 "" ",v") - (match_operand:VF_512 3 "" "v,")) +(define_insn "_fmadd__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "0,0") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] - "TARGET_AVX512F" + "TARGET_AVX512F && " "@ vfmadd132\t{%2, %3, %0%{%4%}|%0%{%4%}, %3, %2} vfmadd213\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}" @@ -3084,13 +3087,13 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmadd__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=x") - (vec_merge:VF_512 - (fma:VF_512 - (match_operand:VF_512 1 "register_operand" "x") - (match_operand:VF_512 2 "" "") - (match_operand:VF_512 3 "register_operand" "0")) +(define_insn "_fmadd__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=x") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "x") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 3 "register_operand" "0")) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] "TARGET_AVX512F" @@ -3099,48 +3102,47 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "fma_fmsub_" - [(set (match_operand:FMAMODE_NOVF512 0 "register_operand" "=v,v,v,x,x") - (fma:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 1 "" "%0,0,v,x,x") - (match_operand:FMAMODE_NOVF512 2 "" ",v,,x,m") - (neg:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 3 "" "v,,0,xm,x"))))] - " && " +(define_insn "*fma_fmsub_" + [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x") + (fma:FMAMODE + (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x") + (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m") + (neg:FMAMODE + (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))] + "TARGET_FMA || TARGET_FMA4" "@ - vfmsub132\t{%2, %3, %0|%0, %3, %2} - vfmsub213\t{%3, %2, %0|%0, %2, %3} - vfmsub231\t{%2, %1, %0|%0, %1, %2} + vfmsub132\t{%2, %3, %0|%0, %3, %2} + vfmsub213\t{%3, %2, %0|%0, %2, %3} + vfmsub231\t{%2, %1, %0|%0, %1, %2} vfmsub\t{%3, %2, %1, %0|%0, %1, %2, %3} vfmsub\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) (define_insn "fma_fmsub_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (fma:VF_512 - (match_operand:VF_512 1 "" "%0,0,v") - (match_operand:VF_512 2 "" ",v,") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,,0"))))] - " && " + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (fma:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 1 "" "%0,0,v") + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (neg:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] + "TARGET_AVX512F && && " "@ vfmsub132\t{%2, %3, %0|%0, %3, %2} vfmsub213\t{%3, %2, %0|%0, %2, %3} vfmsub231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmsub__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (fma:VF_512 - (match_operand:VF_512 1 "register_operand" "0,0") - (match_operand:VF_512 2 "" ",v") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,"))) +(define_insn "_fmsub__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "0,0") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] "TARGET_AVX512F" @@ -3151,67 +3153,66 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmsub__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (fma:VF_512 - (match_operand:VF_512 1 "register_operand" "v") - (match_operand:VF_512 2 "" "") - (neg:VF_512 - (match_operand:VF_512 3 "register_operand" "0"))) +(define_insn "_fmsub__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "v") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "register_operand" "0"))) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] - "TARGET_AVX512F" + "TARGET_AVX512F && " "vfmsub231\t{%2, %1, %0%{%4%}|%0%{%4%}, %1, %2}" [(set_attr "isa" "fma_avx512f") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "fma_fnmadd_" - [(set (match_operand:FMAMODE_NOVF512 0 "register_operand" "=v,v,v,x,x") - (fma:FMAMODE_NOVF512 - (neg:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 1 "" "%0,0,v,x,x")) - (match_operand:FMAMODE_NOVF512 2 "" ",v,,x,m") - (match_operand:FMAMODE_NOVF512 3 "" "v,,0,xm,x")))] - " && " +(define_insn "*fma_fnmadd_" + [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x") + (fma:FMAMODE + (neg:FMAMODE + (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")) + (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m") + (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x")))] + "TARGET_FMA || TARGET_FMA4" "@ - vfnmadd132\t{%2, %3, %0|%0, %3, %2} - vfnmadd213\t{%3, %2, %0|%0, %2, %3} - vfnmadd231\t{%2, %1, %0|%0, %1, %2} + vfnmadd132\t{%2, %3, %0|%0, %3, %2} + vfnmadd213\t{%3, %2, %0|%0, %2, %3} + vfnmadd231\t{%2, %1, %0|%0, %1, %2} vfnmadd\t{%3, %2, %1, %0|%0, %1, %2, %3} vfnmadd\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) (define_insn "fma_fnmadd_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "" "%0,0,v")) - (match_operand:VF_512 2 "" ",v,") - (match_operand:VF_512 3 "" "v,,0")))] - " && " + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (fma:VF_SF_AVX512VL + (neg:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 1 "" "%0,0,v")) + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (match_operand:VF_SF_AVX512VL 3 "" "v,,0")))] + "TARGET_AVX512F && && " "@ vfnmadd132\t{%2, %3, %0|%0, %3, %2} vfnmadd213\t{%3, %2, %0|%0, %2, %3} vfnmadd231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fnmadd__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "register_operand" "0,0")) - (match_operand:VF_512 2 "" ",v") - (match_operand:VF_512 3 "" "v,")) +(define_insn "_fnmadd__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "0,0")) + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] - "TARGET_AVX512F" + "TARGET_AVX512F && " "@ vfnmadd132\t{%2, %3, %0%{%4%}|%0%{%4%}, %3, %2} vfnmadd213\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}" @@ -3219,70 +3220,69 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fnmadd__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "register_operand" "v")) - (match_operand:VF_512 2 "" "") - (match_operand:VF_512 3 "register_operand" "0")) +(define_insn "_fnmadd__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "v")) + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 3 "register_operand" "0")) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] - "TARGET_AVX512F" + "TARGET_AVX512F && " "vfnmadd231\t{%2, %1, %0%{%4%}|%0%{%4%}, %1, %2}" [(set_attr "isa" "fma_avx512f") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "fma_fnmsub_" - [(set (match_operand:FMAMODE_NOVF512 0 "register_operand" "=v,v,v,x,x") - (fma:FMAMODE_NOVF512 - (neg:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 1 "" "%0,0,v,x,x")) - (match_operand:FMAMODE_NOVF512 2 "" ",v,,x,m") - (neg:FMAMODE_NOVF512 - (match_operand:FMAMODE_NOVF512 3 "" "v,,0,xm,x"))))] - " && " +(define_insn "*fma_fnmsub_" + [(set (match_operand:FMAMODE 0 "register_operand" "=v,v,v,x,x") + (fma:FMAMODE + (neg:FMAMODE + (match_operand:FMAMODE 1 "nonimmediate_operand" "%0,0,v,x,x")) + (match_operand:FMAMODE 2 "nonimmediate_operand" "vm,v,vm,x,m") + (neg:FMAMODE + (match_operand:FMAMODE 3 "nonimmediate_operand" "v,vm,0,xm,x"))))] + "TARGET_FMA || TARGET_FMA4" "@ vfnmsub132\t{%2, %3, %0|%0, %3, %2} vfnmsub213\t{%3, %2, %0|%0, %2, %3} vfnmsub231\t{%2, %1, %0|%0, %1, %2} vfnmsub\t{%3, %2, %1, %0|%0, %1, %2, %3} vfnmsub\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) (define_insn "fma_fnmsub_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "" "%0,0,v")) - (match_operand:VF_512 2 "" ",v,") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,,0"))))] - " && " + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (fma:VF_SF_AVX512VL + (neg:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 1 "" "%0,0,v")) + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (neg:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] + "TARGET_AVX512F && && " "@ vfnmsub132\t{%2, %3, %0|%0, %3, %2} vfnmsub213\t{%3, %2, %0|%0, %2, %3} vfnmsub231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fnmsub__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "register_operand" "0,0")) - (match_operand:VF_512 2 "" ",v") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,"))) +(define_insn "_fnmsub__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "0,0")) + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] - "TARGET_AVX512F" + "TARGET_AVX512F && " "@ vfnmsub132\t{%2, %3, %0%{%4%}|%0%{%4%}, %3, %2} vfnmsub213\t{%3, %2, %0%{%4%}|%0%{%4%}, %2, %3}" @@ -3290,15 +3290,15 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fnmsub__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (fma:VF_512 - (neg:VF_512 - (match_operand:VF_512 1 "register_operand" "v")) - (match_operand:VF_512 2 "" "") - (neg:VF_512 - (match_operand:VF_512 3 "register_operand" "0"))) +(define_insn "_fnmsub__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (fma:VF_AVX512VL + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 1 "register_operand" "v")) + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "register_operand" "0"))) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] "TARGET_AVX512F" @@ -3327,11 +3327,11 @@ UNSPEC_FMADDSUB))] "TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F") -(define_expand "avx512f_fmaddsub__maskz" - [(match_operand:VF_512 0 "register_operand") - (match_operand:VF_512 1 "") - (match_operand:VF_512 2 "") - (match_operand:VF_512 3 "") +(define_expand "_fmaddsub__maskz" + [(match_operand:VF_AVX512VL 0 "register_operand") + (match_operand:VF_AVX512VL 1 "") + (match_operand:VF_AVX512VL 2 "") + (match_operand:VF_AVX512VL 3 "") (match_operand: 4 "register_operand")] "TARGET_AVX512F" { @@ -3341,47 +3341,46 @@ DONE; }) -(define_insn "fma_fmaddsub_" +(define_insn "*fma_fmaddsub_" [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x") (unspec:VF_128_256 - [(match_operand:VF_128_256 1 "" "%0,0,v,x,x") - (match_operand:VF_128_256 2 "" ",v,,x,m") - (match_operand:VF_128_256 3 "" "v,,0,xm,x")] + [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x") + (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m") + (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x")] UNSPEC_FMADDSUB))] - "(TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F) && && " + "TARGET_FMA || TARGET_FMA4" "@ - vfmaddsub132\t{%2, %3, %0|%0, %3, %2} - vfmaddsub213\t{%3, %2, %0|%0, %2, %3} - vfmaddsub231\t{%2, %1, %0|%0, %1, %2} + vfmaddsub132\t{%2, %3, %0|%0, %3, %2} + vfmaddsub213\t{%3, %2, %0|%0, %2, %3} + vfmaddsub231\t{%2, %1, %0|%0, %1, %2} vfmaddsub\t{%3, %2, %1, %0|%0, %1, %2, %3} vfmaddsub\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) (define_insn "fma_fmaddsub_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (unspec:VF_512 - [(match_operand:VF_512 1 "" "%0,0,v") - (match_operand:VF_512 2 "" ",v,") - (match_operand:VF_512 3 "" "v,,0")] + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (unspec:VF_SF_AVX512VL + [(match_operand:VF_SF_AVX512VL 1 "" "%0,0,v") + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (match_operand:VF_SF_AVX512VL 3 "" "v,,0")] UNSPEC_FMADDSUB))] "TARGET_AVX512F && && " "@ vfmaddsub132\t{%2, %3, %0|%0, %3, %2} vfmaddsub213\t{%3, %2, %0|%0, %2, %3} vfmaddsub231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmaddsub__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "0,0") - (match_operand:VF_512 2 "" ",v") - (match_operand:VF_512 3 "" "v,")] +(define_insn "_fmaddsub__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "0,0") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,")] UNSPEC_FMADDSUB) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] @@ -3393,13 +3392,13 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmaddsub__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "v") - (match_operand:VF_512 2 "" "") - (match_operand:VF_512 3 "register_operand" "0")] +(define_insn "_fmaddsub__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "v") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (match_operand:VF_AVX512VL 3 "register_operand" "0")] UNSPEC_FMADDSUB) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))] @@ -3409,50 +3408,49 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "fma_fmsubadd_" +(define_insn "*fma_fmsubadd_" [(set (match_operand:VF_128_256 0 "register_operand" "=v,v,v,x,x") (unspec:VF_128_256 - [(match_operand:VF_128_256 1 "" "%0,0,v,x,x") - (match_operand:VF_128_256 2 "" ",v,,x,m") + [(match_operand:VF_128_256 1 "nonimmediate_operand" "%0,0,v,x,x") + (match_operand:VF_128_256 2 "nonimmediate_operand" "vm,v,vm,x,m") (neg:VF_128_256 - (match_operand:VF_128_256 3 "" "v,,0,xm,x"))] + (match_operand:VF_128_256 3 "nonimmediate_operand" "v,vm,0,xm,x"))] UNSPEC_FMADDSUB))] - "(TARGET_FMA || TARGET_FMA4 || TARGET_AVX512F) && && " + "TARGET_FMA || TARGET_FMA4" "@ - vfmsubadd132\t{%2, %3, %0|%0, %3, %2} - vfmsubadd213\t{%3, %2, %0|%0, %2, %3} - vfmsubadd231\t{%2, %1, %0|%0, %1, %2} + vfmsubadd132\t{%2, %3, %0|%0, %3, %2} + vfmsubadd213\t{%3, %2, %0|%0, %2, %3} + vfmsubadd231\t{%2, %1, %0|%0, %1, %2} vfmsubadd\t{%3, %2, %1, %0|%0, %1, %2, %3} vfmsubadd\t{%3, %2, %1, %0|%0, %1, %2, %3}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f,fma4,fma4") + [(set_attr "isa" "fma,fma,fma,fma4,fma4") (set_attr "type" "ssemuladd") (set_attr "mode" "")]) (define_insn "fma_fmsubadd_" - [(set (match_operand:VF_512 0 "register_operand" "=v,v,v") - (unspec:VF_512 - [(match_operand:VF_512 1 "" "%0,0,v") - (match_operand:VF_512 2 "" ",v,") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,,0"))] + [(set (match_operand:VF_SF_AVX512VL 0 "register_operand" "=v,v,v") + (unspec:VF_SF_AVX512VL + [(match_operand:VF_SF_AVX512VL 1 "" "%0,0,v") + (match_operand:VF_SF_AVX512VL 2 "" ",v,") + (neg:VF_SF_AVX512VL + (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))] UNSPEC_FMADDSUB))] "TARGET_AVX512F && && " "@ vfmsubadd132\t{%2, %3, %0|%0, %3, %2} vfmsubadd213\t{%3, %2, %0|%0, %2, %3} vfmsubadd231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "isa" "fma_avx512f,fma_avx512f,fma_avx512f") - (set_attr "type" "ssemuladd") + [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmsubadd__mask" - [(set (match_operand:VF_512 0 "register_operand" "=v,v") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "0,0") - (match_operand:VF_512 2 "" ",v") - (neg:VF_512 - (match_operand:VF_512 3 "" "v,"))] +(define_insn "_fmsubadd__mask" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "0,0") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" ",v") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "nonimmediate_operand" "v,"))] UNSPEC_FMADDSUB) (match_dup 1) (match_operand: 4 "register_operand" "Yk,Yk")))] @@ -3464,14 +3462,14 @@ (set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "avx512f_fmsubadd__mask3" - [(set (match_operand:VF_512 0 "register_operand" "=v") - (vec_merge:VF_512 - (unspec:VF_512 - [(match_operand:VF_512 1 "register_operand" "v") - (match_operand:VF_512 2 "" "") - (neg:VF_512 - (match_operand:VF_512 3 "register_operand" "0"))] +(define_insn "_fmsubadd__mask3" + [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v") + (vec_merge:VF_AVX512VL + (unspec:VF_AVX512VL + [(match_operand:VF_AVX512VL 1 "register_operand" "v") + (match_operand:VF_AVX512VL 2 "nonimmediate_operand" "") + (neg:VF_AVX512VL + (match_operand:VF_AVX512VL 3 "register_operand" "0"))] UNSPEC_FMADDSUB) (match_dup 3) (match_operand: 4 "register_operand" "Yk")))]