OSDN Git Service

Replace the uint64_t -> double convertion algorithm with one that's more efficient.
authorBill Wendling <isanbard@gmail.com>
Thu, 5 Jan 2012 02:13:20 +0000 (02:13 +0000)
committerBill Wendling <isanbard@gmail.com>
Thu, 5 Jan 2012 02:13:20 +0000 (02:13 +0000)
commit397ae210ce55545eaff21c5813d060fa567843a5
tree770fb82a1369d475243dfcb43be83af4be859777
parent1130d220a33a6171e408d9ec4594242907541e1b
Replace the uint64_t -> double convertion algorithm with one that's more efficient.

This small bit of ASM code is sufficient to do what the old algorithm did:

     movq       %rax,  %xmm0
     punpckldq  (c0),  %xmm0  // c0: (uint4){ 0x43300000U, 0x45300000U, 0U, 0U }
     subpd      (c1),  %xmm0  // c1: (double2){ 0x1.0p52, 0x1.0p52 * 0x1.0p32 }
   #ifdef __SSE3__
     haddpd   %xmm0, %xmm0
   #else
     pshufd   $0x4e, %xmm0, %xmm1
     addpd    %xmm1, %xmm0
   #endif

It's arguably faster. One caveat, the 'haddpd' instruction isn't very fast on
all processors.
<rdar://problem/7719814>

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@147593 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp