i386: Split DI<->V2DI patterns before reload with -m32.

While investigating improvements to x86's stv2 pass (to correctly cost
moves between SI<->V4SI and DI<->V2DI), I noticed that we're currently
relatively inefficient for DI mode transfers on 32-bit targets with
SSE2, where reload ultimately decides to perform these moves via the
stack.  It's possible to do better by making the highpart and lowpart
registers explicit before reload.

Consider the test case below:

typedef long long v2di __attribute__ ((__vector_size__ (16)));

long long foo(v2di x)
{
  return x[0];
}

long long ext();
v2di mem;

void bar()
{
  long long x = ext();
  mem = (v2di){x,0};
}

where foo tests V2DI->DI mode, and bar tests DI->V2DI mode.
Currently -m32 -O2 -msse2 generates:

foo:    subl    $28, %esp
        movq    %xmm0, 8(%esp)
        movl    8(%esp), %eax
        movl    12(%esp), %edx
        addl    $28, %esp
        ret

bar:	subl    $28, %esp
        call    ext
        movl    %eax, 8(%esp)
        movl    %edx, 12(%esp)
        movq    8(%esp), %xmm0
        movaps  %xmm0, mem
        addl    $28, %esp
        ret

With this patch, we now avoid going via the stack:

foo:	movd    %xmm0, %eax
        pshufd  $225, %xmm0, %xmm0
        movd    %xmm0, %edx
        ret

bar:	subl    $12, %esp
        call    ext
        movd    %eax, %xmm0
        movd    %edx, %xmm1
        punpckldq       %xmm1, %xmm0
        movaps  %xmm0, mem
        addl    $12, %esp
        ret

2026-07-21  Roger Sayle  <roger@nextmovesoftware.com>
	    Uros Bizjak  <ubizjak@gmail.com>

gcc/ChangeLog
	* config/i386/sse.md (define_split): Split *vec_extractv2di_0_sse
	before reload on !TARGET_64BIT with TARGET_SSE2.
	(define_split): Likewise split *vec_concatv2di_0 before reload
	on !TARGET_64BIT with TARGET_SSE2.

gcc/testsuite/ChangeLog
	* gcc.target/i386/sse2-stv-7.c: New test case.
	* gcc.target/i386/sse4_1-stv-13.c: Likewise.
3 files changed