From 7026bb9504eb0f95e114f832cd6dd14302376861 Mon Sep 17 00:00:00 2001 From: liuhongt Date: Sat, 26 Sep 2020 15:34:23 +0800 Subject: [PATCH] Refactor implementation of *_bcst{_1,_2,_3} patterns. Add new predicate bcst_mem_operand and corresponding constraint "Br" to merge "$(pattern)_bcst{_1,_2,_3}" into "$(pattern)", also delete those separate "*_bcst{_1,_2,_3}" patterns. gcc/ChangeLog: PR target/87767 * config/i386/constraints.md ("Br"): New special memory constraint. * config/i386/i386-expand.c (ix86_binary_operator_ok): Both source operand cannot be in memory or bcst_memory_operand. * config/i386/i386.c (ix86_print_operand): Print bcst_mem_operand. * config/i386/i386.h (VALID_BCST_MODE_P): New. * config/i386/predicates.md (bcst_mem_operand): New predicate for AVX512 embedding broadcast memory operand. (bcst_vector_operand): New predicate, vector_operand or bcst_mem_operand. * config/i386/sse.md (*3): Extend predicate and constraints to handle bcst_mem_operand. (*mul3): Ditto. (_div3): Ditto. (fma_fmadd_): Ditto. (fma_fmsub_): Ditto. (fma_fnmadd_): Ditto. (fma_fnmsub_): Ditto. (*3): Ditto. (avx512dq_mul3): Ditto. (*_mul3): Ditto. (*andnot3): Ditto. (3): Ditto. (*sub3_bcst): Removed. (*add3_bcst): Ditto. (*mul3_bcst): Ditto. (*_div3_bcst): Ditto. (*fma_fmadd__bcst_1): Ditto. (*fma_fmadd__bcst_2): Ditto. (*fma_fmadd__bcst_3): Ditto. (*fma_fmsub__bcst_1): Ditto. (*fma_fmsub__bcst_2): Ditto. (*fma_fmsub__bcst_3): Ditto. (*fma_fnmadd__bcst_1): Ditto. (*fma_fnmadd__bcst_2): Ditto. (*fma_fnmadd__bcst_3): Ditto. (*fma_fnmsub__bcst_1): Ditto. (*fma_fnmsub__bcst_2): Ditto. (*fma_fnmsub__bcst_3): Ditto. (*sub3_bcst): Ditto. (*add3_bcst): Ditto. (*avx512dq_mul3_bcst): Ditto. (*avx512f_mul3_bcst): Ditto. (*andnot3_bcst): Ditto. (*3_bcst): Ditto. * config/i386/subst.md (bcst_round_constraint): New subst attribute. (bcst_round_nimm_predicate): Ditto. (bcst_mask_prefix3): Ditto. (bcst_mask_prefix4): Ditto. --- gcc/config/i386/constraints.md | 4 + gcc/config/i386/i386-expand.c | 3 +- gcc/config/i386/i386.c | 37 ++++ gcc/config/i386/i386.h | 4 + gcc/config/i386/predicates.md | 13 ++ gcc/config/i386/sse.md | 373 ++++----------------------------- gcc/config/i386/subst.md | 4 + 7 files changed, 102 insertions(+), 336 deletions(-) diff --git a/gcc/config/i386/constraints.md b/gcc/config/i386/constraints.md index af37f5cd537..0b902d543b3 100644 --- a/gcc/config/i386/constraints.md +++ b/gcc/config/i386/constraints.md @@ -183,6 +183,10 @@ "@internal Memory operand without REX prefix." (match_operand 0 "norex_memory_operand")) +(define_special_memory_constraint "Br" + "@internal bcst memory operand." + (match_operand 0 "bcst_mem_operand")) + (define_constraint "Bs" "@internal Sibcall memory operand." (ior (and (not (match_test "TARGET_INDIRECT_BRANCH_REGISTER")) diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index d0d7a969637..3e8afe683dc 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -1045,7 +1045,8 @@ ix86_binary_operator_ok (enum rtx_code code, machine_mode mode, rtx src2 = operands[2]; /* Both source operands cannot be in memory. */ - if (MEM_P (src1) && MEM_P (src2)) + if ((MEM_P (src1) || bcst_mem_operand (src1, mode)) + && (MEM_P (src2) || bcst_mem_operand (src2, mode))) return false; /* Canonicalize operand order for commutative operators. */ diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 54c2cdaf060..502d24057b5 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -13098,6 +13098,43 @@ ix86_print_operand (FILE *file, rtx x, int code) fputs (dstr, file); } + /* Print bcst_mem_operand. */ + else if (GET_CODE (x) == VEC_DUPLICATE) + { + machine_mode vmode = GET_MODE (x); + /* Must be bcst_memory_operand. */ + gcc_assert (bcst_mem_operand (x, vmode)); + + rtx mem = XEXP (x,0); + ix86_print_operand (file, mem, 0); + + switch (vmode) + { + case E_V2DImode: + case E_V2DFmode: + fputs ("{1to2}", file); + break; + case E_V4SImode: + case E_V4SFmode: + case E_V4DImode: + case E_V4DFmode: + fputs ("{1to4}", file); + break; + case E_V8SImode: + case E_V8SFmode: + case E_V8DFmode: + case E_V8DImode: + fputs ("{1to8}", file); + break; + case E_V16SFmode: + case E_V16SImode: + fputs ("{1to16}", file); + break; + default: + gcc_unreachable (); + } + } + else { /* We have patterns that allow zero sets of memory, for instance. diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index e8bde37645a..24207d04211 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1272,6 +1272,10 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); (TARGET_FMA4 && ((MODE) == V4SFmode || (MODE) == V2DFmode \ || (MODE) == V8SFmode || (MODE) == V4DFmode)) +#define VALID_BCST_MODE_P(MODE) \ + ((MODE) == SFmode || (MODE) == DFmode \ + || (MODE) == SImode || (MODE) == DImode) + /* It is possible to write patterns to move flags; but until someone does it, */ #define AVOID_CCMODE_COPIES diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md index b03f9cd1c8c..be57cdaf768 100644 --- a/gcc/config/i386/predicates.md +++ b/gcc/config/i386/predicates.md @@ -1081,6 +1081,19 @@ (ior (match_operand 0 "register_operand") (match_operand 0 "vector_memory_operand"))) +(define_predicate "bcst_mem_operand" + (and (match_code "vec_duplicate") + (and (match_test "TARGET_AVX512F") + (ior (match_test "TARGET_AVX512VL") + (match_test "GET_MODE_SIZE (GET_MODE (op)) == 64"))) + (match_test "VALID_BCST_MODE_P (GET_MODE_INNER (GET_MODE (op)))") + (match_test "memory_operand (XEXP (op, 0), GET_MODE (XEXP (op, 0)))"))) + +; Return true when OP is bcst_mem_operand or vector_memory_operand. +(define_predicate "bcst_vector_operand" + (ior (match_operand 0 "vector_operand") + (match_operand 0 "bcst_mem_operand"))) + ;; Return true when OP is either nonimmediate operand, or any ;; CONST_VECTOR. (define_predicate "nonimmediate_or_const_vector_operand" diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 3689ab0e7b7..52635f6bc08 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -1756,8 +1756,8 @@ (define_insn "*3" [(set (match_operand:VF 0 "register_operand" "=x,v") (plusminus:VF - (match_operand:VF 1 "" "0,v") - (match_operand:VF 2 "" "xBm,")))] + (match_operand:VF 1 "" "0,v") + (match_operand:VF 2 "" "xBm,")))] "TARGET_SSE && ix86_binary_operator_ok (, mode, operands) && && " "@ @@ -1765,35 +1765,7 @@ v\t{%2, %1, %0|%0, %1, %2}" [(set_attr "isa" "noavx,avx") (set_attr "type" "sseadd") - (set_attr "prefix" "") - (set_attr "mode" "")]) - -(define_insn "*sub3_bcst" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (minus:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "v") - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m"))))] - "TARGET_AVX512F - && ix86_binary_operator_ok (MINUS, mode, operands) - && " - "vsub\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "prefix" "evex") - (set_attr "type" "sseadd") - (set_attr "mode" "")]) - -(define_insn "*add3_bcst" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (plus:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m")) - (match_operand:VF_AVX512 2 "register_operand" "v")))] - "TARGET_AVX512F - && ix86_binary_operator_ok (PLUS, mode, operands) - && " - "vadd\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "prefix" "evex") - (set_attr "type" "sseadd") + (set_attr "prefix" "") (set_attr "mode" "")]) ;; Standard scalar operation patterns which preserve the rest of the @@ -1846,32 +1818,19 @@ (define_insn "*mul3" [(set (match_operand:VF 0 "register_operand" "=x,v") (mult:VF - (match_operand:VF 1 "" "%0,v") - (match_operand:VF 2 "" "xBm,")))] - "TARGET_SSE - && !(MEM_P (operands[1]) && MEM_P (operands[2])) + (match_operand:VF 1 "" "%0,v") + (match_operand:VF 2 "" "xBm,")))] + "TARGET_SSE && ix86_binary_operator_ok (MULT, mode, operands) && && " "@ mul\t{%2, %0|%0, %2} vmul\t{%2, %1, %0|%0, %1, %2}" [(set_attr "isa" "noavx,avx") (set_attr "type" "ssemul") - (set_attr "prefix" "") + (set_attr "prefix" "") (set_attr "btver2_decode" "direct,double") (set_attr "mode" "")]) -(define_insn "*mul3_bcst" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (mult:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m")) - (match_operand:VF_AVX512 2 "register_operand" "v")))] - "TARGET_AVX512F && " - "vmul\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "prefix" "evex") - (set_attr "type" "ssemul") - (set_attr "mode" "")]) - ;; Standard scalar operation patterns which preserve the rest of the ;; vector for combiner. (define_insn "*_vm3" @@ -1943,26 +1902,14 @@ [(set (match_operand:VF 0 "register_operand" "=x,v") (div:VF (match_operand:VF 1 "register_operand" "0,v") - (match_operand:VF 2 "" "xBm,")))] + (match_operand:VF 2 "" "xBm,")))] "TARGET_SSE && && " "@ div\t{%2, %0|%0, %2} vdiv\t{%2, %1, %0|%0, %1, %2}" [(set_attr "isa" "noavx,avx") (set_attr "type" "ssediv") - (set_attr "prefix" "") - (set_attr "mode" "")]) - -(define_insn "*_div3_bcst" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (div:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "v") - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m"))))] - "TARGET_AVX512F && " - "vdiv\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "prefix" "evex") - (set_attr "type" "ssediv") + (set_attr "prefix" "") (set_attr "mode" "")]) (define_insn "_rcp2" @@ -4055,9 +4002,9 @@ (define_insn "fma_fmadd_" [(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")))] + (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} @@ -4066,46 +4013,6 @@ [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "*fma_fmadd__bcst_1" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (fma:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "%0") - (match_operand:VF_AVX512 2 "register_operand" "v") - (vec_duplicate:VF_AVX512 - (match_operand: 3 "memory_operand" "m"))))] - "TARGET_AVX512F && " - "vfmadd213\t{%3, %2, %0|%0, %2, %3}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fmadd__bcst_2" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m,m")) - (match_operand:VF_AVX512 2 "register_operand" "0,v") - (match_operand:VF_AVX512 3 "register_operand" "v,0")))] - "TARGET_AVX512F && " - "@ - vfmadd132\t{%1, %3, %0|%0, %3, %1} - vfmadd231\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fmadd__bcst_3" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "0,v") - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m,m")) - (match_operand:VF_AVX512 3 "register_operand" "v,0")))] - "TARGET_AVX512F && " - "@ - vfmadd132\t{%2, %3, %0|%0, %3, %2} - vfmadd231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - (define_insn "_fmadd__mask" [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") (vec_merge:VF_AVX512VL @@ -4171,10 +4078,10 @@ (define_insn "fma_fmsub_" [(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 1 "" "%0,0,v") + (match_operand:VF_SF_AVX512VL 2 "" ",v,") (neg:VF_SF_AVX512VL - (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] + (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] "TARGET_AVX512F && && " "@ vfmsub132\t{%2, %3, %0|%0, %3, %2} @@ -4183,49 +4090,6 @@ [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "*fma_fmsub__bcst_1" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (fma:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "%0") - (match_operand:VF_AVX512 2 "register_operand" "v") - (neg:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 3 "memory_operand" "m")))))] - "TARGET_AVX512F && " - "vfmsub213\t{%3, %2, %0|%0, %2, %3}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fmsub__bcst_2" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m,m")) - (match_operand:VF_AVX512 2 "register_operand" "0,v") - (neg:VF_AVX512 - (match_operand:VF_AVX512 3 "register_operand" "v,0"))))] - "TARGET_AVX512F && " - "@ - vfmsub132\t{%1, %3, %0|%0, %3, %1} - vfmsub231\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fmsub__bcst_3" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "0,v") - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m,m")) - (neg:VF_AVX512 - (match_operand:VF_AVX512 3 "nonimmediate_operand" "v,0"))))] - "TARGET_AVX512F && " - "@ - vfmsub132\t{%2, %3, %0|%0, %3, %2} - vfmsub231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - (define_insn "_fmsub__mask" [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") (vec_merge:VF_AVX512VL @@ -4294,9 +4158,9 @@ [(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")))] + (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} @@ -4305,49 +4169,6 @@ [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "*fma_fnmadd__bcst_1" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "%0")) - (match_operand:VF_AVX512 2 "register_operand" "v") - (vec_duplicate:VF_AVX512 - (match_operand: 3 "memory_operand" "m"))))] - "TARGET_AVX512F && " - "vfnmadd213\t{%3, %2, %0|%0, %2, %3}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fnmadd__bcst_2" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m,m"))) - (match_operand:VF_AVX512 2 "register_operand" "0,v") - (match_operand:VF_AVX512 3 "register_operand" "v,0")))] - "TARGET_AVX512F && " - "@ - vfnmadd132\t{%1, %3, %0|%0, %3, %1} - vfnmadd231\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fnmadd__bcst_3" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "0,v")) - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m,m")) - (match_operand:VF_AVX512 3 "register_operand" "v,0")))] - "TARGET_AVX512F && " - "@ - vfnmadd132\t{%2, %3, %0|%0, %3, %2} - vfnmadd231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - (define_insn "_fnmadd__mask" [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") (vec_merge:VF_AVX512VL @@ -4417,10 +4238,10 @@ [(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 1 "" "%0,0,v")) + (match_operand:VF_SF_AVX512VL 2 "" ",v,") (neg:VF_SF_AVX512VL - (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] + (match_operand:VF_SF_AVX512VL 3 "" "v,,0"))))] "TARGET_AVX512F && && " "@ vfnmsub132\t{%2, %3, %0|%0, %3, %2} @@ -4429,52 +4250,6 @@ [(set_attr "type" "ssemuladd") (set_attr "mode" "")]) -(define_insn "*fma_fnmsub__bcst_1" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "%0")) - (match_operand:VF_AVX512 2 "register_operand" "v") - (neg:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 3 "memory_operand" "m")))))] - "TARGET_AVX512F && " - "vfnmsub213\t{%3, %2, %0|%0, %2, %3}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fnmsub__bcst_2" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (vec_duplicate:VF_AVX512 - (match_operand: 1 "memory_operand" "m,m"))) - (match_operand:VF_AVX512 2 "register_operand" "0,v") - (neg:VF_AVX512 - (match_operand:VF_AVX512 3 "register_operand" "v,0"))))] - "TARGET_AVX512F && " - "@ - vfnmsub132\t{%1, %3, %0|%0, %3, %1} - vfnmsub231\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - -(define_insn "*fma_fnmsub__bcst_3" - [(set (match_operand:VF_AVX512 0 "register_operand" "=v,v") - (fma:VF_AVX512 - (neg:VF_AVX512 - (match_operand:VF_AVX512 1 "register_operand" "0,v")) - (vec_duplicate:VF_AVX512 - (match_operand: 2 "memory_operand" "m,m")) - (neg:VF_AVX512 - (match_operand:VF_AVX512 3 "register_operand" "v,0"))))] - "TARGET_AVX512F && " - "@ - vfnmsub132\t{%2, %3, %0|%0, %3, %2} - vfnmsub231\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "ssemuladd") - (set_attr "mode" "")]) - (define_insn "_fnmsub__mask" [(set (match_operand:VF_AVX512VL 0 "register_operand" "=v,v") (vec_merge:VF_AVX512VL @@ -11563,8 +11338,8 @@ (define_insn "*3" [(set (match_operand:VI_AVX2 0 "register_operand" "=x,v") (plusminus:VI_AVX2 - (match_operand:VI_AVX2 1 "vector_operand" "0,v") - (match_operand:VI_AVX2 2 "vector_operand" "xBm,vm")))] + (match_operand:VI_AVX2 1 "bcst_vector_operand" "0,v") + (match_operand:VI_AVX2 2 "bcst_vector_operand" "xBm,vmBr")))] "TARGET_SSE2 && ix86_binary_operator_ok (, mode, operands)" "@ p\t{%2, %0|%0, %2} @@ -11572,31 +11347,7 @@ [(set_attr "isa" "noavx,avx") (set_attr "type" "sseiadd") (set_attr "prefix_data16" "1,*") - (set_attr "prefix" "orig,vex") - (set_attr "mode" "")]) - -(define_insn "*sub3_bcst" - [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v") - (minus:VI48_AVX512VL - (match_operand:VI48_AVX512VL 1 "register_operand" "v") - (vec_duplicate:VI48_AVX512VL - (match_operand: 2 "memory_operand" "m"))))] - "TARGET_AVX512F && ix86_binary_operator_ok (MINUS, mode, operands)" - "vpsub\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "sseiadd") - (set_attr "prefix" "evex") - (set_attr "mode" "")]) - -(define_insn "*add3_bcst" - [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v") - (plus:VI48_AVX512VL - (vec_duplicate:VI48_AVX512VL - (match_operand: 1 "memory_operand" "m")) - (match_operand:VI48_AVX512VL 2 "register_operand" "v")))] - "TARGET_AVX512F && ix86_binary_operator_ok (PLUS, mode, operands)" - "vpadd\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "sseiadd") - (set_attr "prefix" "evex") + (set_attr "prefix" "orig,maybe_evex") (set_attr "mode" "")]) (define_insn "*3_mask" @@ -12110,24 +11861,13 @@ (set_attr "mode" "TI")]) (define_insn "avx512dq_mul3" - [(set (match_operand:VI8 0 "register_operand" "=v") - (mult:VI8 - (match_operand:VI8 1 "register_operand" "v") - (match_operand:VI8 2 "nonimmediate_operand" "vm")))] - "TARGET_AVX512DQ && " - "vpmullq\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "sseimul") - (set_attr "prefix" "evex") - (set_attr "mode" "")]) - -(define_insn "*avx512dq_mul3_bcst" [(set (match_operand:VI8_AVX512VL 0 "register_operand" "=v") (mult:VI8_AVX512VL - (vec_duplicate:VI8_AVX512VL - (match_operand: 1 "memory_operand" "m")) - (match_operand:VI8_AVX512VL 2 "register_operand" "v")))] - "TARGET_AVX512DQ" - "vpmullq\t{%1, %2, %0|%0, %2, %1}" + (match_operand:VI8_AVX512VL 1 "bcst_vector_operand" "%v") + (match_operand:VI8_AVX512VL 2 "bcst_vector_operand" "vmBr")))] + "TARGET_AVX512DQ && + && ix86_binary_operator_ok (MULT, mode, operands)" + "vpmullq\t{%2, %1, %0|%0, %1, %2}" [(set_attr "type" "sseimul") (set_attr "prefix" "evex") (set_attr "mode" "")]) @@ -12157,10 +11897,10 @@ (define_insn "*_mul3" [(set (match_operand:VI4_AVX512F 0 "register_operand" "=Yr,*x,v") (mult:VI4_AVX512F - (match_operand:VI4_AVX512F 1 "vector_operand" "%0,0,v") - (match_operand:VI4_AVX512F 2 "vector_operand" "YrBm,*xBm,vm")))] - "TARGET_SSE4_1 && !(MEM_P (operands[1]) && MEM_P (operands[2])) - && " + (match_operand:VI4_AVX512F 1 "bcst_vector_operand" "%0,0,v") + (match_operand:VI4_AVX512F 2 "bcst_vector_operand" "YrBm,*xBm,vmBr")))] + "TARGET_SSE4_1 && ix86_binary_operator_ok (MULT, mode, operands) + && " "@ pmulld\t{%2, %0|%0, %2} pmulld\t{%2, %0|%0, %2} @@ -12168,22 +11908,10 @@ [(set_attr "isa" "noavx,noavx,avx") (set_attr "type" "sseimul") (set_attr "prefix_extra" "1") - (set_attr "prefix" "") + (set_attr "prefix" "") (set_attr "btver2_decode" "vector,vector,vector") (set_attr "mode" "")]) -(define_insn "*avx512f_mul3_bcst" - [(set (match_operand:VI4_AVX512VL 0 "register_operand" "=v") - (mult:VI4_AVX512VL - (vec_duplicate:VI4_AVX512VL - (match_operand: 1 "memory_operand" "m")) - (match_operand:VI4_AVX512VL 2 "register_operand" "v")))] - "TARGET_AVX512F" - "vpmulld\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "sseimul") - (set_attr "prefix" "evex") - (set_attr "mode" "")]) - (define_expand "mul3" [(set (match_operand:VI8_AVX2_AVX512F 0 "register_operand") (mult:VI8_AVX2_AVX512F @@ -13210,7 +12938,7 @@ [(set (match_operand:VI 0 "register_operand" "=x,x,v") (and:VI (not:VI (match_operand:VI 1 "register_operand" "0,x,v")) - (match_operand:VI 2 "vector_operand" "xBm,xm,vm")))] + (match_operand:VI 2 "bcst_vector_operand" "xBm,xm,vmBr")))] "TARGET_SSE" { char buf[64]; @@ -13309,19 +13037,6 @@ ] (const_string "")))]) -(define_insn "*andnot3_bcst" - [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v") - (and:VI48_AVX512VL - (not:VI48_AVX512VL - (match_operand:VI48_AVX512VL 1 "register_operand" "v")) - (vec_duplicate:VI48_AVX512VL - (match_operand: 2 "memory_operand" "m"))))] - "TARGET_AVX512F" - "vpandn\t{%2, %1, %0|%0, %1, %2}" - [(set_attr "type" "sselog") - (set_attr "prefix" "evex") - (set_attr "mode" "")]) - (define_insn "*andnot3_mask" [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v") (vec_merge:VI48_AVX512VL @@ -13351,10 +13066,10 @@ (define_insn "3" [(set (match_operand:VI48_AVX_AVX512F 0 "register_operand" "=x,x,v") (any_logic:VI48_AVX_AVX512F - (match_operand:VI48_AVX_AVX512F 1 "vector_operand" "%0,x,v") - (match_operand:VI48_AVX_AVX512F 2 "vector_operand" "xBm,xm,vm")))] + (match_operand:VI48_AVX_AVX512F 1 "bcst_vector_operand" "%0,x,v") + (match_operand:VI48_AVX_AVX512F 2 "bcst_vector_operand" "xBm,xm,vmBr")))] "TARGET_SSE && - && !(MEM_P (operands[1]) && MEM_P (operands[2]))" + && ix86_binary_operator_ok (, mode, operands)" { char buf[64]; const char *ops; @@ -13540,18 +13255,6 @@ ] (const_string "")))]) -(define_insn "*3_bcst" - [(set (match_operand:VI48_AVX512VL 0 "register_operand" "=v") - (any_logic:VI48_AVX512VL - (vec_duplicate:VI48_AVX512VL - (match_operand: 1 "memory_operand" "m")) - (match_operand:VI48_AVX512VL 2 "register_operand" "v")))] - "TARGET_AVX512F && " - "vp\t{%1, %2, %0|%0, %2, %1}" - [(set_attr "type" "sseiadd") - (set_attr "prefix" "evex") - (set_attr "mode" "")]) - (define_mode_iterator VI1248_AVX512VLBW [(V64QI "TARGET_AVX512BW") (V32QI "TARGET_AVX512VL && TARGET_AVX512BW") (V16QI "TARGET_AVX512VL && TARGET_AVX512BW") diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md index 58ea9dc83e2..e037a9649aa 100644 --- a/gcc/config/i386/subst.md +++ b/gcc/config/i386/subst.md @@ -60,7 +60,9 @@ (define_subst_attr "mask_prefix" "mask" "vex" "evex") (define_subst_attr "mask_prefix2" "mask" "maybe_vex" "evex") (define_subst_attr "mask_prefix3" "mask" "orig,vex" "evex,evex") +(define_subst_attr "bcst_mask_prefix3" "mask" "orig,maybe_evex" "evex,evex") (define_subst_attr "mask_prefix4" "mask" "orig,orig,vex" "evex,evex,evex") +(define_subst_attr "bcst_mask_prefix4" "mask" "orig,orig,maybe_evex" "evex,evex,evex") (define_subst_attr "mask_expand_op3" "mask" "3" "5") (define_subst "mask" @@ -130,9 +132,11 @@ (define_subst_attr "round_mask_op4" "round" "" "") (define_subst_attr "round_sd_mask_op4" "round" "" "") (define_subst_attr "round_constraint" "round" "vm" "v") +(define_subst_attr "bcst_round_constraint" "round" "vmBr" "v") (define_subst_attr "round_constraint2" "round" "m" "v") (define_subst_attr "round_constraint3" "round" "rm" "r") (define_subst_attr "round_nimm_predicate" "round" "vector_operand" "register_operand") +(define_subst_attr "bcst_round_nimm_predicate" "round" "bcst_vector_operand" "register_operand") (define_subst_attr "round_nimm_scalar_predicate" "round" "nonimmediate_operand" "register_operand") (define_subst_attr "round_prefix" "round" "vex" "evex") (define_subst_attr "round_mode512bit_condition" "round" "1" "(mode == V16SFmode -- 2.30.2