https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88464

--- Comment #24 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #23)
> (In reply to Uroš Bizjak from comment #22)
> > (In reply to Uroš Bizjak from comment #21)
> > > Indeed, -mavx512dq produces expected ktestb. Sorry for the false alarm.
> > 
> > f3 and f4 functions however can use ktestw even without -mavx512dq.
> 
> Eh, not my day. We can use kortestw to check if operand is zero with
> -mavx512f.

So, something like:

--cut here--
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index 6e29427e30c..c529406cccc 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -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")
--cut here--

Reply via email to