From: Alexander Ivchenko Date: Wed, 29 Oct 2014 07:16:03 +0000 (+0000) Subject: AVX-512. 89/n. Improve mask move insn generation. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cdfb2db0130565d8037bc1372a258d57325d5c2b;p=gcc.git AVX-512. 89/n. Improve mask move insn generation. gcc/ * config/i386/i386.md (movhi_internal): Always detect maskmov. (movqi_internal): Fix target check. gcc/testsuite/ * gcc.target/i386/avx512dq-kmovb-1.c: New. 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: r216820 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e28043f2225..514cdd54990 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2014-10-29 Alexander Ivchenko + Maxim Kuznetsov + Anna Tikhonova + Ilya Tocar + Andrey Turetskiy + Ilya Verbin + Kirill Yukhin + Michael Zolotukhin + + * config/i386/i386.md + (movhi_internal): Always detect maskmov. + (movqi_internal): Fix target check. + 2014-10-29 Alexander Ivchenko Maxim Kuznetsov Anna Tikhonova diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 7ba07c3ae7c..23ef131981e 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -2396,7 +2396,9 @@ } } [(set (attr "type") - (cond [(match_test "optimize_function_for_size_p (cfun)") + (cond [(eq_attr "alternative" "4,5,6") + (const_string "mskmov") + (match_test "optimize_function_for_size_p (cfun)") (const_string "imov") (and (eq_attr "alternative" "0") (ior (not (match_test "TARGET_PARTIAL_REG_STALL")) @@ -2405,8 +2407,6 @@ (and (eq_attr "alternative" "1,2") (match_operand:HI 1 "aligned_operand")) (const_string "imov") - (eq_attr "alternative" "4,5,6") - (const_string "mskmov") (and (match_test "TARGET_MOVX") (eq_attr "alternative" "0,2")) (const_string "imovx") @@ -2442,9 +2442,9 @@ (define_insn "*movqi_internal" [(set (match_operand:QI 0 "nonimmediate_operand" - "=q,q ,q ,r,r ,?r,m ,k,k,r") + "=q,q ,q ,r,r ,?r,m ,k,k,r ,m,k") (match_operand:QI 1 "general_operand" - "q ,qn,qm,q,rn,qm,qn,r ,k,k"))] + "q ,qn,qm,q,rn,qm,qn,r ,k,k,k,m"))] "!(MEM_P (operands[0]) && MEM_P (operands[1]))" { switch (get_attr_type (insn)) @@ -2456,12 +2456,16 @@ case TYPE_MSKMOV: switch (which_alternative) { - case 7: return TARGET_AVX512BW ? "kmovb\t{%k1, %0|%0, %k1}" + case 7: return TARGET_AVX512DQ ? "kmovb\t{%k1, %0|%0, %k1}" : "kmovw\t{%k1, %0|%0, %k1}"; - case 8: return TARGET_AVX512BW ? "kmovb\t{%1, %0|%0, %1}" + case 8: return TARGET_AVX512DQ ? "kmovb\t{%1, %0|%0, %1}" : "kmovw\t{%1, %0|%0, %1}"; - case 9: return TARGET_AVX512BW ? "kmovb\t{%1, %k0|%k0, %1}" + case 9: return TARGET_AVX512DQ ? "kmovb\t{%1, %k0|%k0, %1}" : "kmovw\t{%1, %k0|%k0, %1}"; + case 10: + case 11: + gcc_assert (TARGET_AVX512DQ); + return "kmovb\t{%1, %0|%0, %1}"; default: gcc_unreachable (); } @@ -2472,8 +2476,13 @@ return "mov{b}\t{%1, %0|%0, %1}"; } } - [(set (attr "type") - (cond [(and (eq_attr "alternative" "5") + [(set_attr "isa" "*,*,*,*,*,*,*,*,*,*,avx512dq,avx512dq") + (set (attr "type") + (cond [(eq_attr "alternative" "3,5") + (const_string "imovx") + (eq_attr "alternative" "7,8,9,10,11") + (const_string "mskmov") + (and (eq_attr "alternative" "5") (not (match_operand:QI 1 "aligned_operand"))) (const_string "imovx") (match_test "optimize_function_for_size_p (cfun)") @@ -2482,10 +2491,6 @@ (ior (not (match_test "TARGET_PARTIAL_REG_STALL")) (not (match_test "TARGET_QIMODE_MATH")))) (const_string "imov") - (eq_attr "alternative" "3,5") - (const_string "imovx") - (eq_attr "alternative" "7,8,9") - (const_string "mskmov") (and (match_test "TARGET_MOVX") (eq_attr "alternative" "2")) (const_string "imovx") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1a4f1865aec..e8ec94a97d7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -7,6 +7,17 @@ Kirill Yukhin Michael Zolotukhin + * gcc.target/i386/avx512dq-kmovb-1.c: New. + +2014-10-29 Alexander Ivchenko + Maxim Kuznetsov + Anna Tikhonova + Ilya Tocar + Andrey Turetskiy + Ilya Verbin + Kirill Yukhin + Michael Zolotukhin + * gcc.target/i386/avx512bw-vpcmpequb-1.c: New. * gcc.target/i386/avx512bw-vpcmpequb-2.c: Ditto. * gcc.target/i386/avx512bw-vpcmpequw-1.c: Ditto. diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c b/gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c new file mode 100644 index 00000000000..c886b5f08ec --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-kmovb-1.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-mavx512dq -O2" } */ +/* { dg-final { scan-assembler "kmovb\[ \\t\]+\[^\n\]*%k\[1-7\]" } } */ + +#include + +volatile __m512d x; +volatile __mmask8 m; + +void extern +avx512dq_test (void) +{ + x = _mm512_mask_add_pd (x, m, x, x); +}