PR tree-optimization/105668: Provide vcond_mask_v1tiv1ti pattern.
authorRoger Sayle <roger@nextmovesoftware.com>
Tue, 24 May 2022 14:15:12 +0000 (15:15 +0100)
committerRoger Sayle <roger@nextmovesoftware.com>
Tue, 24 May 2022 14:15:12 +0000 (15:15 +0100)
commit793f847ba7dbe7638f1c27178868edbefd3a8108
tree9b59d1ee0fea0edd8dc22d6d1da6801af08960fc
parent9e7a0e42a15eb53850496e91f2e484ed74ac3617
PR tree-optimization/105668: Provide vcond_mask_v1tiv1ti pattern.

This patch is an alternate/supplementary fix to PR tree-optimization/105668
that provides a vcond_mask_v1titi optab/define_expand to the i386 backend.
An undocumented feature/bug of GCC's vectorization is that any target that
provides a vec_cmpeq<mode><mode> has to also provide a matching
vcond_mask<mode><mode>.  This backend patch preserves the status quo,
rather than fixes the underlying problem.

One aspect of this clean-up is that ix86_expand_sse_movcc provides
fallback implementations using pand/pandn/por that effectively make
V2DImode and V1TImode vcond_mask available on any TARGET_SSE2, not
just TARGET_SSE4_2.  This allows a simplification as V2DI mode can
be handled by using a VI_128 mode iterator instead of a VI124_128
mode iterator, and instead this define_expand is effectively renamed
to provide a V1TImode vcond_mask expander (as V1TI isn't in VI_128).

2022-05-24  Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog
PR tree-optimization/105668
* config/i386/i386-expand.cc (ix86_expand_sse_movcc): Support
V1TImode, just like V2DImode.
* config/i386/sse.md (vcond_mask_<mode><sseintvecmodelower>):
Use VI_128 mode iterator instead of VI124_128 to include V2DI.
(vcond_mask_v2div2di): Delete.
(vcond_mask_v1tiv1ti): New define_expand.

gcc/testsuite/ChangeLog
PR tree-optimization/105668
* gcc.target/i386/pr105668.c: New test case.
gcc/config/i386/i386-expand.cc
gcc/config/i386/sse.md
gcc/testsuite/gcc.target/i386/pr105668.c [new file with mode: 0644]