Hello! Attached patch uses equivalent instruction, where HImode variant is also enabled for plain AVX512F isa.
2018-12-19 Uros Bizjak <ubiz...@gmail.com> * config/i386/i386.md (SWI1248_AVX512BWDQ_64): Rename from SWI1248_AVX512BWDQ2_64. Unconditionally enable HImode. (*cmp<mode>_ccz_1): Emit kortest instead of ktest insn. Use SWI1248_AVX512BWDQ_64 mode iterator and enable only for TARGET_AVX512F. testsuite/ChangeLog: 2018-12-19 Uros Bizjak <ubiz...@gmail.com> * gcc.target/i386/avx512dq-pr82855.c: Update scan-assembler pattern. Bootstrapped and regression tested on x86_64-linux-gnu {,-m32}. Committed to mailine SVN. Uros.
Index: config/i386/i386.md =================================================================== --- config/i386/i386.md (revision 267276) +++ config/i386/i386.md (working copy) @@ -1244,20 +1244,20 @@ (compare:CC (match_operand:SWI48 0 "nonimmediate_operand") (match_operand:SWI48 1 "<general_operand>")))]) -(define_mode_iterator SWI1248_AVX512BWDQ2_64 - [(QI "TARGET_AVX512DQ") (HI "TARGET_AVX512DQ") +(define_mode_iterator SWI1248_AVX512BWDQ_64 + [(QI "TARGET_AVX512DQ") HI (SI "TARGET_AVX512BW") (DI "TARGET_AVX512BW && TARGET_64BIT")]) (define_insn "*cmp<mode>_ccz_1" [(set (reg FLAGS_REG) - (compare (match_operand:SWI1248_AVX512BWDQ2_64 0 + (compare (match_operand:SWI1248_AVX512BWDQ_64 0 "nonimmediate_operand" "<r>,?m<r>,$k") - (match_operand:SWI1248_AVX512BWDQ2_64 1 "const0_operand")))] - "ix86_match_ccmode (insn, CCZmode)" + (match_operand:SWI1248_AVX512BWDQ_64 1 "const0_operand")))] + "TARGET_AVX512F && ix86_match_ccmode (insn, CCZmode)" "@ test{<imodesuffix>}\t%0, %0 cmp{<imodesuffix>}\t{%1, %0|%0, %1} - ktest<mskmodesuffix>\t%0, %0" + kortest<mskmodesuffix>\t%0, %0" [(set_attr "type" "test,icmp,msklog") (set_attr "length_immediate" "0,1,*") (set_attr "prefix" "*,*,vex") Index: testsuite/gcc.target/i386/avx512dq-pr82855.c =================================================================== --- testsuite/gcc.target/i386/avx512dq-pr82855.c (revision 267276) +++ testsuite/gcc.target/i386/avx512dq-pr82855.c (working copy) @@ -1,7 +1,7 @@ /* PR target/82855 */ /* { dg-do compile } */ /* { dg-options "-O2 -mavx512vl -mavx512dq" } */ -/* { dg-final { scan-assembler {\mktestb\M} } } */ +/* { dg-final { scan-assembler {\mkortestb\M} } } */ #include <immintrin.h>