https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101639
--- Comment #33 from Hongtao Liu <liuhongt at gcc dot gnu.org> ---
> >
> > hard to fix it in the combine
> wait, we can use (eq op 0) instead of (xor op constm1) to check if op is
> allones, then it should be handled.
Now we have below for reduc_mask_{and,ior_xor}.
reduc_mask_and:
vpxor %xmm0, %xmm0, %xmm0
vpcmpeqd (%rdi), %ymm0, %ymm0
vptest %ymm0, %ymm0
sete %al
vzeroupper
ret
reduc_mask_ior:
vmovdqu (%rdi), %ymm0
vptest %ymm0, %ymm0
setne %al
vzeroupper
ret
reduc_mask_xor:
vpxor %xmm1, %xmm1, %xmm1
vpcmpeqd (%rdi), %ymm1, %ymm0
vpcmpeqd %ymm1, %ymm0, %ymm0
vmovmskps %ymm0, %eax
popcntl %eax, %eax
andl $1, %eax
vzeroupper
ret