OSDN Git Service

Implement InstCombine/vec_demanded_elts.ll:test2. This allows us to turn
authorChris Lattner <sabre@nondot.org>
Sat, 14 Apr 2007 22:29:23 +0000 (22:29 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 14 Apr 2007 22:29:23 +0000 (22:29 +0000)
commit69878336519f09aadf976cf1b5c73dafbb54ce6f
treeb77f325fd9a00d9d718773bba9404186bbbae8af
parent2caf0ec7ad9899a068d1e232e8ddac5da97dbf0e
Implement InstCombine/vec_demanded_elts.ll:test2.  This allows us to turn

unsigned test(float f) {
 return _mm_cvtsi128_si32( (__m128i) _mm_set_ss( f*f ));
}

into:

_test:
        movss 4(%esp), %xmm0
        mulss %xmm0, %xmm0
        movd %xmm0, %eax
        ret

instead of:

_test:
        movss 4(%esp), %xmm0
        mulss %xmm0, %xmm0
        xorps %xmm1, %xmm1
        movss %xmm0, %xmm1
        movd %xmm1, %eax
        ret

GCC gets:

_test:
        subl    $28, %esp
        movss   32(%esp), %xmm0
        mulss   %xmm0, %xmm0
        xorps   %xmm1, %xmm1
        movss   %xmm0, %xmm1
        movaps  %xmm1, %xmm0
        movd    %xmm0, 12(%esp)
        movl    12(%esp), %eax
        addl    $28, %esp
        ret

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36020 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/InstructionCombining.cpp