This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, i386]: Vectorize unsigned int -> double conversions


Hello!

This patch enables vectorization of unsigned int -> double conversions. The implementation is the same as for unsigned int -> float [1].

The testcase:

unsigned int a[256];
double b[256];

void foo(void)
{
  int i;

  for (i=0; i<256; ++i)
    b[i] = a[i];
}

compiles to:

foo:
    xorpd    %xmm3, %xmm3
    xorl    %eax, %eax
    movapd    .LC0(%rip), %xmm4
.L2:
    movdqa    a(%rax), %xmm1
    cvtdq2pd    %xmm1, %xmm2
    movapd    %xmm2, %xmm0
    pshufd    $238, %xmm1, %xmm1
    cmpltpd    %xmm3, %xmm0
    cvtdq2pd    %xmm1, %xmm1
    andpd    %xmm4, %xmm0
    addpd    %xmm2, %xmm0
    movapd    %xmm0, b(%rax,%rax)
    movapd    %xmm1, %xmm0
    cmpltpd    %xmm3, %xmm0
    andpd    %xmm4, %xmm0
    addpd    %xmm1, %xmm0
    movapd    %xmm0, b+16(%rax,%rax)
    addq    $16, %rax
    cmpq    $1024, %rax
    jne    .L2
    rep
    ret

.LC0:
    .long    0
    .long    1106247680
    .long    0
    .long    1106247680


2009-07-21 Uros Bizjak <ubizjak@gmail.com>


    * config/i386/sse.md (vec_unpacku_float_hi_v4si): New expander.
    (vec_unpacku_float_lo_v4si): Ditto.

testsuite/ChangeLog:

2009-07-21 Uros Bizjak <ubizjak@gmail.com>

* gcc.target/i386/vectorize8.c: New test.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu. Patch was committed to mainline.

Uros.

Attachment: p.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]