https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113576
--- Comment #20 from Hongtao Liu <liuhongt at gcc dot gnu.org> --- > Note that I wonder how to eliminate redundant maskings? I suppose > eventually combine tracking nonzero bits where obvious would do > that? For example for cmp:V4SI we know the bits will be zero but > I wonder if the RTL IL is obvious enough to derive this (or whether > there's a target hook for extra nonzero bit discovery, say for > unspecs). I guess we need extra patterns to make combine know, we already have those for zero_extend. 3970;; Since vpcmpd implicitly clear the upper bits of dest, transform 3971;; vpcmpd + zero_extend to vpcmpd since the instruction 3972(define_insn_and_split "*<avx512>_cmp<V48H_AVX512VL:mode>3_zero_extend<SWI248x:mode>" 3973 [(set (match_operand:SWI248x 0 "register_operand") 3974 (zero_extend:SWI248x 3975 (unspec:<V48H_AVX512VL:avx512fmaskmode> 3976 [(match_operand:V48H_AVX512VL 1 "nonimmediate_operand") 3977 (match_operand:V48H_AVX512VL 2 "nonimmediate_operand") 3978 (match_operand:SI 3 "const_0_to_7_operand")] 3979 UNSPEC_PCMP)))]