On Fri, Apr 23, 2021 at 11:04 AM Hongtao Liu <crazy...@gmail.com> wrote: > > On Fri, Apr 23, 2021 at 3:18 PM Uros Bizjak <ubiz...@gmail.com> wrote: > > > > On Fri, Apr 23, 2021 at 9:15 AM Hongtao Liu <crazy...@gmail.com> wrote: > > > > > > On Fri, Apr 23, 2021 at 2:50 PM Uros Bizjak <ubiz...@gmail.com> wrote: > > > > > > > > On Fri, Apr 23, 2021 at 8:36 AM Hongtao Liu <crazy...@gmail.com> wrote: > > > > > > > > > > Hi: > > > > > The patch is a follow-up to > > > > > https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564320.html. > > > > > Bootstrapped and regtested on x86-64_iinux-gnu{-m32,}. > > > > > Ok for trunk? > > > > > gcc/ChangeLog: > > > > > > > > > > PR target/98911 > > > > > * config/i386/i386-builtin.def (BDESC): Change the icode of > > > > > the following builtins to CODE_FOR_nothing. > > > > > * config/i386/i386.c (ix86_gimple_fold_builtin): Fold > > > > > IX86_BUILTIN_PCMPEQB128, IX86_BUILTIN_PCMPEQW128, > > > > > IX86_BUILTIN_PCMPEQD128, IX86_BUILTIN_PCMPEQQ, > > > > > IX86_BUILTIN_PCMPEQB256, IX86_BUILTIN_PCMPEQW256, > > > > > IX86_BUILTIN_PCMPEQD256, IX86_BUILTIN_PCMPEQQ256, > > > > > IX86_BUILTIN_PCMPGTB128, IX86_BUILTIN_PCMPGTW128, > > > > > IX86_BUILTIN_PCMPGTD128, IX86_BUILTIN_PCMPGTQ, > > > > > IX86_BUILTIN_PCMPGTB256, IX86_BUILTIN_PCMPGTW256, > > > > > IX86_BUILTIN_PCMPGTD256, IX86_BUILTIN_PCMPGTQ256. > > > > > * config/i386/sse.md (avx2_eq<mode>3): Deleted. > > > > > (sse2_eq<mode>3): Ditto. > > > > > (sse2_gt<mode>3): Rename to .. > > > > > (*sse2_gt<mode>3): .. this. > > > > > > > > > > gcc/testsuite/ChangeLog: > > > > > > > > > > PR target/98911 > > > > > * gcc.target/i386/pr98911.c: New test. > > > > > * gcc.target/i386/funcspec-8.c: Remove __builtin_ia32_pcmpgtq > > > > > since it has been folded. > > > > > > > > > > > > -(define_expand "sse2_eq<mode>3" > > > > - [(set (match_operand:VI124_128 0 "register_operand") > > > > - (eq:VI124_128 > > > > - (match_operand:VI124_128 1 "vector_operand") > > > > - (match_operand:VI124_128 2 "vector_operand")))] > > > > - "TARGET_SSE2 && !TARGET_XOP " > > > > - "ix86_fixup_binary_operands_no_copy (EQ, <MODE>mode, operands);") > > > > - > > > > (define_expand "sse4_1_eqv2di3" > > > > [(set (match_operand:V2DI 0 "register_operand") > > > > (eq:V2DI > > > > > > > > You can also remove sse4_1_eqv2di3 expander. > > > > > > Oh, yes. > > > > > > > > > > > -#ifdef __SSE4_2__ > > > > -#error "-msse4.2 should not be set for this test" > > > > -#endif > > > > - > > > > -__m128i sse4_2_pcmpgtq (__m128i a, __m128i b) > > > > __attribute__((__target__("sse4.2"))); > > > > -__m128i generic_pcmpgtq (__m128i ab, __m128i b); > > > > - > > > > -__m128i > > > > -sse4_2_pcmpgtq (__m128i a, __m128i b) > > > > -{ > > > > - return __builtin_ia32_pcmpgtq (a, b); > > > > -} > > > > - > > > > -__m128i > > > > -generic_pcmpgtq (__m128i a, __m128i b) > > > > -{ > > > > - return __builtin_ia32_pcmpgtq (a, b); /* { dg-error > > > > "needs isa option" } */ > > > > -} > > > > > > > > Why remove the above? It is testing isa options, it has nothing to do > > > > with improved folding. > > > > > > If the backend does not support the corresponding instruction, the > > > vector operation will be automatically lowered to scalar, so no error > > > will be reported > > > > I see. It would be nice to change the test to use some other SSE4.2 > > builtin (there are plenty of packed compares) and not remove it > > altogether. > > Updated patch.
LGTM. Thanks, Uros.