[PATCH] use __builtin_convertvector for _mm_cvtepi32_ps to enable constant propagation

Chandler Carruth chandlerc at google.com
Tue Oct 1 00:48:26 PDT 2013


You should add a tescase for emitting the clean (but unoptimized) IR from a
use of the intrinsic. You can find other test cases like
test/CodeGen/xop-builtin.c that you could base this off of...


On Tue, Oct 1, 2013 at 2:36 AM, Matthias Kretz <kretz at kde.org> wrote:

>
>   Testcase:
>
>
>     __m128 cvt0() { return _mm_cvtepi32_ps(_mm_set1_epi32(2)); }
>     __m128 cvt0(__m128i x) { return _mm_cvtepi32_ps(x); }
>
>   compiles to IR:
>
>
>     define <4 x float> @_Z4cvt0v() #0 {
>     entry:
>       ret <4 x float> <float 2.000000e+00, float 2.000000e+00, float
> 2.000000e+00, float 2.000000e+00>
>     }
>
>     define <4 x float> @_Z4cvt0Dv2_x(<2 x i64> %x) #0 {
>     entry:
>       %0 = bitcast <2 x i64> %x to <4 x i32>
>       %conv.i = sitofp <4 x i32> %0 to <4 x float>
>       ret <4 x float> %conv.i
>     }
>
>   and x86:
>
>
>     0000000000000000 <cvt0()>:
>        0:·       c5 f8 28 05 00 00 00 00 · vmovaps 0x0(%rip),%xmm0
>  # 8 <cvt0()+0x8>·    4: R_X86_64_PC32·         .LCPI0_0-0x4
>        8:·       c3                   ·    retq
>
>     0000000000000010 <cvt0(long long __vector(2))>:
>       10:·       c5 f8 5b c0          ·    vcvtdq2ps %xmm0,%xmm0
>       14:·       c3                   ·    retq
>
> http://llvm-reviews.chandlerc.com/D1792
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131001/cf81d234/attachment.html>


More information about the cfe-commits mailing list