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-pc-linux-gnu -mcpu=corei7 | FileCheck %s
      3 ; RUN: llc < %s -mtriple=i686-pc-linux-gnu -mcpu=core-avx-i | FileCheck %s --check-prefix=AVX
      4 
      5 define <1 x float> @test1(<1 x double>* %p) nounwind {
      6 ; CHECK-LABEL: test1:
      7 ; CHECK:       # %bb.0:
      8 ; CHECK-NEXT:    pushl %eax
      9 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
     10 ; CHECK-NEXT:    movsd {{.*#+}} xmm0 = mem[0],zero
     11 ; CHECK-NEXT:    cvtsd2ss %xmm0, %xmm0
     12 ; CHECK-NEXT:    movss %xmm0, (%esp)
     13 ; CHECK-NEXT:    flds (%esp)
     14 ; CHECK-NEXT:    popl %eax
     15 ; CHECK-NEXT:    retl
     16 ;
     17 ; AVX-LABEL: test1:
     18 ; AVX:       # %bb.0:
     19 ; AVX-NEXT:    pushl %eax
     20 ; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
     21 ; AVX-NEXT:    vmovsd {{.*#+}} xmm0 = mem[0],zero
     22 ; AVX-NEXT:    vcvtsd2ss %xmm0, %xmm0, %xmm0
     23 ; AVX-NEXT:    vmovss %xmm0, (%esp)
     24 ; AVX-NEXT:    flds (%esp)
     25 ; AVX-NEXT:    popl %eax
     26 ; AVX-NEXT:    retl
     27   %x = load <1 x double>, <1 x double>* %p
     28   %y = fptrunc <1 x double> %x to <1 x float>
     29   ret <1 x float> %y
     30 }
     31 
     32 define <2 x float> @test2(<2 x double>* %p) nounwind {
     33 ; CHECK-LABEL: test2:
     34 ; CHECK:       # %bb.0:
     35 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
     36 ; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
     37 ; CHECK-NEXT:    retl
     38 ;
     39 ; AVX-LABEL: test2:
     40 ; AVX:       # %bb.0:
     41 ; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
     42 ; AVX-NEXT:    vcvtpd2psx (%eax), %xmm0
     43 ; AVX-NEXT:    retl
     44   %x = load <2 x double>, <2 x double>* %p
     45   %y = fptrunc <2 x double> %x to <2 x float>
     46   ret <2 x float> %y
     47 }
     48 
     49 define <4 x float> @test3(<4 x double>* %p) nounwind {
     50 ; CHECK-LABEL: test3:
     51 ; CHECK:       # %bb.0:
     52 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
     53 ; CHECK-NEXT:    cvtpd2ps 16(%eax), %xmm1
     54 ; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
     55 ; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
     56 ; CHECK-NEXT:    retl
     57 ;
     58 ; AVX-LABEL: test3:
     59 ; AVX:       # %bb.0:
     60 ; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
     61 ; AVX-NEXT:    vcvtpd2psy (%eax), %xmm0
     62 ; AVX-NEXT:    retl
     63   %x = load <4 x double>, <4 x double>* %p
     64   %y = fptrunc <4 x double> %x to <4 x float>
     65   ret <4 x float> %y
     66 }
     67 
     68 define <8 x float> @test4(<8 x double>* %p) nounwind {
     69 ; CHECK-LABEL: test4:
     70 ; CHECK:       # %bb.0:
     71 ; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %eax
     72 ; CHECK-NEXT:    cvtpd2ps 16(%eax), %xmm1
     73 ; CHECK-NEXT:    cvtpd2ps (%eax), %xmm0
     74 ; CHECK-NEXT:    unpcklpd {{.*#+}} xmm0 = xmm0[0],xmm1[0]
     75 ; CHECK-NEXT:    cvtpd2ps 48(%eax), %xmm2
     76 ; CHECK-NEXT:    cvtpd2ps 32(%eax), %xmm1
     77 ; CHECK-NEXT:    unpcklpd {{.*#+}} xmm1 = xmm1[0],xmm2[0]
     78 ; CHECK-NEXT:    retl
     79 ;
     80 ; AVX-LABEL: test4:
     81 ; AVX:       # %bb.0:
     82 ; AVX-NEXT:    movl {{[0-9]+}}(%esp), %eax
     83 ; AVX-NEXT:    vcvtpd2psy (%eax), %xmm0
     84 ; AVX-NEXT:    vcvtpd2psy 32(%eax), %xmm1
     85 ; AVX-NEXT:    vinsertf128 $1, %xmm1, %ymm0, %ymm0
     86 ; AVX-NEXT:    retl
     87   %x = load <8 x double>, <8 x double>* %p
     88   %y = fptrunc <8 x double> %x to <8 x float>
     89   ret <8 x float> %y
     90 }
     91 
     92 
     93