1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=CHECK-SSE
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK-AVX,CHECK-AVX2
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=CHECK-AVX,CHECK-AVX512F,CHECK-NO-FASTFMA
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx -fp-contract=fast | FileCheck %s --check-prefixes=CHECK-AVX,CHECK-AVX512F,CHECK-FMA
7 declare i16 @llvm.umax.i16(i16, i16)
8 declare i64 @llvm.umin.i64(i64, i64)
10 declare <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float>, <4 x i32>)
12 define <4 x float> @fmul_pow2_4xfloat(<4 x i32> %i) {
13 ; CHECK-SSE-LABEL: fmul_pow2_4xfloat:
15 ; CHECK-SSE-NEXT: pslld $23, %xmm0
16 ; CHECK-SSE-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
17 ; CHECK-SSE-NEXT: retq
19 ; CHECK-AVX2-LABEL: fmul_pow2_4xfloat:
20 ; CHECK-AVX2: # %bb.0:
21 ; CHECK-AVX2-NEXT: vpslld $23, %xmm0, %xmm0
22 ; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm1 = [1091567616,1091567616,1091567616,1091567616]
23 ; CHECK-AVX2-NEXT: vpaddd %xmm1, %xmm0, %xmm0
24 ; CHECK-AVX2-NEXT: retq
26 ; CHECK-NO-FASTFMA-LABEL: fmul_pow2_4xfloat:
27 ; CHECK-NO-FASTFMA: # %bb.0:
28 ; CHECK-NO-FASTFMA-NEXT: vpslld $23, %xmm0, %xmm0
29 ; CHECK-NO-FASTFMA-NEXT: vpbroadcastd {{.*#+}} xmm1 = [1091567616,1091567616,1091567616,1091567616]
30 ; CHECK-NO-FASTFMA-NEXT: vpaddd %xmm1, %xmm0, %xmm0
31 ; CHECK-NO-FASTFMA-NEXT: retq
33 ; CHECK-FMA-LABEL: fmul_pow2_4xfloat:
35 ; CHECK-FMA-NEXT: vpslld $23, %xmm0, %xmm0
36 ; CHECK-FMA-NEXT: vpaddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
37 ; CHECK-FMA-NEXT: retq
38 %p2 = shl <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %i
39 %p2_f = uitofp <4 x i32> %p2 to <4 x float>
40 %r = fmul <4 x float> <float 9.000000e+00, float 9.000000e+00, float 9.000000e+00, float 9.000000e+00>, %p2_f
44 define <4 x float> @fmul_pow2_ldexp_4xfloat(<4 x i32> %i) {
45 ; CHECK-SSE-LABEL: fmul_pow2_ldexp_4xfloat:
47 ; CHECK-SSE-NEXT: subq $56, %rsp
48 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 64
49 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
50 ; CHECK-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[3,3,3,3]
51 ; CHECK-SSE-NEXT: movd %xmm1, %edi
52 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
53 ; CHECK-SSE-NEXT: callq ldexpf@PLT
54 ; CHECK-SSE-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
55 ; CHECK-SSE-NEXT: pshufd $238, {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
56 ; CHECK-SSE-NEXT: # xmm0 = mem[2,3,2,3]
57 ; CHECK-SSE-NEXT: movd %xmm0, %edi
58 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
59 ; CHECK-SSE-NEXT: callq ldexpf@PLT
60 ; CHECK-SSE-NEXT: unpcklps (%rsp), %xmm0 # 16-byte Folded Reload
61 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
62 ; CHECK-SSE-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
63 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
64 ; CHECK-SSE-NEXT: movd %xmm0, %edi
65 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
66 ; CHECK-SSE-NEXT: callq ldexpf@PLT
67 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
68 ; CHECK-SSE-NEXT: pshufd $85, {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
69 ; CHECK-SSE-NEXT: # xmm0 = mem[1,1,1,1]
70 ; CHECK-SSE-NEXT: movd %xmm0, %edi
71 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
72 ; CHECK-SSE-NEXT: callq ldexpf@PLT
73 ; CHECK-SSE-NEXT: movaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
74 ; CHECK-SSE-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
75 ; CHECK-SSE-NEXT: unpcklpd (%rsp), %xmm1 # 16-byte Folded Reload
76 ; CHECK-SSE-NEXT: # xmm1 = xmm1[0],mem[0]
77 ; CHECK-SSE-NEXT: movaps %xmm1, %xmm0
78 ; CHECK-SSE-NEXT: addq $56, %rsp
79 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 8
80 ; CHECK-SSE-NEXT: retq
82 ; CHECK-AVX-LABEL: fmul_pow2_ldexp_4xfloat:
84 ; CHECK-AVX-NEXT: subq $40, %rsp
85 ; CHECK-AVX-NEXT: .cfi_def_cfa_offset 48
86 ; CHECK-AVX-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
87 ; CHECK-AVX-NEXT: vextractps $1, %xmm0, %edi
88 ; CHECK-AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
89 ; CHECK-AVX-NEXT: callq ldexpf@PLT
90 ; CHECK-AVX-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill
91 ; CHECK-AVX-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
92 ; CHECK-AVX-NEXT: vmovd %xmm0, %edi
93 ; CHECK-AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
94 ; CHECK-AVX-NEXT: callq ldexpf@PLT
95 ; CHECK-AVX-NEXT: vinsertps $16, (%rsp), %xmm0, %xmm0 # 16-byte Folded Reload
96 ; CHECK-AVX-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[2,3]
97 ; CHECK-AVX-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill
98 ; CHECK-AVX-NEXT: vmovaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
99 ; CHECK-AVX-NEXT: vextractps $2, %xmm0, %edi
100 ; CHECK-AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
101 ; CHECK-AVX-NEXT: callq ldexpf@PLT
102 ; CHECK-AVX-NEXT: vmovaps (%rsp), %xmm1 # 16-byte Reload
103 ; CHECK-AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm1[0,1],xmm0[0],xmm1[3]
104 ; CHECK-AVX-NEXT: vmovaps %xmm0, (%rsp) # 16-byte Spill
105 ; CHECK-AVX-NEXT: vmovaps {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
106 ; CHECK-AVX-NEXT: vextractps $3, %xmm0, %edi
107 ; CHECK-AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
108 ; CHECK-AVX-NEXT: callq ldexpf@PLT
109 ; CHECK-AVX-NEXT: vmovaps (%rsp), %xmm1 # 16-byte Reload
110 ; CHECK-AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[0]
111 ; CHECK-AVX-NEXT: addq $40, %rsp
112 ; CHECK-AVX-NEXT: .cfi_def_cfa_offset 8
113 ; CHECK-AVX-NEXT: retq
114 %r = call <4 x float> @llvm.ldexp.v4f32.v4i32(<4 x float> <float 9.000000e+00, float 9.000000e+00, float 9.000000e+00, float 9.000000e+00>, <4 x i32> %i)
118 define <4 x float> @fdiv_pow2_4xfloat(<4 x i32> %i) {
119 ; CHECK-SSE-LABEL: fdiv_pow2_4xfloat:
120 ; CHECK-SSE: # %bb.0:
121 ; CHECK-SSE-NEXT: pslld $23, %xmm0
122 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm1 = [1091567616,1091567616,1091567616,1091567616]
123 ; CHECK-SSE-NEXT: psubd %xmm0, %xmm1
124 ; CHECK-SSE-NEXT: movdqa %xmm1, %xmm0
125 ; CHECK-SSE-NEXT: retq
127 ; CHECK-AVX-LABEL: fdiv_pow2_4xfloat:
128 ; CHECK-AVX: # %bb.0:
129 ; CHECK-AVX-NEXT: vpslld $23, %xmm0, %xmm0
130 ; CHECK-AVX-NEXT: vpbroadcastd {{.*#+}} xmm1 = [1091567616,1091567616,1091567616,1091567616]
131 ; CHECK-AVX-NEXT: vpsubd %xmm0, %xmm1, %xmm0
132 ; CHECK-AVX-NEXT: retq
133 %p2 = shl <4 x i32> <i32 1, i32 1, i32 1, i32 1>, %i
134 %p2_f = uitofp <4 x i32> %p2 to <4 x float>
135 %r = fdiv <4 x float> <float 9.000000e+00, float 9.000000e+00, float 9.000000e+00, float 9.000000e+00>, %p2_f
139 declare <8 x half> @llvm.ldexp.v8f16.v8i16(<8 x half>, <8 x i16>)
141 define <8 x half> @fmul_pow2_8xhalf(<8 x i16> %i) {
142 ; CHECK-SSE-LABEL: fmul_pow2_8xhalf:
143 ; CHECK-SSE: # %bb.0:
144 ; CHECK-SSE-NEXT: subq $88, %rsp
145 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 96
146 ; CHECK-SSE-NEXT: movdqa %xmm0, %xmm1
147 ; CHECK-SSE-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4,4,5,5,6,6,7,7]
148 ; CHECK-SSE-NEXT: pslld $23, %xmm1
149 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm2 = [1065353216,1065353216,1065353216,1065353216]
150 ; CHECK-SSE-NEXT: paddd %xmm2, %xmm1
151 ; CHECK-SSE-NEXT: cvttps2dq %xmm1, %xmm1
152 ; CHECK-SSE-NEXT: movaps %xmm1, (%rsp) # 16-byte Spill
153 ; CHECK-SSE-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
154 ; CHECK-SSE-NEXT: pslld $23, %xmm0
155 ; CHECK-SSE-NEXT: paddd %xmm2, %xmm0
156 ; CHECK-SSE-NEXT: cvttps2dq %xmm0, %xmm0
157 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
158 ; CHECK-SSE-NEXT: pextrw $0, %xmm0, %eax
159 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
160 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
161 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
162 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
163 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
164 ; CHECK-SSE-NEXT: pextrw $2, %xmm0, %eax
165 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
166 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
167 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
168 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
169 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
170 ; CHECK-SSE-NEXT: pextrw $4, %xmm0, %eax
171 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
172 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
173 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
174 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
175 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
176 ; CHECK-SSE-NEXT: pextrw $6, %xmm0, %eax
177 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
178 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
179 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
180 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
181 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
182 ; CHECK-SSE-NEXT: pextrw $0, %xmm0, %eax
183 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
184 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
185 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
186 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
187 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
188 ; CHECK-SSE-NEXT: pextrw $2, %xmm0, %eax
189 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
190 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
191 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
192 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
193 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
194 ; CHECK-SSE-NEXT: pextrw $4, %xmm0, %eax
195 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
196 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
197 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
198 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
199 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
200 ; CHECK-SSE-NEXT: pextrw $6, %xmm0, %eax
201 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
202 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
203 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
204 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
205 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
206 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
207 ; CHECK-SSE-NEXT: movaps %xmm0, (%rsp) # 16-byte Spill
208 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
209 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
210 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
211 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
212 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
213 ; CHECK-SSE-NEXT: punpcklwd (%rsp), %xmm0 # 16-byte Folded Reload
214 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
215 ; CHECK-SSE-NEXT: movdqa %xmm0, (%rsp) # 16-byte Spill
216 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
217 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
218 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
219 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
220 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
221 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
222 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
223 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
224 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
225 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
226 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
227 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
228 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
229 ; CHECK-SSE-NEXT: punpckldq (%rsp), %xmm0 # 16-byte Folded Reload
230 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
231 ; CHECK-SSE-NEXT: movdqa %xmm0, (%rsp) # 16-byte Spill
232 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
233 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
234 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
235 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
236 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
237 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
238 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
239 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
240 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
241 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
242 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
243 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
244 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
245 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
246 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
247 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
248 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
249 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
250 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
251 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
252 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
253 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
254 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
255 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
256 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
257 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
258 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
259 ; CHECK-SSE-NEXT: punpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
260 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
261 ; CHECK-SSE-NEXT: punpcklqdq (%rsp), %xmm0 # 16-byte Folded Reload
262 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0]
263 ; CHECK-SSE-NEXT: addq $88, %rsp
264 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 8
265 ; CHECK-SSE-NEXT: retq
267 ; CHECK-AVX2-LABEL: fmul_pow2_8xhalf:
268 ; CHECK-AVX2: # %bb.0:
269 ; CHECK-AVX2-NEXT: subq $120, %rsp
270 ; CHECK-AVX2-NEXT: .cfi_def_cfa_offset 128
271 ; CHECK-AVX2-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
272 ; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} ymm1 = [1,1,1,1,1,1,1,1]
273 ; CHECK-AVX2-NEXT: vpsllvd %ymm0, %ymm1, %ymm0
274 ; CHECK-AVX2-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,1,4,5,8,9,12,13,u,u,u,u,u,u,u,u,16,17,20,21,24,25,28,29,u,u,u,u,u,u,u,u]
275 ; CHECK-AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
276 ; CHECK-AVX2-NEXT: vmovdqu %ymm0, {{[-0-9]+}}(%r{{[sb]}}p) # 32-byte Spill
277 ; CHECK-AVX2-NEXT: vpextrw $0, %xmm0, %eax
278 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
279 ; CHECK-AVX2-NEXT: vzeroupper
280 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
281 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
282 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
283 ; CHECK-AVX2-NEXT: vpextrw $1, %xmm0, %eax
284 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
285 ; CHECK-AVX2-NEXT: vzeroupper
286 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
287 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
288 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
289 ; CHECK-AVX2-NEXT: vpextrw $2, %xmm0, %eax
290 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
291 ; CHECK-AVX2-NEXT: vzeroupper
292 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
293 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
294 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
295 ; CHECK-AVX2-NEXT: vpextrw $3, %xmm0, %eax
296 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
297 ; CHECK-AVX2-NEXT: vzeroupper
298 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
299 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
300 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
301 ; CHECK-AVX2-NEXT: vpextrw $4, %xmm0, %eax
302 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
303 ; CHECK-AVX2-NEXT: vzeroupper
304 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
305 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
306 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
307 ; CHECK-AVX2-NEXT: vpextrw $5, %xmm0, %eax
308 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
309 ; CHECK-AVX2-NEXT: vzeroupper
310 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
311 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
312 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
313 ; CHECK-AVX2-NEXT: vpextrw $6, %xmm0, %eax
314 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
315 ; CHECK-AVX2-NEXT: vzeroupper
316 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
317 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
318 ; CHECK-AVX2-NEXT: vmovdqu {{[-0-9]+}}(%r{{[sb]}}p), %ymm0 # 32-byte Reload
319 ; CHECK-AVX2-NEXT: vpextrw $7, %xmm0, %eax
320 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
321 ; CHECK-AVX2-NEXT: vzeroupper
322 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
323 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
324 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
325 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
326 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
327 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
328 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
329 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
330 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
331 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
332 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
333 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
334 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
335 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
336 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
337 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
338 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
339 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
340 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
341 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
342 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
343 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
344 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
345 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
346 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
347 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
348 ; CHECK-AVX2-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
349 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
350 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
351 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
352 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
353 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
354 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
355 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
356 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
357 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
358 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
359 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
360 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
361 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
362 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
363 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
364 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
365 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
366 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
367 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
368 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
369 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
370 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
371 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
372 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
373 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
374 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
375 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
376 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
377 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
378 ; CHECK-AVX2-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
379 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
380 ; CHECK-AVX2-NEXT: vpunpcklqdq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
381 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0]
382 ; CHECK-AVX2-NEXT: addq $120, %rsp
383 ; CHECK-AVX2-NEXT: .cfi_def_cfa_offset 8
384 ; CHECK-AVX2-NEXT: retq
386 ; CHECK-NO-FASTFMA-LABEL: fmul_pow2_8xhalf:
387 ; CHECK-NO-FASTFMA: # %bb.0:
388 ; CHECK-NO-FASTFMA-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
389 ; CHECK-NO-FASTFMA-NEXT: vpbroadcastd {{.*#+}} ymm1 = [1,1,1,1,1,1,1,1]
390 ; CHECK-NO-FASTFMA-NEXT: vpsllvd %ymm0, %ymm1, %ymm1
391 ; CHECK-NO-FASTFMA-NEXT: vpmovdw %zmm1, %ymm0
392 ; CHECK-NO-FASTFMA-NEXT: vpextrw $7, %xmm0, %eax
393 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm2
394 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
395 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm2, %eax
396 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
397 ; CHECK-NO-FASTFMA-NEXT: vpextrw $6, %xmm0, %eax
398 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm3, %xmm3
399 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm3, %xmm3
400 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm3, %eax
401 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
402 ; CHECK-NO-FASTFMA-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm3[0],xmm2[0],xmm3[1],xmm2[1],xmm3[2],xmm2[2],xmm3[3],xmm2[3]
403 ; CHECK-NO-FASTFMA-NEXT: vpextrw $5, %xmm0, %eax
404 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm4, %xmm3
405 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm3, %xmm3
406 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm3, %eax
407 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
408 ; CHECK-NO-FASTFMA-NEXT: vpextrw $4, %xmm0, %eax
409 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm4, %xmm4
410 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm4, %xmm4
411 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm4, %eax
412 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm4
413 ; CHECK-NO-FASTFMA-NEXT: vpunpcklwd {{.*#+}} xmm3 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3]
414 ; CHECK-NO-FASTFMA-NEXT: vpunpckldq {{.*#+}} xmm2 = xmm3[0],xmm2[0],xmm3[1],xmm2[1]
415 ; CHECK-NO-FASTFMA-NEXT: vpextrw $3, %xmm0, %eax
416 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm3
417 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm3, %xmm3
418 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm3, %eax
419 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
420 ; CHECK-NO-FASTFMA-NEXT: vpextrw $2, %xmm0, %eax
421 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm4
422 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm4, %xmm4
423 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm4, %eax
424 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm4
425 ; CHECK-NO-FASTFMA-NEXT: vpunpcklwd {{.*#+}} xmm3 = xmm4[0],xmm3[0],xmm4[1],xmm3[1],xmm4[2],xmm3[2],xmm4[3],xmm3[3]
426 ; CHECK-NO-FASTFMA-NEXT: vpextrw $0, %xmm1, %eax
427 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm1
428 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm1, %xmm1
429 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm1, %eax
430 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm1
431 ; CHECK-NO-FASTFMA-NEXT: vpextrw $1, %xmm0, %eax
432 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm0
433 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
434 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm0, %eax
435 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
436 ; CHECK-NO-FASTFMA-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
437 ; CHECK-NO-FASTFMA-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1]
438 ; CHECK-NO-FASTFMA-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm2[0]
439 ; CHECK-NO-FASTFMA-NEXT: vcvtph2ps %xmm0, %ymm0
440 ; CHECK-NO-FASTFMA-NEXT: vbroadcastss {{.*#+}} ymm1 = [8.192E+3,8.192E+3,8.192E+3,8.192E+3,8.192E+3,8.192E+3,8.192E+3,8.192E+3]
441 ; CHECK-NO-FASTFMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
442 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %ymm0, %xmm0
443 ; CHECK-NO-FASTFMA-NEXT: vzeroupper
444 ; CHECK-NO-FASTFMA-NEXT: retq
446 ; CHECK-FMA-LABEL: fmul_pow2_8xhalf:
447 ; CHECK-FMA: # %bb.0:
448 ; CHECK-FMA-NEXT: vpbroadcastw {{.*#+}} xmm1 = [1,1,1,1,1,1,1,1]
449 ; CHECK-FMA-NEXT: vpsllvw %xmm0, %xmm1, %xmm0
450 ; CHECK-FMA-NEXT: vpextrw $7, %xmm0, %eax
451 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm1
452 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm1, %xmm1
453 ; CHECK-FMA-NEXT: vmovd %xmm1, %eax
454 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm1
455 ; CHECK-FMA-NEXT: vpextrw $6, %xmm0, %eax
456 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm2
457 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
458 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
459 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
460 ; CHECK-FMA-NEXT: vpextrw $5, %xmm0, %eax
461 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm3, %xmm3
462 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm3, %xmm3
463 ; CHECK-FMA-NEXT: vmovd %xmm3, %eax
464 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
465 ; CHECK-FMA-NEXT: vpextrw $4, %xmm0, %eax
466 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm4, %xmm4
467 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
468 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm2
469 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
470 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
471 ; CHECK-FMA-NEXT: vpextrw $3, %xmm0, %eax
472 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm4
473 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm4
474 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
475 ; CHECK-FMA-NEXT: vmovd %xmm4, %eax
476 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
477 ; CHECK-FMA-NEXT: vpextrw $2, %xmm0, %eax
478 ; CHECK-FMA-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
479 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm2
480 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
481 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
482 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
483 ; CHECK-FMA-NEXT: vpextrw $1, %xmm0, %eax
484 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm4
485 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
486 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm3
487 ; CHECK-FMA-NEXT: vmovd %xmm3, %eax
488 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
489 ; CHECK-FMA-NEXT: vpextrw $0, %xmm0, %eax
490 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm0
491 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
492 ; CHECK-FMA-NEXT: vmovd %xmm0, %eax
493 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
494 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
495 ; CHECK-FMA-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
496 ; CHECK-FMA-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
497 ; CHECK-FMA-NEXT: vcvtph2ps %xmm0, %ymm0
498 ; CHECK-FMA-NEXT: vmulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm0, %ymm0
499 ; CHECK-FMA-NEXT: vcvtps2ph $4, %ymm0, %xmm0
500 ; CHECK-FMA-NEXT: vzeroupper
501 ; CHECK-FMA-NEXT: retq
502 %p2 = shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, %i
503 %p2_f = uitofp <8 x i16> %p2 to <8 x half>
504 %r = fmul <8 x half> <half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000>, %p2_f
508 define <8 x half> @fmul_pow2_ldexp_8xhalf(<8 x i16> %i) {
509 ; CHECK-SSE-LABEL: fmul_pow2_ldexp_8xhalf:
510 ; CHECK-SSE: # %bb.0:
511 ; CHECK-SSE-NEXT: subq $72, %rsp
512 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 80
513 ; CHECK-SSE-NEXT: movdqa %xmm0, (%rsp) # 16-byte Spill
514 ; CHECK-SSE-NEXT: pextrw $7, %xmm0, %edi
515 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
516 ; CHECK-SSE-NEXT: callq ldexpf@PLT
517 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
518 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
519 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
520 ; CHECK-SSE-NEXT: pextrw $6, %xmm0, %edi
521 ; CHECK-SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
522 ; CHECK-SSE-NEXT: callq ldexpf@PLT
523 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
524 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
525 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
526 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
527 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
528 ; CHECK-SSE-NEXT: pextrw $5, %xmm0, %edi
529 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
530 ; CHECK-SSE-NEXT: callq ldexpf@PLT
531 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
532 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
533 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
534 ; CHECK-SSE-NEXT: pextrw $4, %xmm0, %edi
535 ; CHECK-SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
536 ; CHECK-SSE-NEXT: callq ldexpf@PLT
537 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
538 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
539 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
540 ; CHECK-SSE-NEXT: punpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
541 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
542 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
543 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
544 ; CHECK-SSE-NEXT: pextrw $3, %xmm0, %edi
545 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
546 ; CHECK-SSE-NEXT: callq ldexpf@PLT
547 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
548 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
549 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
550 ; CHECK-SSE-NEXT: pextrw $2, %xmm0, %edi
551 ; CHECK-SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
552 ; CHECK-SSE-NEXT: callq ldexpf@PLT
553 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
554 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
555 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
556 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
557 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
558 ; CHECK-SSE-NEXT: pextrw $1, %xmm0, %edi
559 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
560 ; CHECK-SSE-NEXT: callq ldexpf@PLT
561 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
562 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
563 ; CHECK-SSE-NEXT: movdqa (%rsp), %xmm0 # 16-byte Reload
564 ; CHECK-SSE-NEXT: movd %xmm0, %eax
565 ; CHECK-SSE-NEXT: movzwl %ax, %edi
566 ; CHECK-SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
567 ; CHECK-SSE-NEXT: callq ldexpf@PLT
568 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
569 ; CHECK-SSE-NEXT: punpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
570 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
571 ; CHECK-SSE-NEXT: punpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
572 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
573 ; CHECK-SSE-NEXT: punpcklqdq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Folded Reload
574 ; CHECK-SSE-NEXT: # xmm0 = xmm0[0],mem[0]
575 ; CHECK-SSE-NEXT: addq $72, %rsp
576 ; CHECK-SSE-NEXT: .cfi_def_cfa_offset 8
577 ; CHECK-SSE-NEXT: retq
579 ; CHECK-AVX2-LABEL: fmul_pow2_ldexp_8xhalf:
580 ; CHECK-AVX2: # %bb.0:
581 ; CHECK-AVX2-NEXT: subq $72, %rsp
582 ; CHECK-AVX2-NEXT: .cfi_def_cfa_offset 80
583 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, (%rsp) # 16-byte Spill
584 ; CHECK-AVX2-NEXT: vpextrw $7, %xmm0, %edi
585 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
586 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
587 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
588 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
589 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
590 ; CHECK-AVX2-NEXT: vpextrw $6, %xmm0, %edi
591 ; CHECK-AVX2-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
592 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
593 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
594 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
595 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
596 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
597 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
598 ; CHECK-AVX2-NEXT: vpextrw $5, %xmm0, %edi
599 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
600 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
601 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
602 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
603 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
604 ; CHECK-AVX2-NEXT: vpextrw $4, %xmm0, %edi
605 ; CHECK-AVX2-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
606 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
607 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
608 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
609 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
610 ; CHECK-AVX2-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
611 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
612 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
613 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
614 ; CHECK-AVX2-NEXT: vpextrw $3, %xmm0, %edi
615 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
616 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
617 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
618 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
619 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
620 ; CHECK-AVX2-NEXT: vpextrw $2, %xmm0, %edi
621 ; CHECK-AVX2-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
622 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
623 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
624 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
625 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
626 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
627 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
628 ; CHECK-AVX2-NEXT: vpextrw $1, %xmm0, %edi
629 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
630 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
631 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
632 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
633 ; CHECK-AVX2-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
634 ; CHECK-AVX2-NEXT: vmovd %xmm0, %eax
635 ; CHECK-AVX2-NEXT: movzwl %ax, %edi
636 ; CHECK-AVX2-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
637 ; CHECK-AVX2-NEXT: callq ldexpf@PLT
638 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
639 ; CHECK-AVX2-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
640 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
641 ; CHECK-AVX2-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
642 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
643 ; CHECK-AVX2-NEXT: vpunpcklqdq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
644 ; CHECK-AVX2-NEXT: # xmm0 = xmm0[0],mem[0]
645 ; CHECK-AVX2-NEXT: addq $72, %rsp
646 ; CHECK-AVX2-NEXT: .cfi_def_cfa_offset 8
647 ; CHECK-AVX2-NEXT: retq
649 ; CHECK-AVX512F-LABEL: fmul_pow2_ldexp_8xhalf:
650 ; CHECK-AVX512F: # %bb.0:
651 ; CHECK-AVX512F-NEXT: subq $72, %rsp
652 ; CHECK-AVX512F-NEXT: .cfi_def_cfa_offset 80
653 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, (%rsp) # 16-byte Spill
654 ; CHECK-AVX512F-NEXT: vpextrw $7, %xmm0, %edi
655 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
656 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
657 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
658 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
659 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
660 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
661 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
662 ; CHECK-AVX512F-NEXT: vpextrw $6, %xmm0, %edi
663 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
664 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
665 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
666 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
667 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
668 ; CHECK-AVX512F-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
669 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
670 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
671 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
672 ; CHECK-AVX512F-NEXT: vpextrw $5, %xmm0, %edi
673 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
674 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
675 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
676 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
677 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
678 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
679 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
680 ; CHECK-AVX512F-NEXT: vpextrw $4, %xmm0, %edi
681 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
682 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
683 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
684 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
685 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
686 ; CHECK-AVX512F-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
687 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
688 ; CHECK-AVX512F-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
689 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
690 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
691 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
692 ; CHECK-AVX512F-NEXT: vpextrw $3, %xmm0, %edi
693 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
694 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
695 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
696 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
697 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
698 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
699 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
700 ; CHECK-AVX512F-NEXT: vpextrw $2, %xmm0, %edi
701 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
702 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
703 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
704 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
705 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
706 ; CHECK-AVX512F-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
707 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
708 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
709 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
710 ; CHECK-AVX512F-NEXT: vpextrw $1, %xmm0, %edi
711 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
712 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
713 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
714 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
715 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
716 ; CHECK-AVX512F-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
717 ; CHECK-AVX512F-NEXT: vmovdqa (%rsp), %xmm0 # 16-byte Reload
718 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
719 ; CHECK-AVX512F-NEXT: movzwl %ax, %edi
720 ; CHECK-AVX512F-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
721 ; CHECK-AVX512F-NEXT: callq ldexpf@PLT
722 ; CHECK-AVX512F-NEXT: vcvtps2ph $4, %xmm0, %xmm0
723 ; CHECK-AVX512F-NEXT: vmovd %xmm0, %eax
724 ; CHECK-AVX512F-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
725 ; CHECK-AVX512F-NEXT: vpunpcklwd {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
726 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1],xmm0[2],mem[2],xmm0[3],mem[3]
727 ; CHECK-AVX512F-NEXT: vpunpckldq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
728 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
729 ; CHECK-AVX512F-NEXT: vpunpcklqdq {{[-0-9]+}}(%r{{[sb]}}p), %xmm0, %xmm0 # 16-byte Folded Reload
730 ; CHECK-AVX512F-NEXT: # xmm0 = xmm0[0],mem[0]
731 ; CHECK-AVX512F-NEXT: addq $72, %rsp
732 ; CHECK-AVX512F-NEXT: .cfi_def_cfa_offset 8
733 ; CHECK-AVX512F-NEXT: retq
734 %r = call <8 x half> @llvm.ldexp.v8f16.v8i16(<8 x half> <half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000>, <8 x i16> %i)
738 define <8 x half> @fdiv_pow2_8xhalf(<8 x i16> %i) {
739 ; CHECK-SSE-LABEL: fdiv_pow2_8xhalf:
740 ; CHECK-SSE: # %bb.0:
741 ; CHECK-SSE-NEXT: psllw $10, %xmm0
742 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm1 = [28672,28672,28672,28672,28672,28672,28672,28672]
743 ; CHECK-SSE-NEXT: psubw %xmm0, %xmm1
744 ; CHECK-SSE-NEXT: movdqa %xmm1, %xmm0
745 ; CHECK-SSE-NEXT: retq
747 ; CHECK-AVX-LABEL: fdiv_pow2_8xhalf:
748 ; CHECK-AVX: # %bb.0:
749 ; CHECK-AVX-NEXT: vpsllw $10, %xmm0, %xmm0
750 ; CHECK-AVX-NEXT: vpbroadcastw {{.*#+}} xmm1 = [28672,28672,28672,28672,28672,28672,28672,28672]
751 ; CHECK-AVX-NEXT: vpsubw %xmm0, %xmm1, %xmm0
752 ; CHECK-AVX-NEXT: retq
753 %p2 = shl <8 x i16> <i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1, i16 1>, %i
754 %p2_f = uitofp <8 x i16> %p2 to <8 x half>
755 %r = fdiv <8 x half> <half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000, half 0xH7000>, %p2_f
759 define double @fmul_pow_shl_cnt(i64 %cnt) nounwind {
760 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt:
761 ; CHECK-SSE: # %bb.0:
762 ; CHECK-SSE-NEXT: shlq $52, %rdi
763 ; CHECK-SSE-NEXT: movabsq $4621256167635550208, %rax # imm = 0x4022000000000000
764 ; CHECK-SSE-NEXT: addq %rdi, %rax
765 ; CHECK-SSE-NEXT: movq %rax, %xmm0
766 ; CHECK-SSE-NEXT: retq
768 ; CHECK-AVX-LABEL: fmul_pow_shl_cnt:
769 ; CHECK-AVX: # %bb.0:
770 ; CHECK-AVX-NEXT: shlq $52, %rdi
771 ; CHECK-AVX-NEXT: movabsq $4621256167635550208, %rax # imm = 0x4022000000000000
772 ; CHECK-AVX-NEXT: addq %rdi, %rax
773 ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
774 ; CHECK-AVX-NEXT: retq
775 %shl = shl nuw i64 1, %cnt
776 %conv = uitofp i64 %shl to double
777 %mul = fmul double 9.000000e+00, %conv
781 define double @fmul_pow_shl_cnt2(i64 %cnt) nounwind {
782 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt2:
783 ; CHECK-SSE: # %bb.0:
784 ; CHECK-SSE-NEXT: incl %edi
785 ; CHECK-SSE-NEXT: shlq $52, %rdi
786 ; CHECK-SSE-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
787 ; CHECK-SSE-NEXT: addq %rdi, %rax
788 ; CHECK-SSE-NEXT: movq %rax, %xmm0
789 ; CHECK-SSE-NEXT: retq
791 ; CHECK-AVX-LABEL: fmul_pow_shl_cnt2:
792 ; CHECK-AVX: # %bb.0:
793 ; CHECK-AVX-NEXT: incl %edi
794 ; CHECK-AVX-NEXT: shlq $52, %rdi
795 ; CHECK-AVX-NEXT: movabsq $-4602115869219225600, %rax # imm = 0xC022000000000000
796 ; CHECK-AVX-NEXT: addq %rdi, %rax
797 ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
798 ; CHECK-AVX-NEXT: retq
799 %shl = shl nuw i64 2, %cnt
800 %conv = uitofp i64 %shl to double
801 %mul = fmul double -9.000000e+00, %conv
805 define float @fmul_pow_select(i32 %cnt, i1 %c) nounwind {
806 ; CHECK-SSE-LABEL: fmul_pow_select:
807 ; CHECK-SSE: # %bb.0:
808 ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
809 ; CHECK-SSE-NEXT: leal 1(%rdi), %eax
810 ; CHECK-SSE-NEXT: testb $1, %sil
811 ; CHECK-SSE-NEXT: cmovnel %edi, %eax
812 ; CHECK-SSE-NEXT: shll $23, %eax
813 ; CHECK-SSE-NEXT: addl $1091567616, %eax # imm = 0x41100000
814 ; CHECK-SSE-NEXT: movd %eax, %xmm0
815 ; CHECK-SSE-NEXT: retq
817 ; CHECK-AVX-LABEL: fmul_pow_select:
818 ; CHECK-AVX: # %bb.0:
819 ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
820 ; CHECK-AVX-NEXT: leal 1(%rdi), %eax
821 ; CHECK-AVX-NEXT: testb $1, %sil
822 ; CHECK-AVX-NEXT: cmovnel %edi, %eax
823 ; CHECK-AVX-NEXT: shll $23, %eax
824 ; CHECK-AVX-NEXT: addl $1091567616, %eax # imm = 0x41100000
825 ; CHECK-AVX-NEXT: vmovd %eax, %xmm0
826 ; CHECK-AVX-NEXT: retq
827 %shl2 = shl nuw i32 2, %cnt
828 %shl1 = shl nuw i32 1, %cnt
829 %shl = select i1 %c, i32 %shl1, i32 %shl2
830 %conv = uitofp i32 %shl to float
831 %mul = fmul float 9.000000e+00, %conv
835 define float @fmul_fly_pow_mul_min_pow2(i64 %cnt) nounwind {
836 ; CHECK-SSE-LABEL: fmul_fly_pow_mul_min_pow2:
837 ; CHECK-SSE: # %bb.0:
838 ; CHECK-SSE-NEXT: addl $3, %edi
839 ; CHECK-SSE-NEXT: cmpl $13, %edi
840 ; CHECK-SSE-NEXT: movl $13, %eax
841 ; CHECK-SSE-NEXT: cmovbl %edi, %eax
842 ; CHECK-SSE-NEXT: shll $23, %eax
843 ; CHECK-SSE-NEXT: addl $1091567616, %eax # imm = 0x41100000
844 ; CHECK-SSE-NEXT: movd %eax, %xmm0
845 ; CHECK-SSE-NEXT: retq
847 ; CHECK-AVX-LABEL: fmul_fly_pow_mul_min_pow2:
848 ; CHECK-AVX: # %bb.0:
849 ; CHECK-AVX-NEXT: addl $3, %edi
850 ; CHECK-AVX-NEXT: cmpl $13, %edi
851 ; CHECK-AVX-NEXT: movl $13, %eax
852 ; CHECK-AVX-NEXT: cmovbl %edi, %eax
853 ; CHECK-AVX-NEXT: shll $23, %eax
854 ; CHECK-AVX-NEXT: addl $1091567616, %eax # imm = 0x41100000
855 ; CHECK-AVX-NEXT: vmovd %eax, %xmm0
856 ; CHECK-AVX-NEXT: retq
857 %shl8 = shl nuw i64 8, %cnt
858 %shl = call i64 @llvm.umin.i64(i64 %shl8, i64 8192)
859 %conv = uitofp i64 %shl to float
860 %mul = fmul float 9.000000e+00, %conv
864 define double @fmul_pow_mul_max_pow2(i16 %cnt) nounwind {
865 ; CHECK-SSE-LABEL: fmul_pow_mul_max_pow2:
866 ; CHECK-SSE: # %bb.0:
867 ; CHECK-SSE-NEXT: movl %edi, %eax
868 ; CHECK-SSE-NEXT: leaq 1(%rax), %rcx
869 ; CHECK-SSE-NEXT: cmpq %rcx, %rax
870 ; CHECK-SSE-NEXT: cmovaq %rax, %rcx
871 ; CHECK-SSE-NEXT: shlq $52, %rcx
872 ; CHECK-SSE-NEXT: movabsq $4613937818241073152, %rax # imm = 0x4008000000000000
873 ; CHECK-SSE-NEXT: addq %rcx, %rax
874 ; CHECK-SSE-NEXT: movq %rax, %xmm0
875 ; CHECK-SSE-NEXT: retq
877 ; CHECK-AVX-LABEL: fmul_pow_mul_max_pow2:
878 ; CHECK-AVX: # %bb.0:
879 ; CHECK-AVX-NEXT: movl %edi, %eax
880 ; CHECK-AVX-NEXT: leaq 1(%rax), %rcx
881 ; CHECK-AVX-NEXT: cmpq %rcx, %rax
882 ; CHECK-AVX-NEXT: cmovaq %rax, %rcx
883 ; CHECK-AVX-NEXT: shlq $52, %rcx
884 ; CHECK-AVX-NEXT: movabsq $4613937818241073152, %rax # imm = 0x4008000000000000
885 ; CHECK-AVX-NEXT: addq %rcx, %rax
886 ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
887 ; CHECK-AVX-NEXT: retq
888 %shl2 = shl nuw i16 2, %cnt
889 %shl1 = shl nuw i16 1, %cnt
890 %shl = call i16 @llvm.umax.i16(i16 %shl1, i16 %shl2)
891 %conv = uitofp i16 %shl to double
892 %mul = fmul double 3.000000e+00, %conv
896 define double @fmul_pow_shl_cnt_fail_maybe_non_pow2(i64 %v, i64 %cnt) nounwind {
897 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_fail_maybe_non_pow2:
898 ; CHECK-SSE: # %bb.0:
899 ; CHECK-SSE-NEXT: movq %rsi, %rcx
900 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
901 ; CHECK-SSE-NEXT: shlq %cl, %rdi
902 ; CHECK-SSE-NEXT: movq %rdi, %xmm1
903 ; CHECK-SSE-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
904 ; CHECK-SSE-NEXT: subpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
905 ; CHECK-SSE-NEXT: movapd %xmm1, %xmm0
906 ; CHECK-SSE-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
907 ; CHECK-SSE-NEXT: addsd %xmm1, %xmm0
908 ; CHECK-SSE-NEXT: mulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
909 ; CHECK-SSE-NEXT: retq
911 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_fail_maybe_non_pow2:
912 ; CHECK-AVX2: # %bb.0:
913 ; CHECK-AVX2-NEXT: movq %rsi, %rcx
914 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
915 ; CHECK-AVX2-NEXT: shlq %cl, %rdi
916 ; CHECK-AVX2-NEXT: vmovq %rdi, %xmm0
917 ; CHECK-AVX2-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
918 ; CHECK-AVX2-NEXT: vsubpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
919 ; CHECK-AVX2-NEXT: vshufpd {{.*#+}} xmm1 = xmm0[1,0]
920 ; CHECK-AVX2-NEXT: vaddsd %xmm0, %xmm1, %xmm0
921 ; CHECK-AVX2-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
922 ; CHECK-AVX2-NEXT: retq
924 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_fail_maybe_non_pow2:
925 ; CHECK-NO-FASTFMA: # %bb.0:
926 ; CHECK-NO-FASTFMA-NEXT: movq %rsi, %rcx
927 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $rcx
928 ; CHECK-NO-FASTFMA-NEXT: shlq %cl, %rdi
929 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2sd %rdi, %xmm0, %xmm0
930 ; CHECK-NO-FASTFMA-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
931 ; CHECK-NO-FASTFMA-NEXT: retq
933 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_fail_maybe_non_pow2:
934 ; CHECK-FMA: # %bb.0:
935 ; CHECK-FMA-NEXT: shlxq %rsi, %rdi, %rax
936 ; CHECK-FMA-NEXT: vcvtusi2sd %rax, %xmm0, %xmm0
937 ; CHECK-FMA-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
938 ; CHECK-FMA-NEXT: retq
939 %shl = shl nuw i64 %v, %cnt
940 %conv = uitofp i64 %shl to double
941 %mul = fmul double 9.000000e+00, %conv
945 define <2 x float> @fmul_pow_shl_cnt_vec_fail_expensive_cast(<2 x i64> %cnt) nounwind {
946 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec_fail_expensive_cast:
947 ; CHECK-SSE: # %bb.0:
948 ; CHECK-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[2,3,2,3]
949 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm3 = [2,2]
950 ; CHECK-SSE-NEXT: movdqa %xmm3, %xmm1
951 ; CHECK-SSE-NEXT: psllq %xmm2, %xmm1
952 ; CHECK-SSE-NEXT: psllq %xmm0, %xmm3
953 ; CHECK-SSE-NEXT: movq %xmm3, %rax
954 ; CHECK-SSE-NEXT: testq %rax, %rax
955 ; CHECK-SSE-NEXT: js .LBB12_1
956 ; CHECK-SSE-NEXT: # %bb.2:
957 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
958 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm0
959 ; CHECK-SSE-NEXT: jmp .LBB12_3
960 ; CHECK-SSE-NEXT: .LBB12_1:
961 ; CHECK-SSE-NEXT: movq %rax, %rcx
962 ; CHECK-SSE-NEXT: shrq %rcx
963 ; CHECK-SSE-NEXT: andl $1, %eax
964 ; CHECK-SSE-NEXT: orq %rcx, %rax
965 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
966 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm0
967 ; CHECK-SSE-NEXT: addss %xmm0, %xmm0
968 ; CHECK-SSE-NEXT: .LBB12_3:
969 ; CHECK-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,2,3]
970 ; CHECK-SSE-NEXT: movq %xmm1, %rax
971 ; CHECK-SSE-NEXT: testq %rax, %rax
972 ; CHECK-SSE-NEXT: js .LBB12_4
973 ; CHECK-SSE-NEXT: # %bb.5:
974 ; CHECK-SSE-NEXT: xorps %xmm1, %xmm1
975 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
976 ; CHECK-SSE-NEXT: jmp .LBB12_6
977 ; CHECK-SSE-NEXT: .LBB12_4:
978 ; CHECK-SSE-NEXT: movq %rax, %rcx
979 ; CHECK-SSE-NEXT: shrq %rcx
980 ; CHECK-SSE-NEXT: andl $1, %eax
981 ; CHECK-SSE-NEXT: orq %rcx, %rax
982 ; CHECK-SSE-NEXT: xorps %xmm1, %xmm1
983 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
984 ; CHECK-SSE-NEXT: addss %xmm1, %xmm1
985 ; CHECK-SSE-NEXT: .LBB12_6:
986 ; CHECK-SSE-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
987 ; CHECK-SSE-NEXT: mulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
988 ; CHECK-SSE-NEXT: retq
990 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_vec_fail_expensive_cast:
991 ; CHECK-AVX2: # %bb.0:
992 ; CHECK-AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [2,2]
993 ; CHECK-AVX2-NEXT: vpsllvq %xmm0, %xmm1, %xmm0
994 ; CHECK-AVX2-NEXT: vpsrlq $1, %xmm0, %xmm1
995 ; CHECK-AVX2-NEXT: vblendvpd %xmm0, %xmm1, %xmm0, %xmm1
996 ; CHECK-AVX2-NEXT: vpextrq $1, %xmm1, %rax
997 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm2, %xmm2
998 ; CHECK-AVX2-NEXT: vmovq %xmm1, %rax
999 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm3, %xmm1
1000 ; CHECK-AVX2-NEXT: vinsertps {{.*#+}} xmm1 = xmm1[0],xmm2[0],zero,zero
1001 ; CHECK-AVX2-NEXT: vaddps %xmm1, %xmm1, %xmm2
1002 ; CHECK-AVX2-NEXT: vpxor %xmm3, %xmm3, %xmm3
1003 ; CHECK-AVX2-NEXT: vpcmpgtq %xmm0, %xmm3, %xmm0
1004 ; CHECK-AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,3,2,3]
1005 ; CHECK-AVX2-NEXT: vblendvps %xmm0, %xmm2, %xmm1, %xmm0
1006 ; CHECK-AVX2-NEXT: vbroadcastss {{.*#+}} xmm1 = [1.5E+1,1.5E+1,1.5E+1,1.5E+1]
1007 ; CHECK-AVX2-NEXT: vmulps %xmm1, %xmm0, %xmm0
1008 ; CHECK-AVX2-NEXT: retq
1010 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_vec_fail_expensive_cast:
1011 ; CHECK-NO-FASTFMA: # %bb.0:
1012 ; CHECK-NO-FASTFMA-NEXT: vpbroadcastq {{.*#+}} xmm1 = [2,2]
1013 ; CHECK-NO-FASTFMA-NEXT: vpsllvq %xmm0, %xmm1, %xmm0
1014 ; CHECK-NO-FASTFMA-NEXT: vpextrq $1, %xmm0, %rax
1015 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2ss %rax, %xmm2, %xmm1
1016 ; CHECK-NO-FASTFMA-NEXT: vmovq %xmm0, %rax
1017 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2ss %rax, %xmm2, %xmm0
1018 ; CHECK-NO-FASTFMA-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0],xmm1[0],zero,zero
1019 ; CHECK-NO-FASTFMA-NEXT: vbroadcastss {{.*#+}} xmm1 = [1.5E+1,1.5E+1,1.5E+1,1.5E+1]
1020 ; CHECK-NO-FASTFMA-NEXT: vmulps %xmm1, %xmm0, %xmm0
1021 ; CHECK-NO-FASTFMA-NEXT: retq
1023 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_vec_fail_expensive_cast:
1024 ; CHECK-FMA: # %bb.0:
1025 ; CHECK-FMA-NEXT: vpbroadcastq {{.*#+}} xmm1 = [2,2]
1026 ; CHECK-FMA-NEXT: vpsllvq %xmm0, %xmm1, %xmm0
1027 ; CHECK-FMA-NEXT: vcvtuqq2ps %xmm0, %xmm0
1028 ; CHECK-FMA-NEXT: vmulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to4}, %xmm0, %xmm0
1029 ; CHECK-FMA-NEXT: retq
1030 %shl = shl nsw nuw <2 x i64> <i64 2, i64 2>, %cnt
1031 %conv = uitofp <2 x i64> %shl to <2 x float>
1032 %mul = fmul <2 x float> <float 15.000000e+00, float 15.000000e+00>, %conv
1033 ret <2 x float> %mul
1036 define <2 x double> @fmul_pow_shl_cnt_vec(<2 x i64> %cnt) nounwind {
1037 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec:
1038 ; CHECK-SSE: # %bb.0:
1039 ; CHECK-SSE-NEXT: psllq $52, %xmm0
1040 ; CHECK-SSE-NEXT: paddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1041 ; CHECK-SSE-NEXT: retq
1043 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_vec:
1044 ; CHECK-AVX2: # %bb.0:
1045 ; CHECK-AVX2-NEXT: vpsllq $52, %xmm0, %xmm0
1046 ; CHECK-AVX2-NEXT: vpaddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1047 ; CHECK-AVX2-NEXT: retq
1049 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_vec:
1050 ; CHECK-NO-FASTFMA: # %bb.0:
1051 ; CHECK-NO-FASTFMA-NEXT: vpsllq $52, %xmm0, %xmm0
1052 ; CHECK-NO-FASTFMA-NEXT: vpaddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1053 ; CHECK-NO-FASTFMA-NEXT: retq
1055 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_vec:
1056 ; CHECK-FMA: # %bb.0:
1057 ; CHECK-FMA-NEXT: vpsllq $52, %xmm0, %xmm0
1058 ; CHECK-FMA-NEXT: vpaddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to2}, %xmm0, %xmm0
1059 ; CHECK-FMA-NEXT: retq
1060 %shl = shl nsw nuw <2 x i64> <i64 2, i64 2>, %cnt
1061 %conv = uitofp <2 x i64> %shl to <2 x double>
1062 %mul = fmul <2 x double> <double 15.000000e+00, double 15.000000e+00>, %conv
1063 ret <2 x double> %mul
1066 define <4 x float> @fmul_pow_shl_cnt_vec_preserve_fma(<4 x i32> %cnt, <4 x float> %add) nounwind {
1067 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec_preserve_fma:
1068 ; CHECK-SSE: # %bb.0:
1069 ; CHECK-SSE-NEXT: pslld $23, %xmm0
1070 ; CHECK-SSE-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1071 ; CHECK-SSE-NEXT: addps %xmm1, %xmm0
1072 ; CHECK-SSE-NEXT: retq
1074 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_vec_preserve_fma:
1075 ; CHECK-AVX2: # %bb.0:
1076 ; CHECK-AVX2-NEXT: vpslld $23, %xmm0, %xmm0
1077 ; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm2 = [1092616192,1092616192,1092616192,1092616192]
1078 ; CHECK-AVX2-NEXT: vpaddd %xmm2, %xmm0, %xmm0
1079 ; CHECK-AVX2-NEXT: vaddps %xmm1, %xmm0, %xmm0
1080 ; CHECK-AVX2-NEXT: retq
1082 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_vec_preserve_fma:
1083 ; CHECK-NO-FASTFMA: # %bb.0:
1084 ; CHECK-NO-FASTFMA-NEXT: vpslld $23, %xmm0, %xmm0
1085 ; CHECK-NO-FASTFMA-NEXT: vpbroadcastd {{.*#+}} xmm2 = [1092616192,1092616192,1092616192,1092616192]
1086 ; CHECK-NO-FASTFMA-NEXT: vpaddd %xmm2, %xmm0, %xmm0
1087 ; CHECK-NO-FASTFMA-NEXT: vaddps %xmm1, %xmm0, %xmm0
1088 ; CHECK-NO-FASTFMA-NEXT: retq
1090 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_vec_preserve_fma:
1091 ; CHECK-FMA: # %bb.0:
1092 ; CHECK-FMA-NEXT: vpbroadcastd {{.*#+}} xmm2 = [2,2,2,2]
1093 ; CHECK-FMA-NEXT: vpsllvd %xmm0, %xmm2, %xmm0
1094 ; CHECK-FMA-NEXT: vcvtudq2ps %xmm0, %xmm0
1095 ; CHECK-FMA-NEXT: vfmadd132ps {{.*#+}} xmm0 = (xmm0 * mem) + xmm1
1096 ; CHECK-FMA-NEXT: retq
1097 %shl = shl nsw nuw <4 x i32> <i32 2, i32 2, i32 2, i32 2>, %cnt
1098 %conv = uitofp <4 x i32> %shl to <4 x float>
1099 %mul = fmul <4 x float> <float 5.000000e+00, float 5.000000e+00, float 5.000000e+00, float 5.000000e+00>, %conv
1100 %res = fadd <4 x float> %mul, %add
1101 ret <4 x float> %res
1104 define <2 x double> @fmul_pow_shl_cnt_vec_non_splat_todo(<2 x i64> %cnt) nounwind {
1105 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec_non_splat_todo:
1106 ; CHECK-SSE: # %bb.0:
1107 ; CHECK-SSE-NEXT: psllq $52, %xmm0
1108 ; CHECK-SSE-NEXT: paddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1109 ; CHECK-SSE-NEXT: retq
1111 ; CHECK-AVX-LABEL: fmul_pow_shl_cnt_vec_non_splat_todo:
1112 ; CHECK-AVX: # %bb.0:
1113 ; CHECK-AVX-NEXT: vpsllq $52, %xmm0, %xmm0
1114 ; CHECK-AVX-NEXT: vpaddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1115 ; CHECK-AVX-NEXT: retq
1116 %shl = shl nsw nuw <2 x i64> <i64 2, i64 2>, %cnt
1117 %conv = uitofp <2 x i64> %shl to <2 x double>
1118 %mul = fmul <2 x double> <double 15.000000e+00, double 14.000000e+00>, %conv
1119 ret <2 x double> %mul
1122 define <2 x double> @fmul_pow_shl_cnt_vec_non_splat2_todo(<2 x i64> %cnt) nounwind {
1123 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec_non_splat2_todo:
1124 ; CHECK-SSE: # %bb.0:
1125 ; CHECK-SSE-NEXT: psllq $52, %xmm0
1126 ; CHECK-SSE-NEXT: paddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1127 ; CHECK-SSE-NEXT: retq
1129 ; CHECK-AVX-LABEL: fmul_pow_shl_cnt_vec_non_splat2_todo:
1130 ; CHECK-AVX: # %bb.0:
1131 ; CHECK-AVX-NEXT: vpsllq $52, %xmm0, %xmm0
1132 ; CHECK-AVX-NEXT: vpaddq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1133 ; CHECK-AVX-NEXT: retq
1134 %shl = shl nsw nuw <2 x i64> <i64 2, i64 1>, %cnt
1135 %conv = uitofp <2 x i64> %shl to <2 x double>
1136 %mul = fmul <2 x double> <double 15.000000e+00, double 15.000000e+00>, %conv
1137 ret <2 x double> %mul
1140 define <2 x half> @fmul_pow_shl_cnt_vec_fail_to_large(<2 x i16> %cnt) nounwind {
1141 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_vec_fail_to_large:
1142 ; CHECK-SSE: # %bb.0:
1143 ; CHECK-SSE-NEXT: subq $40, %rsp
1144 ; CHECK-SSE-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3]
1145 ; CHECK-SSE-NEXT: pslld $23, %xmm0
1146 ; CHECK-SSE-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1147 ; CHECK-SSE-NEXT: cvttps2dq %xmm0, %xmm0
1148 ; CHECK-SSE-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,2,2,3,4,5,6,7]
1149 ; CHECK-SSE-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1150 ; CHECK-SSE-NEXT: movdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
1151 ; CHECK-SSE-NEXT: pextrw $1, %xmm0, %eax
1152 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
1153 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
1154 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1155 ; CHECK-SSE-NEXT: movss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
1156 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
1157 ; CHECK-SSE-NEXT: pextrw $0, %xmm0, %eax
1158 ; CHECK-SSE-NEXT: xorps %xmm0, %xmm0
1159 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
1160 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1161 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
1162 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1163 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1164 ; CHECK-SSE-NEXT: movaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
1165 ; CHECK-SSE-NEXT: movss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
1166 ; CHECK-SSE-NEXT: # xmm0 = mem[0],zero,zero,zero
1167 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
1168 ; CHECK-SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1169 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1170 ; CHECK-SSE-NEXT: movdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
1171 ; CHECK-SSE-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
1172 ; CHECK-SSE-NEXT: movdqa %xmm1, %xmm0
1173 ; CHECK-SSE-NEXT: addq $40, %rsp
1174 ; CHECK-SSE-NEXT: retq
1176 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_vec_fail_to_large:
1177 ; CHECK-AVX2: # %bb.0:
1178 ; CHECK-AVX2-NEXT: subq $40, %rsp
1179 ; CHECK-AVX2-NEXT: vpmovzxwd {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero
1180 ; CHECK-AVX2-NEXT: vpbroadcastd {{.*#+}} xmm1 = [2,2,2,2]
1181 ; CHECK-AVX2-NEXT: vpsllvd %xmm0, %xmm1, %xmm0
1182 ; CHECK-AVX2-NEXT: vmovdqa %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
1183 ; CHECK-AVX2-NEXT: vpextrw $2, %xmm0, %eax
1184 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
1185 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1186 ; CHECK-AVX2-NEXT: vmovss %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 4-byte Spill
1187 ; CHECK-AVX2-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 16-byte Reload
1188 ; CHECK-AVX2-NEXT: vpextrw $0, %xmm0, %eax
1189 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
1190 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1191 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
1192 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1193 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1194 ; CHECK-AVX2-NEXT: vmovaps %xmm0, {{[-0-9]+}}(%r{{[sb]}}p) # 16-byte Spill
1195 ; CHECK-AVX2-NEXT: vmovss {{[-0-9]+}}(%r{{[sb]}}p), %xmm0 # 4-byte Reload
1196 ; CHECK-AVX2-NEXT: # xmm0 = mem[0],zero,zero,zero
1197 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
1198 ; CHECK-AVX2-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1199 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1200 ; CHECK-AVX2-NEXT: vmovdqa {{[-0-9]+}}(%r{{[sb]}}p), %xmm1 # 16-byte Reload
1201 ; CHECK-AVX2-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1],xmm1[2],xmm0[2],xmm1[3],xmm0[3]
1202 ; CHECK-AVX2-NEXT: addq $40, %rsp
1203 ; CHECK-AVX2-NEXT: retq
1205 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_vec_fail_to_large:
1206 ; CHECK-NO-FASTFMA: # %bb.0:
1207 ; CHECK-NO-FASTFMA-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1208 ; CHECK-NO-FASTFMA-NEXT: vmovdqa {{.*#+}} ymm1 = [2,2,0,0,0,0,0,0]
1209 ; CHECK-NO-FASTFMA-NEXT: vpsllvd %ymm0, %ymm1, %ymm0
1210 ; CHECK-NO-FASTFMA-NEXT: vpmovdw %zmm0, %ymm1
1211 ; CHECK-NO-FASTFMA-NEXT: vpextrw $0, %xmm0, %eax
1212 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm0
1213 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1214 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm0, %eax
1215 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1216 ; CHECK-NO-FASTFMA-NEXT: vpextrw $1, %xmm1, %eax
1217 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm1
1218 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm1, %xmm1
1219 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm1, %eax
1220 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm1
1221 ; CHECK-NO-FASTFMA-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
1222 ; CHECK-NO-FASTFMA-NEXT: vmovaps {{.*#+}} xmm1 = [16,0,0,0]
1223 ; CHECK-NO-FASTFMA-NEXT: xorl %eax, %eax
1224 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm2
1225 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
1226 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm2, %eax
1227 ; CHECK-NO-FASTFMA-NEXT: vmovd %eax, %xmm2
1228 ; CHECK-NO-FASTFMA-NEXT: vpbroadcastw %xmm2, %xmm2
1229 ; CHECK-NO-FASTFMA-NEXT: vpermt2ps %zmm0, %zmm1, %zmm2
1230 ; CHECK-NO-FASTFMA-NEXT: vcvtph2ps %xmm2, %ymm0
1231 ; CHECK-NO-FASTFMA-NEXT: vbroadcastss {{.*#+}} ymm1 = [1.5E+1,1.5E+1,1.5E+1,1.5E+1,1.5E+1,1.5E+1,1.5E+1,1.5E+1]
1232 ; CHECK-NO-FASTFMA-NEXT: vmulps %ymm1, %ymm0, %ymm0
1233 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %ymm0, %xmm0
1234 ; CHECK-NO-FASTFMA-NEXT: vzeroupper
1235 ; CHECK-NO-FASTFMA-NEXT: retq
1237 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_vec_fail_to_large:
1238 ; CHECK-FMA: # %bb.0:
1239 ; CHECK-FMA-NEXT: vpbroadcastw {{.*#+}} xmm1 = [2,2,2,2,2,2,2,2]
1240 ; CHECK-FMA-NEXT: vpsllvw %xmm0, %xmm1, %xmm0
1241 ; CHECK-FMA-NEXT: vpextrw $7, %xmm0, %eax
1242 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm1
1243 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm1, %xmm1
1244 ; CHECK-FMA-NEXT: vmovd %xmm1, %eax
1245 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm1
1246 ; CHECK-FMA-NEXT: vpextrw $6, %xmm0, %eax
1247 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm2, %xmm2
1248 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
1249 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
1250 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
1251 ; CHECK-FMA-NEXT: vpextrw $5, %xmm0, %eax
1252 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm3, %xmm3
1253 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm3, %xmm3
1254 ; CHECK-FMA-NEXT: vmovd %xmm3, %eax
1255 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
1256 ; CHECK-FMA-NEXT: vpextrw $4, %xmm0, %eax
1257 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm4, %xmm4
1258 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1],xmm2[2],xmm1[2],xmm2[3],xmm1[3]
1259 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm2
1260 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
1261 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
1262 ; CHECK-FMA-NEXT: vpextrw $3, %xmm0, %eax
1263 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm4
1264 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm4
1265 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
1266 ; CHECK-FMA-NEXT: vmovd %xmm4, %eax
1267 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
1268 ; CHECK-FMA-NEXT: vpextrw $2, %xmm0, %eax
1269 ; CHECK-FMA-NEXT: vpunpckldq {{.*#+}} xmm1 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
1270 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm2
1271 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm2, %xmm2
1272 ; CHECK-FMA-NEXT: vmovd %xmm2, %eax
1273 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm2
1274 ; CHECK-FMA-NEXT: vpextrw $1, %xmm0, %eax
1275 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm4
1276 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm2 = xmm2[0],xmm3[0],xmm2[1],xmm3[1],xmm2[2],xmm3[2],xmm2[3],xmm3[3]
1277 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm4, %xmm3
1278 ; CHECK-FMA-NEXT: vmovd %xmm3, %eax
1279 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm3
1280 ; CHECK-FMA-NEXT: vpextrw $0, %xmm0, %eax
1281 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm5, %xmm0
1282 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1283 ; CHECK-FMA-NEXT: vmovd %xmm0, %eax
1284 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1285 ; CHECK-FMA-NEXT: vpunpcklwd {{.*#+}} xmm0 = xmm0[0],xmm3[0],xmm0[1],xmm3[1],xmm0[2],xmm3[2],xmm0[3],xmm3[3]
1286 ; CHECK-FMA-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
1287 ; CHECK-FMA-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1288 ; CHECK-FMA-NEXT: vcvtph2ps %xmm0, %ymm0
1289 ; CHECK-FMA-NEXT: vmulps {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to8}, %ymm0, %ymm0
1290 ; CHECK-FMA-NEXT: vcvtps2ph $4, %ymm0, %xmm0
1291 ; CHECK-FMA-NEXT: vzeroupper
1292 ; CHECK-FMA-NEXT: retq
1293 %shl = shl nsw nuw <2 x i16> <i16 2, i16 2>, %cnt
1294 %conv = uitofp <2 x i16> %shl to <2 x half>
1295 %mul = fmul <2 x half> <half 15.000000e+00, half 15.000000e+00>, %conv
1299 define double @fmul_pow_shl_cnt_fail_maybe_bad_exp(i64 %cnt) nounwind {
1300 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_fail_maybe_bad_exp:
1301 ; CHECK-SSE: # %bb.0:
1302 ; CHECK-SSE-NEXT: movq %rdi, %rcx
1303 ; CHECK-SSE-NEXT: movl $1, %eax
1304 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
1305 ; CHECK-SSE-NEXT: shlq %cl, %rax
1306 ; CHECK-SSE-NEXT: movq %rax, %xmm1
1307 ; CHECK-SSE-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
1308 ; CHECK-SSE-NEXT: subpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1309 ; CHECK-SSE-NEXT: movapd %xmm1, %xmm0
1310 ; CHECK-SSE-NEXT: unpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1311 ; CHECK-SSE-NEXT: addsd %xmm1, %xmm0
1312 ; CHECK-SSE-NEXT: mulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1313 ; CHECK-SSE-NEXT: retq
1315 ; CHECK-AVX2-LABEL: fmul_pow_shl_cnt_fail_maybe_bad_exp:
1316 ; CHECK-AVX2: # %bb.0:
1317 ; CHECK-AVX2-NEXT: movq %rdi, %rcx
1318 ; CHECK-AVX2-NEXT: movl $1, %eax
1319 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
1320 ; CHECK-AVX2-NEXT: shlq %cl, %rax
1321 ; CHECK-AVX2-NEXT: vmovq %rax, %xmm0
1322 ; CHECK-AVX2-NEXT: vpunpckldq {{.*#+}} xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
1323 ; CHECK-AVX2-NEXT: vsubpd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1324 ; CHECK-AVX2-NEXT: vshufpd {{.*#+}} xmm1 = xmm0[1,0]
1325 ; CHECK-AVX2-NEXT: vaddsd %xmm0, %xmm1, %xmm0
1326 ; CHECK-AVX2-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1327 ; CHECK-AVX2-NEXT: retq
1329 ; CHECK-NO-FASTFMA-LABEL: fmul_pow_shl_cnt_fail_maybe_bad_exp:
1330 ; CHECK-NO-FASTFMA: # %bb.0:
1331 ; CHECK-NO-FASTFMA-NEXT: movq %rdi, %rcx
1332 ; CHECK-NO-FASTFMA-NEXT: movl $1, %eax
1333 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $rcx
1334 ; CHECK-NO-FASTFMA-NEXT: shlq %cl, %rax
1335 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2sd %rax, %xmm0, %xmm0
1336 ; CHECK-NO-FASTFMA-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1337 ; CHECK-NO-FASTFMA-NEXT: retq
1339 ; CHECK-FMA-LABEL: fmul_pow_shl_cnt_fail_maybe_bad_exp:
1340 ; CHECK-FMA: # %bb.0:
1341 ; CHECK-FMA-NEXT: movl $1, %eax
1342 ; CHECK-FMA-NEXT: shlxq %rdi, %rax, %rax
1343 ; CHECK-FMA-NEXT: vcvtusi2sd %rax, %xmm0, %xmm0
1344 ; CHECK-FMA-NEXT: vmulsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
1345 ; CHECK-FMA-NEXT: retq
1346 %shl = shl nuw i64 1, %cnt
1347 %conv = uitofp i64 %shl to double
1348 %mul = fmul double 9.745314e+288, %conv
1352 define double @fmul_pow_shl_cnt_safe(i16 %cnt) nounwind {
1353 ; CHECK-SSE-LABEL: fmul_pow_shl_cnt_safe:
1354 ; CHECK-SSE: # %bb.0:
1355 ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
1356 ; CHECK-SSE-NEXT: shlq $52, %rdi
1357 ; CHECK-SSE-NEXT: movabsq $8930638061065157010, %rax # imm = 0x7BEFFFFFFF5F3992
1358 ; CHECK-SSE-NEXT: addq %rdi, %rax
1359 ; CHECK-SSE-NEXT: movq %rax, %xmm0
1360 ; CHECK-SSE-NEXT: retq
1362 ; CHECK-AVX-LABEL: fmul_pow_shl_cnt_safe:
1363 ; CHECK-AVX: # %bb.0:
1364 ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
1365 ; CHECK-AVX-NEXT: shlq $52, %rdi
1366 ; CHECK-AVX-NEXT: movabsq $8930638061065157010, %rax # imm = 0x7BEFFFFFFF5F3992
1367 ; CHECK-AVX-NEXT: addq %rdi, %rax
1368 ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
1369 ; CHECK-AVX-NEXT: retq
1370 %shl = shl nuw i16 1, %cnt
1371 %conv = uitofp i16 %shl to double
1372 %mul = fmul double 9.745314e+288, %conv
1376 define <2 x double> @fdiv_pow_shl_cnt_vec(<2 x i64> %cnt) nounwind {
1377 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_vec:
1378 ; CHECK-SSE: # %bb.0:
1379 ; CHECK-SSE-NEXT: psllq $52, %xmm0
1380 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm1 = [4607182418800017408,4607182418800017408]
1381 ; CHECK-SSE-NEXT: psubq %xmm0, %xmm1
1382 ; CHECK-SSE-NEXT: movdqa %xmm1, %xmm0
1383 ; CHECK-SSE-NEXT: retq
1385 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt_vec:
1386 ; CHECK-AVX: # %bb.0:
1387 ; CHECK-AVX-NEXT: vpsllq $52, %xmm0, %xmm0
1388 ; CHECK-AVX-NEXT: vpbroadcastq {{.*#+}} xmm1 = [4607182418800017408,4607182418800017408]
1389 ; CHECK-AVX-NEXT: vpsubq %xmm0, %xmm1, %xmm0
1390 ; CHECK-AVX-NEXT: retq
1391 %shl = shl nuw <2 x i64> <i64 1, i64 1>, %cnt
1392 %conv = uitofp <2 x i64> %shl to <2 x double>
1393 %mul = fdiv <2 x double> <double 1.000000e+00, double 1.000000e+00>, %conv
1394 ret <2 x double> %mul
1397 define <2 x float> @fdiv_pow_shl_cnt_vec_with_expensive_cast(<2 x i64> %cnt) nounwind {
1398 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_vec_with_expensive_cast:
1399 ; CHECK-SSE: # %bb.0:
1400 ; CHECK-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,2,2,3]
1401 ; CHECK-SSE-NEXT: pslld $23, %xmm1
1402 ; CHECK-SSE-NEXT: movdqa {{.*#+}} xmm0 = <1065353216,1065353216,u,u>
1403 ; CHECK-SSE-NEXT: psubd %xmm1, %xmm0
1404 ; CHECK-SSE-NEXT: retq
1406 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt_vec_with_expensive_cast:
1407 ; CHECK-AVX: # %bb.0:
1408 ; CHECK-AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1409 ; CHECK-AVX-NEXT: vpslld $23, %xmm0, %xmm0
1410 ; CHECK-AVX-NEXT: vpbroadcastd {{.*#+}} xmm1 = [1065353216,1065353216,1065353216,1065353216]
1411 ; CHECK-AVX-NEXT: vpsubd %xmm0, %xmm1, %xmm0
1412 ; CHECK-AVX-NEXT: retq
1413 %shl = shl nuw <2 x i64> <i64 1, i64 1>, %cnt
1414 %conv = uitofp <2 x i64> %shl to <2 x float>
1415 %mul = fdiv <2 x float> <float 1.000000e+00, float 1.000000e+00>, %conv
1416 ret <2 x float> %mul
1419 define float @fdiv_pow_shl_cnt_fail_maybe_z(i64 %cnt) nounwind {
1420 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_fail_maybe_z:
1421 ; CHECK-SSE: # %bb.0:
1422 ; CHECK-SSE-NEXT: movq %rdi, %rcx
1423 ; CHECK-SSE-NEXT: movl $8, %eax
1424 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
1425 ; CHECK-SSE-NEXT: shlq %cl, %rax
1426 ; CHECK-SSE-NEXT: testq %rax, %rax
1427 ; CHECK-SSE-NEXT: js .LBB22_1
1428 ; CHECK-SSE-NEXT: # %bb.2:
1429 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1430 ; CHECK-SSE-NEXT: jmp .LBB22_3
1431 ; CHECK-SSE-NEXT: .LBB22_1:
1432 ; CHECK-SSE-NEXT: shrq %rax
1433 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1434 ; CHECK-SSE-NEXT: addss %xmm1, %xmm1
1435 ; CHECK-SSE-NEXT: .LBB22_3:
1436 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1437 ; CHECK-SSE-NEXT: divss %xmm1, %xmm0
1438 ; CHECK-SSE-NEXT: retq
1440 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt_fail_maybe_z:
1441 ; CHECK-AVX2: # %bb.0:
1442 ; CHECK-AVX2-NEXT: movq %rdi, %rcx
1443 ; CHECK-AVX2-NEXT: movl $8, %eax
1444 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
1445 ; CHECK-AVX2-NEXT: shlq %cl, %rax
1446 ; CHECK-AVX2-NEXT: testq %rax, %rax
1447 ; CHECK-AVX2-NEXT: js .LBB22_1
1448 ; CHECK-AVX2-NEXT: # %bb.2:
1449 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1450 ; CHECK-AVX2-NEXT: jmp .LBB22_3
1451 ; CHECK-AVX2-NEXT: .LBB22_1:
1452 ; CHECK-AVX2-NEXT: shrq %rax
1453 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1454 ; CHECK-AVX2-NEXT: vaddss %xmm0, %xmm0, %xmm0
1455 ; CHECK-AVX2-NEXT: .LBB22_3:
1456 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1457 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1458 ; CHECK-AVX2-NEXT: retq
1460 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt_fail_maybe_z:
1461 ; CHECK-NO-FASTFMA: # %bb.0:
1462 ; CHECK-NO-FASTFMA-NEXT: movq %rdi, %rcx
1463 ; CHECK-NO-FASTFMA-NEXT: movl $8, %eax
1464 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $rcx
1465 ; CHECK-NO-FASTFMA-NEXT: shlq %cl, %rax
1466 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2ss %rax, %xmm0, %xmm0
1467 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1468 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1469 ; CHECK-NO-FASTFMA-NEXT: retq
1471 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt_fail_maybe_z:
1472 ; CHECK-FMA: # %bb.0:
1473 ; CHECK-FMA-NEXT: movl $8, %eax
1474 ; CHECK-FMA-NEXT: shlxq %rdi, %rax, %rax
1475 ; CHECK-FMA-NEXT: vcvtusi2ss %rax, %xmm0, %xmm0
1476 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1477 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1478 ; CHECK-FMA-NEXT: retq
1479 %shl = shl i64 8, %cnt
1480 %conv = uitofp i64 %shl to float
1481 %mul = fdiv float -9.000000e+00, %conv
1485 define float @fdiv_pow_shl_cnt_fail_neg_int(i64 %cnt) nounwind {
1486 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_fail_neg_int:
1487 ; CHECK-SSE: # %bb.0:
1488 ; CHECK-SSE-NEXT: movq %rdi, %rcx
1489 ; CHECK-SSE-NEXT: movl $8, %eax
1490 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
1491 ; CHECK-SSE-NEXT: shlq %cl, %rax
1492 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1493 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1494 ; CHECK-SSE-NEXT: divss %xmm1, %xmm0
1495 ; CHECK-SSE-NEXT: retq
1497 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt_fail_neg_int:
1498 ; CHECK-AVX2: # %bb.0:
1499 ; CHECK-AVX2-NEXT: movq %rdi, %rcx
1500 ; CHECK-AVX2-NEXT: movl $8, %eax
1501 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
1502 ; CHECK-AVX2-NEXT: shlq %cl, %rax
1503 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1504 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1505 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1506 ; CHECK-AVX2-NEXT: retq
1508 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt_fail_neg_int:
1509 ; CHECK-NO-FASTFMA: # %bb.0:
1510 ; CHECK-NO-FASTFMA-NEXT: movq %rdi, %rcx
1511 ; CHECK-NO-FASTFMA-NEXT: movl $8, %eax
1512 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $rcx
1513 ; CHECK-NO-FASTFMA-NEXT: shlq %cl, %rax
1514 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1515 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1516 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1517 ; CHECK-NO-FASTFMA-NEXT: retq
1519 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt_fail_neg_int:
1520 ; CHECK-FMA: # %bb.0:
1521 ; CHECK-FMA-NEXT: movl $8, %eax
1522 ; CHECK-FMA-NEXT: shlxq %rdi, %rax, %rax
1523 ; CHECK-FMA-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1524 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1525 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1526 ; CHECK-FMA-NEXT: retq
1527 %shl = shl i64 8, %cnt
1528 %conv = sitofp i64 %shl to float
1529 %mul = fdiv float -9.000000e+00, %conv
1533 define float @fdiv_pow_shl_cnt(i64 %cnt_in) nounwind {
1534 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt:
1535 ; CHECK-SSE: # %bb.0:
1536 ; CHECK-SSE-NEXT: movq %rdi, %rcx
1537 ; CHECK-SSE-NEXT: andb $31, %cl
1538 ; CHECK-SSE-NEXT: movl $8, %eax
1539 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $rcx
1540 ; CHECK-SSE-NEXT: shlq %cl, %rax
1541 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1542 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1543 ; CHECK-SSE-NEXT: divss %xmm1, %xmm0
1544 ; CHECK-SSE-NEXT: retq
1546 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt:
1547 ; CHECK-AVX2: # %bb.0:
1548 ; CHECK-AVX2-NEXT: movq %rdi, %rcx
1549 ; CHECK-AVX2-NEXT: andb $31, %cl
1550 ; CHECK-AVX2-NEXT: movl $8, %eax
1551 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $rcx
1552 ; CHECK-AVX2-NEXT: shlq %cl, %rax
1553 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1554 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1555 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1556 ; CHECK-AVX2-NEXT: retq
1558 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt:
1559 ; CHECK-NO-FASTFMA: # %bb.0:
1560 ; CHECK-NO-FASTFMA-NEXT: movq %rdi, %rcx
1561 ; CHECK-NO-FASTFMA-NEXT: andb $31, %cl
1562 ; CHECK-NO-FASTFMA-NEXT: movl $8, %eax
1563 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $rcx
1564 ; CHECK-NO-FASTFMA-NEXT: shlq %cl, %rax
1565 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1566 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1567 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1568 ; CHECK-NO-FASTFMA-NEXT: retq
1570 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt:
1571 ; CHECK-FMA: # %bb.0:
1572 ; CHECK-FMA-NEXT: andb $31, %dil
1573 ; CHECK-FMA-NEXT: movl $8, %eax
1574 ; CHECK-FMA-NEXT: shlxq %rdi, %rax, %rax
1575 ; CHECK-FMA-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1576 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1577 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1578 ; CHECK-FMA-NEXT: retq
1579 %cnt = and i64 %cnt_in, 31
1580 %shl = shl i64 8, %cnt
1581 %conv = sitofp i64 %shl to float
1582 %mul = fdiv float -0.500000e+00, %conv
1586 define half @fdiv_pow_shl_cnt_fail_out_of_bounds(i32 %cnt) nounwind {
1587 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_fail_out_of_bounds:
1588 ; CHECK-SSE: # %bb.0:
1589 ; CHECK-SSE-NEXT: pushq %rax
1590 ; CHECK-SSE-NEXT: movl %edi, %ecx
1591 ; CHECK-SSE-NEXT: movl $1, %eax
1592 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $ecx
1593 ; CHECK-SSE-NEXT: shll %cl, %eax
1594 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm0
1595 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1596 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
1597 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1598 ; CHECK-SSE-NEXT: divss %xmm0, %xmm1
1599 ; CHECK-SSE-NEXT: movaps %xmm1, %xmm0
1600 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1601 ; CHECK-SSE-NEXT: popq %rax
1602 ; CHECK-SSE-NEXT: retq
1604 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt_fail_out_of_bounds:
1605 ; CHECK-AVX2: # %bb.0:
1606 ; CHECK-AVX2-NEXT: pushq %rax
1607 ; CHECK-AVX2-NEXT: movl %edi, %ecx
1608 ; CHECK-AVX2-NEXT: movl $1, %eax
1609 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
1610 ; CHECK-AVX2-NEXT: shll %cl, %eax
1611 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1612 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1613 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
1614 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1615 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1616 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1617 ; CHECK-AVX2-NEXT: popq %rax
1618 ; CHECK-AVX2-NEXT: retq
1620 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt_fail_out_of_bounds:
1621 ; CHECK-NO-FASTFMA: # %bb.0:
1622 ; CHECK-NO-FASTFMA-NEXT: movl %edi, %ecx
1623 ; CHECK-NO-FASTFMA-NEXT: movl $1, %eax
1624 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $ecx
1625 ; CHECK-NO-FASTFMA-NEXT: shll %cl, %eax
1626 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2ss %eax, %xmm0, %xmm0
1627 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1628 ; CHECK-NO-FASTFMA-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
1629 ; CHECK-NO-FASTFMA-NEXT: vcvtph2ps %xmm0, %xmm0
1630 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1631 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1632 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1633 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm0, %eax
1634 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1635 ; CHECK-NO-FASTFMA-NEXT: retq
1637 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt_fail_out_of_bounds:
1638 ; CHECK-FMA: # %bb.0:
1639 ; CHECK-FMA-NEXT: movl $1, %eax
1640 ; CHECK-FMA-NEXT: shlxl %edi, %eax, %eax
1641 ; CHECK-FMA-NEXT: vcvtusi2ss %eax, %xmm0, %xmm0
1642 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1643 ; CHECK-FMA-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
1644 ; CHECK-FMA-NEXT: vcvtph2ps %xmm0, %xmm0
1645 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1646 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1647 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1648 ; CHECK-FMA-NEXT: vmovd %xmm0, %eax
1649 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1650 ; CHECK-FMA-NEXT: retq
1651 %shl = shl nuw i32 1, %cnt
1652 %conv = uitofp i32 %shl to half
1653 %mul = fdiv half 0xH7000, %conv
1657 define half @fdiv_pow_shl_cnt_in_bounds(i16 %cnt) nounwind {
1658 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_in_bounds:
1659 ; CHECK-SSE: # %bb.0:
1660 ; CHECK-SSE-NEXT: shll $10, %edi
1661 ; CHECK-SSE-NEXT: movl $28672, %eax # imm = 0x7000
1662 ; CHECK-SSE-NEXT: subl %edi, %eax
1663 ; CHECK-SSE-NEXT: pinsrw $0, %eax, %xmm0
1664 ; CHECK-SSE-NEXT: retq
1666 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt_in_bounds:
1667 ; CHECK-AVX: # %bb.0:
1668 ; CHECK-AVX-NEXT: shll $10, %edi
1669 ; CHECK-AVX-NEXT: movl $28672, %eax # imm = 0x7000
1670 ; CHECK-AVX-NEXT: subl %edi, %eax
1671 ; CHECK-AVX-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1672 ; CHECK-AVX-NEXT: retq
1673 %shl = shl nuw i16 1, %cnt
1674 %conv = uitofp i16 %shl to half
1675 %mul = fdiv half 0xH7000, %conv
1679 define half @fdiv_pow_shl_cnt_in_bounds2(i16 %cnt) nounwind {
1680 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_in_bounds2:
1681 ; CHECK-SSE: # %bb.0:
1682 ; CHECK-SSE-NEXT: shll $10, %edi
1683 ; CHECK-SSE-NEXT: movl $18432, %eax # imm = 0x4800
1684 ; CHECK-SSE-NEXT: subl %edi, %eax
1685 ; CHECK-SSE-NEXT: pinsrw $0, %eax, %xmm0
1686 ; CHECK-SSE-NEXT: retq
1688 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt_in_bounds2:
1689 ; CHECK-AVX: # %bb.0:
1690 ; CHECK-AVX-NEXT: shll $10, %edi
1691 ; CHECK-AVX-NEXT: movl $18432, %eax # imm = 0x4800
1692 ; CHECK-AVX-NEXT: subl %edi, %eax
1693 ; CHECK-AVX-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1694 ; CHECK-AVX-NEXT: retq
1695 %shl = shl nuw i16 1, %cnt
1696 %conv = uitofp i16 %shl to half
1697 %mul = fdiv half 0xH4800, %conv
1701 define half @fdiv_pow_shl_cnt_fail_out_of_bound2(i16 %cnt) nounwind {
1702 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt_fail_out_of_bound2:
1703 ; CHECK-SSE: # %bb.0:
1704 ; CHECK-SSE-NEXT: pushq %rax
1705 ; CHECK-SSE-NEXT: movl %edi, %ecx
1706 ; CHECK-SSE-NEXT: movl $1, %eax
1707 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $ecx
1708 ; CHECK-SSE-NEXT: shll %cl, %eax
1709 ; CHECK-SSE-NEXT: movzwl %ax, %eax
1710 ; CHECK-SSE-NEXT: cvtsi2ss %eax, %xmm0
1711 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1712 ; CHECK-SSE-NEXT: callq __extendhfsf2@PLT
1713 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1714 ; CHECK-SSE-NEXT: divss %xmm0, %xmm1
1715 ; CHECK-SSE-NEXT: movaps %xmm1, %xmm0
1716 ; CHECK-SSE-NEXT: callq __truncsfhf2@PLT
1717 ; CHECK-SSE-NEXT: popq %rax
1718 ; CHECK-SSE-NEXT: retq
1720 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt_fail_out_of_bound2:
1721 ; CHECK-AVX2: # %bb.0:
1722 ; CHECK-AVX2-NEXT: pushq %rax
1723 ; CHECK-AVX2-NEXT: movl %edi, %ecx
1724 ; CHECK-AVX2-NEXT: movl $1, %eax
1725 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
1726 ; CHECK-AVX2-NEXT: shll %cl, %eax
1727 ; CHECK-AVX2-NEXT: movzwl %ax, %eax
1728 ; CHECK-AVX2-NEXT: vcvtsi2ss %eax, %xmm0, %xmm0
1729 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1730 ; CHECK-AVX2-NEXT: callq __extendhfsf2@PLT
1731 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1732 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1733 ; CHECK-AVX2-NEXT: callq __truncsfhf2@PLT
1734 ; CHECK-AVX2-NEXT: popq %rax
1735 ; CHECK-AVX2-NEXT: retq
1737 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt_fail_out_of_bound2:
1738 ; CHECK-NO-FASTFMA: # %bb.0:
1739 ; CHECK-NO-FASTFMA-NEXT: movl %edi, %ecx
1740 ; CHECK-NO-FASTFMA-NEXT: movl $1, %eax
1741 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $ecx
1742 ; CHECK-NO-FASTFMA-NEXT: shll %cl, %eax
1743 ; CHECK-NO-FASTFMA-NEXT: movzwl %ax, %eax
1744 ; CHECK-NO-FASTFMA-NEXT: vcvtsi2ss %eax, %xmm0, %xmm0
1745 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1746 ; CHECK-NO-FASTFMA-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
1747 ; CHECK-NO-FASTFMA-NEXT: vcvtph2ps %xmm0, %xmm0
1748 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1749 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1750 ; CHECK-NO-FASTFMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1751 ; CHECK-NO-FASTFMA-NEXT: vmovd %xmm0, %eax
1752 ; CHECK-NO-FASTFMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1753 ; CHECK-NO-FASTFMA-NEXT: retq
1755 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt_fail_out_of_bound2:
1756 ; CHECK-FMA: # %bb.0:
1757 ; CHECK-FMA-NEXT: movl $1, %eax
1758 ; CHECK-FMA-NEXT: shlxl %edi, %eax, %eax
1759 ; CHECK-FMA-NEXT: movzwl %ax, %eax
1760 ; CHECK-FMA-NEXT: vcvtsi2ss %eax, %xmm0, %xmm0
1761 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1762 ; CHECK-FMA-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
1763 ; CHECK-FMA-NEXT: vcvtph2ps %xmm0, %xmm0
1764 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1765 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1766 ; CHECK-FMA-NEXT: vcvtps2ph $4, %xmm0, %xmm0
1767 ; CHECK-FMA-NEXT: vmovd %xmm0, %eax
1768 ; CHECK-FMA-NEXT: vpinsrw $0, %eax, %xmm0, %xmm0
1769 ; CHECK-FMA-NEXT: retq
1770 %shl = shl nuw i16 1, %cnt
1771 %conv = uitofp i16 %shl to half
1772 %mul = fdiv half 0xH4000, %conv
1776 define double @fdiv_pow_shl_cnt32_to_dbl_okay(i32 %cnt) nounwind {
1777 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt32_to_dbl_okay:
1778 ; CHECK-SSE: # %bb.0:
1779 ; CHECK-SSE-NEXT: # kill: def $edi killed $edi def $rdi
1780 ; CHECK-SSE-NEXT: shlq $52, %rdi
1781 ; CHECK-SSE-NEXT: movabsq $3936146074321813504, %rax # imm = 0x36A0000000000000
1782 ; CHECK-SSE-NEXT: subq %rdi, %rax
1783 ; CHECK-SSE-NEXT: movq %rax, %xmm0
1784 ; CHECK-SSE-NEXT: retq
1786 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt32_to_dbl_okay:
1787 ; CHECK-AVX: # %bb.0:
1788 ; CHECK-AVX-NEXT: # kill: def $edi killed $edi def $rdi
1789 ; CHECK-AVX-NEXT: shlq $52, %rdi
1790 ; CHECK-AVX-NEXT: movabsq $3936146074321813504, %rax # imm = 0x36A0000000000000
1791 ; CHECK-AVX-NEXT: subq %rdi, %rax
1792 ; CHECK-AVX-NEXT: vmovq %rax, %xmm0
1793 ; CHECK-AVX-NEXT: retq
1794 %shl = shl nuw i32 1, %cnt
1795 %conv = uitofp i32 %shl to double
1796 %mul = fdiv double 0x36A0000000000000, %conv
1800 define float @fdiv_pow_shl_cnt32_out_of_bounds2(i32 %cnt) nounwind {
1801 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt32_out_of_bounds2:
1802 ; CHECK-SSE: # %bb.0:
1803 ; CHECK-SSE-NEXT: movl %edi, %ecx
1804 ; CHECK-SSE-NEXT: movl $1, %eax
1805 ; CHECK-SSE-NEXT: # kill: def $cl killed $cl killed $ecx
1806 ; CHECK-SSE-NEXT: shll %cl, %eax
1807 ; CHECK-SSE-NEXT: cvtsi2ss %rax, %xmm1
1808 ; CHECK-SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
1809 ; CHECK-SSE-NEXT: divss %xmm1, %xmm0
1810 ; CHECK-SSE-NEXT: retq
1812 ; CHECK-AVX2-LABEL: fdiv_pow_shl_cnt32_out_of_bounds2:
1813 ; CHECK-AVX2: # %bb.0:
1814 ; CHECK-AVX2-NEXT: movl %edi, %ecx
1815 ; CHECK-AVX2-NEXT: movl $1, %eax
1816 ; CHECK-AVX2-NEXT: # kill: def $cl killed $cl killed $ecx
1817 ; CHECK-AVX2-NEXT: shll %cl, %eax
1818 ; CHECK-AVX2-NEXT: vcvtsi2ss %rax, %xmm0, %xmm0
1819 ; CHECK-AVX2-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1820 ; CHECK-AVX2-NEXT: vdivss %xmm0, %xmm1, %xmm0
1821 ; CHECK-AVX2-NEXT: retq
1823 ; CHECK-NO-FASTFMA-LABEL: fdiv_pow_shl_cnt32_out_of_bounds2:
1824 ; CHECK-NO-FASTFMA: # %bb.0:
1825 ; CHECK-NO-FASTFMA-NEXT: movl %edi, %ecx
1826 ; CHECK-NO-FASTFMA-NEXT: movl $1, %eax
1827 ; CHECK-NO-FASTFMA-NEXT: # kill: def $cl killed $cl killed $ecx
1828 ; CHECK-NO-FASTFMA-NEXT: shll %cl, %eax
1829 ; CHECK-NO-FASTFMA-NEXT: vcvtusi2ss %eax, %xmm0, %xmm0
1830 ; CHECK-NO-FASTFMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1831 ; CHECK-NO-FASTFMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1832 ; CHECK-NO-FASTFMA-NEXT: retq
1834 ; CHECK-FMA-LABEL: fdiv_pow_shl_cnt32_out_of_bounds2:
1835 ; CHECK-FMA: # %bb.0:
1836 ; CHECK-FMA-NEXT: movl $1, %eax
1837 ; CHECK-FMA-NEXT: shlxl %edi, %eax, %eax
1838 ; CHECK-FMA-NEXT: vcvtusi2ss %eax, %xmm0, %xmm0
1839 ; CHECK-FMA-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
1840 ; CHECK-FMA-NEXT: vdivss %xmm0, %xmm1, %xmm0
1841 ; CHECK-FMA-NEXT: retq
1842 %shl = shl nuw i32 1, %cnt
1843 %conv = uitofp i32 %shl to float
1844 %mul = fdiv float 0x3a1fffff00000000, %conv
1848 define float @fdiv_pow_shl_cnt32_okay(i32 %cnt) nounwind {
1849 ; CHECK-SSE-LABEL: fdiv_pow_shl_cnt32_okay:
1850 ; CHECK-SSE: # %bb.0:
1851 ; CHECK-SSE-NEXT: shll $23, %edi
1852 ; CHECK-SSE-NEXT: movl $285212672, %eax # imm = 0x11000000
1853 ; CHECK-SSE-NEXT: subl %edi, %eax
1854 ; CHECK-SSE-NEXT: movd %eax, %xmm0
1855 ; CHECK-SSE-NEXT: retq
1857 ; CHECK-AVX-LABEL: fdiv_pow_shl_cnt32_okay:
1858 ; CHECK-AVX: # %bb.0:
1859 ; CHECK-AVX-NEXT: shll $23, %edi
1860 ; CHECK-AVX-NEXT: movl $285212672, %eax # imm = 0x11000000
1861 ; CHECK-AVX-NEXT: subl %edi, %eax
1862 ; CHECK-AVX-NEXT: vmovd %eax, %xmm0
1863 ; CHECK-AVX-NEXT: retq
1864 %shl = shl nuw i32 1, %cnt
1865 %conv = uitofp i32 %shl to float
1866 %mul = fdiv float 0x3a20000000000000, %conv