Home | History | Annotate | Download | only in X86
      1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
      2 ; RUN: llc < %s -mtriple=i686-linux-pc -mcpu=corei7 | FileCheck %s --check-prefix=X32
      3 ; RUN: llc < %s -mtriple=x86_64-linux-pc -mcpu=corei7 | FileCheck %s --check-prefix=X64
      4 
      5 ; uitofp <2 x i32> codegen from buildvector or legalization is different but gives the same results
      6 ; across the full 0 - 0xFFFFFFFF u32 range.
      7 
      8 define <2 x float> @uitofp_2i32_cvt_buildvector(i32 %x, i32 %y, <2 x float> %v) {
      9 ; X32-LABEL: uitofp_2i32_cvt_buildvector:
     10 ; X32:       # %bb.0:
     11 ; X32-NEXT:    movq {{.*#+}} xmm1 = mem[0],zero
     12 ; X32-NEXT:    movdqa {{.*#+}} xmm2 = [1258291200,1258291200,1258291200,1258291200]
     13 ; X32-NEXT:    pblendw {{.*#+}} xmm2 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
     14 ; X32-NEXT:    psrld $16, %xmm1
     15 ; X32-NEXT:    pblendw {{.*#+}} xmm1 = xmm1[0],mem[1],xmm1[2],mem[3],xmm1[4],mem[5],xmm1[6],mem[7]
     16 ; X32-NEXT:    addps {{\.LCPI.*}}, %xmm1
     17 ; X32-NEXT:    addps %xmm2, %xmm1
     18 ; X32-NEXT:    mulps %xmm1, %xmm0
     19 ; X32-NEXT:    retl
     20 ;
     21 ; X64-LABEL: uitofp_2i32_cvt_buildvector:
     22 ; X64:       # %bb.0:
     23 ; X64-NEXT:    movd %edi, %xmm1
     24 ; X64-NEXT:    pinsrd $1, %esi, %xmm1
     25 ; X64-NEXT:    movdqa {{.*#+}} xmm2 = [1258291200,1258291200,1258291200,1258291200]
     26 ; X64-NEXT:    pblendw {{.*#+}} xmm2 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
     27 ; X64-NEXT:    psrld $16, %xmm1
     28 ; X64-NEXT:    pblendw {{.*#+}} xmm1 = xmm1[0],mem[1],xmm1[2],mem[3],xmm1[4],mem[5],xmm1[6],mem[7]
     29 ; X64-NEXT:    addps {{.*}}(%rip), %xmm1
     30 ; X64-NEXT:    addps %xmm2, %xmm1
     31 ; X64-NEXT:    mulps %xmm1, %xmm0
     32 ; X64-NEXT:    retq
     33   %t1 = uitofp i32 %x to float
     34   %t2 = insertelement <2 x float> undef, float %t1, i32 0
     35   %t3 = uitofp i32 %y to float
     36   %t4 = insertelement <2 x float> %t2, float %t3, i32 1
     37   %t5 = fmul <2 x float> %v, %t4
     38   ret <2 x float> %t5
     39 }
     40 
     41 define <2 x float> @uitofp_2i32_buildvector_cvt(i32 %x, i32 %y, <2 x float> %v) {
     42 ; X32-LABEL: uitofp_2i32_buildvector_cvt:
     43 ; X32:       # %bb.0:
     44 ; X32-NEXT:    movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
     45 ; X32-NEXT:    movss {{.*#+}} xmm2 = mem[0],zero,zero,zero
     46 ; X32-NEXT:    unpcklpd {{.*#+}} xmm2 = xmm2[0],xmm1[0]
     47 ; X32-NEXT:    movapd {{.*#+}} xmm1 = [4.503600e+15,4.503600e+15]
     48 ; X32-NEXT:    orpd %xmm1, %xmm2
     49 ; X32-NEXT:    subpd %xmm1, %xmm2
     50 ; X32-NEXT:    cvtpd2ps %xmm2, %xmm1
     51 ; X32-NEXT:    mulps %xmm1, %xmm0
     52 ; X32-NEXT:    retl
     53 ;
     54 ; X64-LABEL: uitofp_2i32_buildvector_cvt:
     55 ; X64:       # %bb.0:
     56 ; X64-NEXT:    movd %esi, %xmm1
     57 ; X64-NEXT:    movd %edi, %xmm2
     58 ; X64-NEXT:    punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm1[0]
     59 ; X64-NEXT:    movdqa {{.*#+}} xmm1 = [4.503600e+15,4.503600e+15]
     60 ; X64-NEXT:    por %xmm1, %xmm2
     61 ; X64-NEXT:    subpd %xmm1, %xmm2
     62 ; X64-NEXT:    cvtpd2ps %xmm2, %xmm1
     63 ; X64-NEXT:    mulps %xmm1, %xmm0
     64 ; X64-NEXT:    retq
     65   %t1 = insertelement <2 x i32> undef, i32 %x, i32 0
     66   %t2 = insertelement <2 x i32> %t1, i32 %y, i32 1
     67   %t3 = uitofp <2 x i32> %t2 to <2 x float>
     68   %t4 = fmul <2 x float> %v, %t3
     69   ret <2 x float> %t4
     70 }
     71 
     72 define <2 x float> @uitofp_2i32_legalized(<2 x i32> %in, <2 x float> %v) {
     73 ; X32-LABEL: uitofp_2i32_legalized:
     74 ; X32:       # %bb.0:
     75 ; X32-NEXT:    xorps %xmm2, %xmm2
     76 ; X32-NEXT:    blendps {{.*#+}} xmm2 = xmm0[0],xmm2[1],xmm0[2],xmm2[3]
     77 ; X32-NEXT:    movaps {{.*#+}} xmm0 = [4.503600e+15,4.503600e+15]
     78 ; X32-NEXT:    orps %xmm0, %xmm2
     79 ; X32-NEXT:    subpd %xmm0, %xmm2
     80 ; X32-NEXT:    cvtpd2ps %xmm2, %xmm0
     81 ; X32-NEXT:    mulps %xmm1, %xmm0
     82 ; X32-NEXT:    retl
     83 ;
     84 ; X64-LABEL: uitofp_2i32_legalized:
     85 ; X64:       # %bb.0:
     86 ; X64-NEXT:    xorps %xmm2, %xmm2
     87 ; X64-NEXT:    blendps {{.*#+}} xmm2 = xmm0[0],xmm2[1],xmm0[2],xmm2[3]
     88 ; X64-NEXT:    movaps {{.*#+}} xmm0 = [4.503600e+15,4.503600e+15]
     89 ; X64-NEXT:    orps %xmm0, %xmm2
     90 ; X64-NEXT:    subpd %xmm0, %xmm2
     91 ; X64-NEXT:    cvtpd2ps %xmm2, %xmm0
     92 ; X64-NEXT:    mulps %xmm1, %xmm0
     93 ; X64-NEXT:    retq
     94   %t1 = uitofp <2 x i32> %in to <2 x float>
     95   %t2 = fmul <2 x float> %v, %t1
     96   ret <2 x float> %t2
     97 }
     98