From acd377795f259233d3b9c5cd81a9156c1c3081f9 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 7 Nov 2017 21:49:30 +0100 Subject: [PATCH] re PR target/82855 (AVX512: replace OP+movemask with OP_mask+ktest) PR target/82855 * config/i386/i386.md (SWI1248_AVX512BWDQ2_64): New mode iterator. (*cmp_ccz_1): New insn with $k alternative. * gcc.target/i386/avx512dq-pr82855.c: New test. From-SVN: r254510 --- gcc/ChangeLog | 4 ++++ gcc/config/i386/i386.md | 20 +++++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ .../gcc.target/i386/avx512dq-pr82855.c | 14 +++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 gcc/testsuite/gcc.target/i386/avx512dq-pr82855.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e387ee2cbaa..8b9e91a2fba 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,9 @@ 2017-11-07 Jakub Jelinek + PR target/82855 + * config/i386/i386.md (SWI1248_AVX512BWDQ2_64): New mode iterator. + (*cmp_ccz_1): New insn with $k alternative. + PR target/82855 * config/i386/i386.c (ix86_swap_binary_operands_p): Treat RTX_COMM_COMPARE as commutative as well. diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 36061e19adb..90e622cbaf5 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -1275,6 +1275,26 @@ (compare:CC (match_operand:SWI48 0 "nonimmediate_operand") (match_operand:SWI48 1 "")))]) +(define_mode_iterator SWI1248_AVX512BWDQ2_64 + [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ") + (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW && TARGET_64BIT")]) + +(define_insn "*cmp_ccz_1" + [(set (reg FLAGS_REG) + (compare (match_operand:SWI1248_AVX512BWDQ2_64 0 + "nonimmediate_operand" ",?m,$k") + (match_operand:SWI1248_AVX512BWDQ2_64 1 "const0_operand")))] + "ix86_match_ccmode (insn, CCZmode)" + "@ + test{}\t%0, %0 + cmp{}\t{%1, %0|%0, %1} + ktest\t%0, %0" + [(set_attr "type" "test,icmp,msklog") + (set_attr "length_immediate" "0,1,*") + (set_attr "modrm_class" "op0,unknown,*") + (set_attr "prefix" "*,*,vex") + (set_attr "mode" "")]) + (define_insn "*cmp_ccno_1" [(set (reg FLAGS_REG) (compare (match_operand:SWI 0 "nonimmediate_operand" ",?m") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d8a018846b8..ee526bfc949 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-11-07 Jakub Jelinek + + PR target/82855 + * gcc.target/i386/avx512dq-pr82855.c: New test. + 2017-11-07 Uros Bizjak PR target/80425 diff --git a/gcc/testsuite/gcc.target/i386/avx512dq-pr82855.c b/gcc/testsuite/gcc.target/i386/avx512dq-pr82855.c new file mode 100644 index 00000000000..563454c3578 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/avx512dq-pr82855.c @@ -0,0 +1,14 @@ +/* PR target/82855 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -mavx512vl -mavx512dq" } */ +/* { dg-final { scan-assembler {\mktestb\M} } } */ + +#include + +int +foo (const __m256i *ptr) +{ + __m256i v = _mm256_loadu_si256 (ptr); + __mmask8 m = _mm256_cmpeq_epi32_mask (v, _mm256_setzero_si256 ()); + return 0 == m; +} -- 2.30.2