[PATCH, i386]: Committed: Fix PR target/32708

Uros Bizjak ubizjak@gmail.com
Tue Jul 10 19:50:00 GMT 2007


Hello!

Currently, gcc generates quite unoptimized code for x86_64 for following 
test:

#include <emmintrin.h>
__m128i long2vector(long long i) { return _mm_cvtsi64x_si128(i); }


gcc -O2:

long2vector:
.LFB527:
movq %rdi, -8(%rsp)
movq -8(%rsp), %mm0
movq2dq %mm0, %xmm0
ret

The problem is that vec_concatv2di pattern doesn't have "r" register 
constraint for its 2nd input operand. "r" would be invalid for 32bit 
targets, so we need another pattern for 64bit targets. The above test 
then compiles depending on TARGET_INTER_UNIT_MOVES into:

k8:

long2vector:
.LFB3:
        movq    %rdi, -8(%rsp)
        movq    -8(%rsp), %xmm0
        ret

core2:

long2vector:
.LFB3:
        movq    %rdi, %xmm0
        ret

The patch was bootstrapped on x86_64 and regression tested for all 
default languages. Patch is committed to mainline SVN.

2007-07-10  Uros Bizjak  <ubizjak@gmail.com>

        PR target/32708
        * config/i386/sse.md (vec_concatv2di): Disable for TARGET_64BIT.
        (*vec_concatv2di_rex): New insn pattern.

testsuite/ChangeLog:

2007-07-10  Uros Bizjak  <ubizjak@gmail.com>

        PR target/32708
        * gcc.target/i386/pr32708-1.c: New test.
        * gcc.target/i386/pr32708-2.c: Ditto.
        * gcc.target/i386/pr32708-3.c: Ditto.

Uros.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pr32708.diff.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070710/8950908d/attachment.txt>


More information about the Gcc-patches mailing list