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 <andrey.turetskiy@intel.com>
Co-Authored-By: Anna Tikhonova <anna.tikhonova@intel.com>
Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com>
Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com>
Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com>
Co-Authored-By: Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Co-Authored-By: Michael Zolotukhin <michael.v.zolotukhin@intel.com>

From-SVN: r216820
This commit is contained in:
Alexander Ivchenko 2014-10-29 07:16:03 +00:00 committed by Kirill Yukhin
parent eee5d6f527
commit cdfb2db013
4 changed files with 57 additions and 14 deletions

View File

@ -1,3 +1,16 @@
2014-10-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Anna Tikhonova <anna.tikhonova@intel.com>
Ilya Tocar <ilya.tocar@intel.com>
Andrey Turetskiy <andrey.turetskiy@intel.com>
Ilya Verbin <ilya.verbin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com>
Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* config/i386/i386.md
(movhi_internal): Always detect maskmov.
(movqi_internal): Fix target check.
2014-10-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Anna Tikhonova <anna.tikhonova@intel.com>

View File

@ -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")

View File

@ -7,6 +7,17 @@
Kirill Yukhin <kirill.yukhin@intel.com>
Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* gcc.target/i386/avx512dq-kmovb-1.c: New.
2014-10-29 Alexander Ivchenko <alexander.ivchenko@intel.com>
Maxim Kuznetsov <maxim.kuznetsov@intel.com>
Anna Tikhonova <anna.tikhonova@intel.com>
Ilya Tocar <ilya.tocar@intel.com>
Andrey Turetskiy <andrey.turetskiy@intel.com>
Ilya Verbin <ilya.verbin@intel.com>
Kirill Yukhin <kirill.yukhin@intel.com>
Michael Zolotukhin <michael.v.zolotukhin@intel.com>
* gcc.target/i386/avx512bw-vpcmpequb-1.c: New.
* gcc.target/i386/avx512bw-vpcmpequb-2.c: Ditto.
* gcc.target/i386/avx512bw-vpcmpequw-1.c: Ditto.

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-mavx512dq -O2" } */
/* { dg-final { scan-assembler "kmovb\[ \\t\]+\[^\n\]*%k\[1-7\]" } } */
#include <immintrin.h>
volatile __m512d x;
volatile __mmask8 m;
void extern
avx512dq_test (void)
{
x = _mm512_mask_add_pd (x, m, x, x);
}