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