On Tue, Mar 15, 2022 at 10:52 PM Roger Sayle <ro...@nextmovesoftware.com> wrote:
>
>
> This simple i386 patch unblocks a more significant change.  The testcase
> gcc.target/i386/sse2-pr94680.c isn't quite testing what's intended, and
> alas the fix for PR target/94680 doesn't (yet) handle V2DF mode.
>
> For the first test from sse2-pr94680.c, below
>
> v2df foo_v2df (v2df x) {
>   return __builtin_shuffle (x, (v2df) { 0, 0 }, (v2di) { 0, 2 });
> }
>
> GCC on x86_64-pc-linux-gnu with -O2 currently generates:
>
>         movhpd  .LC0(%rip), %xmm0
>         ret
> .LC0:
>         .long   0
>         .long   0
>
> which passes the test as it contains a mov insn and no xor.
> Alas reading a zero from the constant pool isn't quite the
> desired implementation.  With this patch we now generate:
>
>         movq    %xmm0, %xmm0
>         ret
>
> The same code as we generate for V2DI, and add a stricter
> test case.  My first attempt tried using VI8F_128 to generalize
> the existing sse2_movq128 define_insn to both V2DI and V2DF.
> Alas, CODE_FOR_sse2_movq128 is exposed as a builtin in
> i386-builtin.def, requiring some internal name changes, that
You can turn sse2_movq128 into a expander to avoid builtin-related
change, then use VI8F_128 in the new define_insn.
With that change, patch LGTM.
> ultimately the testsuite was unhappy with.  The simpler solution
> (that works) is to clone/specialize a new V2DF *sse2_movq128_2.
>
> This patch has been tested on x86_64-pc-linux-gnu with make bootstrap
> and make -k check with no new failures.  Ok for mainline?
>
>
> 2022-03-15  Roger Sayle  <ro...@nextmovesoftware.com>
>
> gcc/ChangeLog
>         PR target/94680
>         * config/i386/sse.md (*sse2_movq128_2): A version of sse2_movq128
>         for V2DF mode.
>
> gcc/testsuite/ChangeLog
>         PR target/94680
>         * gcc.target/i386/sse2-pr94680-2.c: New stricter V2DF test case.
>
>
> Thanks in advance,
> Roger
> --
>


-- 
BR,
Hongtao

Reply via email to