1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i386-apple-darwin10 -mattr=+avx | FileCheck %s
4 define <8 x float> @cvt_v8i8_v8f32(<8 x i8> %src) {
5 ; CHECK-LABEL: cvt_v8i8_v8f32:
7 ; CHECK-NEXT: vpmovsxbd %xmm0, %xmm1
8 ; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
9 ; CHECK-NEXT: vpmovsxbd %xmm0, %xmm0
10 ; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
11 ; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
13 %res = sitofp <8 x i8> %src to <8 x float>
17 define <8 x float> @cvt_v8i16_v8f32(<8 x i16> %src) {
18 ; CHECK-LABEL: cvt_v8i16_v8f32:
20 ; CHECK-NEXT: vpmovsxwd %xmm0, %xmm1
21 ; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
22 ; CHECK-NEXT: vpmovsxwd %xmm0, %xmm0
23 ; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
24 ; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
26 %res = sitofp <8 x i16> %src to <8 x float>
30 define <4 x float> @cvt_v4i8_v4f32(<4 x i8> %src) {
31 ; CHECK-LABEL: cvt_v4i8_v4f32:
33 ; CHECK-NEXT: vpmovsxbd %xmm0, %xmm0
34 ; CHECK-NEXT: vcvtdq2ps %xmm0, %xmm0
36 %res = sitofp <4 x i8> %src to <4 x float>
40 define <4 x float> @cvt_v4i16_v4f32(<4 x i16> %src) {
41 ; CHECK-LABEL: cvt_v4i16_v4f32:
43 ; CHECK-NEXT: vpmovsxwd %xmm0, %xmm0
44 ; CHECK-NEXT: vcvtdq2ps %xmm0, %xmm0
46 %res = sitofp <4 x i16> %src to <4 x float>
50 define <8 x float> @cvt_v8u8_v8f32(<8 x i8> %src) {
51 ; CHECK-LABEL: cvt_v8u8_v8f32:
53 ; CHECK-NEXT: vpmovzxbd {{.*#+}} xmm1 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
54 ; CHECK-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
55 ; CHECK-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
56 ; CHECK-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
57 ; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
59 %res = uitofp <8 x i8> %src to <8 x float>
63 define <8 x float> @cvt_v8u16_v8f32(<8 x i16> %src) {
64 ; CHECK-LABEL: cvt_v8u16_v8f32:
66 ; CHECK-NEXT: vpxor %xmm1, %xmm1, %xmm1
67 ; CHECK-NEXT: vpunpckhwd {{.*#+}} xmm1 = xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
68 ; CHECK-NEXT: vpmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
69 ; CHECK-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
70 ; CHECK-NEXT: vcvtdq2ps %ymm0, %ymm0
72 %res = uitofp <8 x i16> %src to <8 x float>
76 define <4 x float> @cvt_v4u8_v4f32(<4 x i8> %src) {
77 ; CHECK-LABEL: cvt_v4u8_v4f32:
79 ; CHECK-NEXT: vpmovzxbd {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero
80 ; CHECK-NEXT: vcvtdq2ps %xmm0, %xmm0
82 %res = uitofp <4 x i8> %src to <4 x float>
86 define <4 x float> @cvt_v4u16_v4f32(<4 x i16> %src) {
87 ; CHECK-LABEL: cvt_v4u16_v4f32:
89 ; CHECK-NEXT: vpmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
90 ; CHECK-NEXT: vcvtdq2ps %xmm0, %xmm0
92 %res = uitofp <4 x i16> %src to <4 x float>
96 define <8 x i8> @cvt_v8f32_v8i8(<8 x float> %src) {
97 ; CHECK-LABEL: cvt_v8f32_v8i8:
99 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
100 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
101 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
102 ; CHECK-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
103 ; CHECK-NEXT: vzeroupper
105 %res = fptosi <8 x float> %src to <8 x i8>
109 define <8 x i16> @cvt_v8f32_v8i16(<8 x float> %src) {
110 ; CHECK-LABEL: cvt_v8f32_v8i16:
112 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
113 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
114 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
115 ; CHECK-NEXT: vzeroupper
117 %res = fptosi <8 x float> %src to <8 x i16>
121 define <4 x i8> @cvt_v4f32_v4i8(<4 x float> %src) {
122 ; CHECK-LABEL: cvt_v4f32_v4i8:
124 ; CHECK-NEXT: vcvttps2dq %xmm0, %xmm0
125 ; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
127 %res = fptosi <4 x float> %src to <4 x i8>
131 define <4 x i16> @cvt_v4f32_v4i16(<4 x float> %src) {
132 ; CHECK-LABEL: cvt_v4f32_v4i16:
134 ; CHECK-NEXT: vcvttps2dq %xmm0, %xmm0
135 ; CHECK-NEXT: vpackssdw %xmm0, %xmm0, %xmm0
137 %res = fptosi <4 x float> %src to <4 x i16>
141 define <8 x i8> @cvt_v8f32_v8u8(<8 x float> %src) {
142 ; CHECK-LABEL: cvt_v8f32_v8u8:
144 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
145 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
146 ; CHECK-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
147 ; CHECK-NEXT: vpackuswb %xmm0, %xmm0, %xmm0
148 ; CHECK-NEXT: vzeroupper
150 %res = fptoui <8 x float> %src to <8 x i8>
154 define <8 x i16> @cvt_v8f32_v8u16(<8 x float> %src) {
155 ; CHECK-LABEL: cvt_v8f32_v8u16:
157 ; CHECK-NEXT: vcvttps2dq %ymm0, %ymm0
158 ; CHECK-NEXT: vextractf128 $1, %ymm0, %xmm1
159 ; CHECK-NEXT: vpackusdw %xmm1, %xmm0, %xmm0
160 ; CHECK-NEXT: vzeroupper
162 %res = fptoui <8 x float> %src to <8 x i16>
166 define <4 x i8> @cvt_v4f32_v4u8(<4 x float> %src) {
167 ; CHECK-LABEL: cvt_v4f32_v4u8:
169 ; CHECK-NEXT: vcvttps2dq %xmm0, %xmm0
170 ; CHECK-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,4,8,12,u,u,u,u,u,u,u,u,u,u,u,u]
172 %res = fptoui <4 x float> %src to <4 x i8>
176 define <4 x i16> @cvt_v4f32_v4u16(<4 x float> %src) {
177 ; CHECK-LABEL: cvt_v4f32_v4u16:
179 ; CHECK-NEXT: vcvttps2dq %xmm0, %xmm0
180 ; CHECK-NEXT: vpackusdw %xmm0, %xmm0, %xmm0
182 %res = fptoui <4 x float> %src to <4 x i16>