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

--- Comment #6 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
Another potential buggy place is 

240  vexit_reduc_67 = mask_patt_43.28_62 & mask_patt_43.28_63;
241  if (vexit_reduc_67 == { -1, -1, -1, -1 })
242    goto <bb 6>; [94.50%]
243  else


is expanded to 

 319(insn 69 68 70 8 (set (reg:CCZ 17 flags)
 320        (compare:CCZ (reg:QI 189 [ vexit_reduc_67 ])
 321            (const_int -1 [0xffffffffffffffff]))) "test.c":83:18 discrim 1
9 {*cmpqi_1}

But it should only test the lower 4 bits, the higher part is zeroed by avx512
comparison instructions.

 293(insn 65 64 66 8 (set (reg:QI 186 [ mask_patt_43.28_62 ])
 294        (unspec:QI [
 295                (reg:V4DI 124 [ vect__29.26 ])
 296                (reg:V4DI 185)
 297                (const_int 0 [0])
 298            ] UNSPEC_PCMP)) "test.c":83:18 discrim 1 2811
{avx512vl_cmpv4di3}
 299     (nil))
 300(insn 66 65 67 8 (set (reg:V4DI 187)
 301        (const_vector:V4DI [
 302                (const_int 0 [0]) repeated x4
 303            ])) "test.c":83:18 discrim 1 2021 {movv4di_internal}
 304     (nil))
 305(insn 67 66 68 8 (set (reg:QI 188 [ mask_patt_43.28_63 ])
 306        (unspec:QI [
 307                (reg:V4DI 125 [ vect__29.27 ])
 308                (reg:V4DI 187)
 309                (const_int 0 [0])
 310            ] UNSPEC_PCMP)) "test.c":83:18 discrim 1 2811
{avx512vl_cmpv4di3}
 311     (nil))
 312(insn 68 67 69 8 (parallel [
 313            (set (reg:QI 189 [ vexit_reduc_67 ])
 314                (and:QI (reg:QI 186 [ mask_patt_43.28_62 ])
 315                    (reg:QI 188 [ mask_patt_43.28_63 ])))
 316            (clobber (reg:CC 17 flags))
 317        ]) "test.c":83:18 discrim 1 618 {*andqi_1}
 318     (nil))

Reply via email to