llvm.org GIT mirror llvm / a813b38 test / CodeGen / SystemZ / vec-combine-02.ll
a813b38

Tree @a813b38 (Download .tar.gz)

vec-combine-02.ll @a813b38raw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
; Test various representations of pack-like operations.
;
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z13 | FileCheck %s

; One way of writing a <4 x i32> -> <8 x i16> pack.
define <8 x i16> @f1(<4 x i32> %val0, <4 x i32> %val1) {
; CHECK-LABEL: f1:
; CHECK: vpkf %v24, %v24, %v26
; CHECK: br %r14
  %elem0 = extractelement <4 x i32> %val0, i32 0
  %elem1 = extractelement <4 x i32> %val0, i32 1
  %elem2 = extractelement <4 x i32> %val0, i32 2
  %elem3 = extractelement <4 x i32> %val0, i32 3
  %elem4 = extractelement <4 x i32> %val1, i32 0
  %elem5 = extractelement <4 x i32> %val1, i32 1
  %elem6 = extractelement <4 x i32> %val1, i32 2
  %elem7 = extractelement <4 x i32> %val1, i32 3
  %hboth0 = bitcast i32 %elem0 to <2 x i16>
  %hboth1 = bitcast i32 %elem1 to <2 x i16>
  %hboth2 = bitcast i32 %elem2 to <2 x i16>
  %hboth3 = bitcast i32 %elem3 to <2 x i16>
  %hboth4 = bitcast i32 %elem4 to <2 x i16>
  %hboth5 = bitcast i32 %elem5 to <2 x i16>
  %hboth6 = bitcast i32 %elem6 to <2 x i16>
  %hboth7 = bitcast i32 %elem7 to <2 x i16>
  %hlow0 = shufflevector <2 x i16> %hboth0, <2 x i16> %hboth1,
                         <2 x i32> <i32 1, i32 3>
  %hlow1 = shufflevector <2 x i16> %hboth2, <2 x i16> %hboth3,
                         <2 x i32> <i32 1, i32 3>
  %hlow2 = shufflevector <2 x i16> %hboth4, <2 x i16> %hboth5,
                         <2 x i32> <i32 1, i32 3>
  %hlow3 = shufflevector <2 x i16> %hboth6, <2 x i16> %hboth7,
                         <2 x i32> <i32 1, i32 3>
  %join0 = shufflevector <2 x i16> %hlow0, <2 x i16> %hlow1,
                         <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %join1 = shufflevector <2 x i16> %hlow2, <2 x i16> %hlow3,
                         <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  %ret = shufflevector <4 x i16> %join0, <4 x i16> %join1,
                       <8 x i32> <i32 0, i32 1, i32 2, i32 3,
                                  i32 4, i32 5, i32 6, i32 7>
  ret <8 x i16> %ret
}

; A different way of writing a <4 x i32> -> <8 x i16> pack.
define <8 x i16> @f2(<4 x i32> %val0, <4 x i32> %val1) {
; CHECK-LABEL: f2:
; CHECK: vpkf %v24, %v24, %v26
; CHECK: br %r14
  %elem0 = extractelement <4 x i32> %val0, i32 0
  %elem1 = extractelement <4 x i32> %val0, i32 1
  %elem2 = extractelement <4 x i32> %val0, i32 2
  %elem3 = extractelement <4 x i32> %val0, i32 3
  %elem4 = extractelement <4 x i32> %val1, i32 0
  %elem5 = extractelement <4 x i32> %val1, i32 1
  %elem6 = extractelement <4 x i32> %val1, i32 2
  %elem7 = extractelement <4 x i32> %val1, i32 3
  %wvec0 = insertelement <4 x i32> undef, i32 %elem0, i32 0
  %wvec1 = insertelement <4 x i32> undef, i32 %elem1, i32 0
  %wvec2 = insertelement <4 x i32> undef, i32 %elem2, i32 0
  %wvec3 = insertelement <4 x i32> undef, i32 %elem3, i32 0
  %wvec4 = insertelement <4 x i32> undef, i32 %elem4, i32 0
  %wvec5 = insertelement <4 x i32> undef, i32 %elem5, i32 0
  %wvec6 = insertelement <4 x i32> undef, i32 %elem6, i32 0
  %wvec7 = insertelement <4 x i32> undef, i32 %elem7, i32 0
  %hvec0 = bitcast <4 x i32> %wvec0 to <8 x i16>
  %hvec1 = bitcast <4 x i32> %wvec1 to <8 x i16>
  %hvec2 = bitcast <4 x i32> %wvec2 to <8 x i16>
  %hvec3 = bitcast <4 x i32> %wvec3 to <8 x i16>
  %hvec4 = bitcast <4 x i32> %wvec4 to <8 x i16>
  %hvec5 = bitcast <4 x i32> %wvec5 to <8 x i16>
  %hvec6 = bitcast <4 x i32> %wvec6 to <8 x i16>
  %hvec7 = bitcast <4 x i32> %wvec7 to <8 x i16>
  %hlow0 = shufflevector <8 x i16> %hvec0, <8 x i16> %hvec1,
                         <8 x i32> <i32 1, i32 9, i32 undef, i32 undef,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %hlow1 = shufflevector <8 x i16> %hvec2, <8 x i16> %hvec3,
                         <8 x i32> <i32 1, i32 9, i32 undef, i32 undef,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %hlow2 = shufflevector <8 x i16> %hvec4, <8 x i16> %hvec5,
                         <8 x i32> <i32 1, i32 9, i32 undef, i32 undef,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %hlow3 = shufflevector <8 x i16> %hvec6, <8 x i16> %hvec7,
                         <8 x i32> <i32 1, i32 9, i32 undef, i32 undef,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %join0 = shufflevector <8 x i16> %hlow0, <8 x i16> %hlow1,
                         <8 x i32> <i32 0, i32 1, i32 8, i32 9,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %join1 = shufflevector <8 x i16> %hlow2, <8 x i16> %hlow3,
                         <8 x i32> <i32 0, i32 1, i32 8, i32 9,
                                    i32 undef, i32 undef, i32 undef, i32 undef>
  %ret = shufflevector <8 x i16> %join0, <8 x i16> %join1,
                       <8 x i32> <i32 0, i32 1, i32 2, i32 3,
                                  i32 8, i32 9, i32 10, i32 11>
  ret <8 x i16> %ret
}

; A direct pack operation.
define <8 x i16> @f3(<4 x i32> %val0, <4 x i32> %val1) {
; CHECK-LABEL: f3:
; CHECK: vpkf %v24, %v24, %v26
; CHECK: br %r14
  %bitcast0 = bitcast <4 x i32> %val0 to <8 x i16>
  %bitcast1 = bitcast <4 x i32> %val1 to <8 x i16>
  %ret = shufflevector <8 x i16> %bitcast0, <8 x i16> %bitcast1,
                       <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                  i32 9, i32 11, i32 13, i32 15>
  ret <8 x i16> %ret
}

; One way of writing a <4 x i32> -> <16 x i8> pack.  It doesn't matter
; whether the first pack is VPKF or VPKH since the even bytes of the
; result are discarded.
define <16 x i8> @f4(<4 x i32> %val0, <4 x i32> %val1,
                     <4 x i32> %val2, <4 x i32> %val3) {
; CHECK-LABEL: f4:
; CHECK-DAG: vpk{{[hf]}} [[REG1:%v[0-9]+]], %v24, %v26
; CHECK-DAG: vpk{{[hf]}} [[REG2:%v[0-9]+]], %v28, %v30
; CHECK: vpkh %v24, [[REG1]], [[REG2]]
; CHECK: br %r14
  %bitcast0 = bitcast <4 x i32> %val0 to <8 x i16>
  %bitcast1 = bitcast <4 x i32> %val1 to <8 x i16>
  %bitcast2 = bitcast <4 x i32> %val2 to <8 x i16>
  %bitcast3 = bitcast <4 x i32> %val3 to <8 x i16>
  %join0 = shufflevector <8 x i16> %bitcast0, <8 x i16> %bitcast1,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %join1 = shufflevector <8 x i16> %bitcast2, <8 x i16> %bitcast3,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %bitcast4 = bitcast <8 x i16> %join0 to <16 x i8>
  %bitcast5 = bitcast <8 x i16> %join1 to <16 x i8>
  %ret = shufflevector <16 x i8> %bitcast4, <16 x i8> %bitcast5,
                       <16 x i32> <i32 1, i32 3, i32 5, i32 7,
                                   i32 9, i32 11, i32 13, i32 15,
                                   i32 17, i32 19, i32 21, i32 23,
                                   i32 25, i32 27, i32 29, i32 31>
  ret <16 x i8> %ret
}

; Check the same operation, but with elements being extracted from the result.
define void @f5(<4 x i32> %val0, <4 x i32> %val1,
                <4 x i32> %val2, <4 x i32> %val3,
                i8 *%base) {
; CHECK-LABEL: f5:
; CHECK-DAG: vsteb %v24, 0(%r2), 11
; CHECK-DAG: vsteb %v26, 1(%r2), 15
; CHECK-DAG: vsteb %v28, 2(%r2), 3
; CHECK-DAG: vsteb %v30, 3(%r2), 7
; CHECK: br %r14
  %bitcast0 = bitcast <4 x i32> %val0 to <8 x i16>
  %bitcast1 = bitcast <4 x i32> %val1 to <8 x i16>
  %bitcast2 = bitcast <4 x i32> %val2 to <8 x i16>
  %bitcast3 = bitcast <4 x i32> %val3 to <8 x i16>
  %join0 = shufflevector <8 x i16> %bitcast0, <8 x i16> %bitcast1,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %join1 = shufflevector <8 x i16> %bitcast2, <8 x i16> %bitcast3,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %bitcast4 = bitcast <8 x i16> %join0 to <16 x i8>
  %bitcast5 = bitcast <8 x i16> %join1 to <16 x i8>
  %vec = shufflevector <16 x i8> %bitcast4, <16 x i8> %bitcast5,
                       <16 x i32> <i32 1, i32 3, i32 5, i32 7,
                                   i32 9, i32 11, i32 13, i32 15,
                                   i32 17, i32 19, i32 21, i32 23,
                                   i32 25, i32 27, i32 29, i32 31>

  %ptr0 = getelementptr i8, i8 *%base, i64 0
  %ptr1 = getelementptr i8, i8 *%base, i64 1
  %ptr2 = getelementptr i8, i8 *%base, i64 2
  %ptr3 = getelementptr i8, i8 *%base, i64 3

  %byte0 = extractelement <16 x i8> %vec, i32 2
  %byte1 = extractelement <16 x i8> %vec, i32 7
  %byte2 = extractelement <16 x i8> %vec, i32 8
  %byte3 = extractelement <16 x i8> %vec, i32 13

  store i8 %byte0, i8 *%ptr0
  store i8 %byte1, i8 *%ptr1
  store i8 %byte2, i8 *%ptr2
  store i8 %byte3, i8 *%ptr3

  ret void
}

; A different way of writing a <4 x i32> -> <16 x i8> pack.
define <16 x i8> @f6(<4 x i32> %val0, <4 x i32> %val1,
                     <4 x i32> %val2, <4 x i32> %val3) {
; CHECK-LABEL: f6:
; CHECK-DAG: vpk{{[hf]}} [[REG1:%v[0-9]+]], %v24, %v26
; CHECK-DAG: vpk{{[hf]}} [[REG2:%v[0-9]+]], %v28, %v30
; CHECK: vpkh %v24, [[REG1]], [[REG2]]
; CHECK: br %r14
  %elem0 = extractelement <4 x i32> %val0, i32 0
  %elem1 = extractelement <4 x i32> %val0, i32 1
  %elem2 = extractelement <4 x i32> %val0, i32 2
  %elem3 = extractelement <4 x i32> %val0, i32 3
  %elem4 = extractelement <4 x i32> %val1, i32 0
  %elem5 = extractelement <4 x i32> %val1, i32 1
  %elem6 = extractelement <4 x i32> %val1, i32 2
  %elem7 = extractelement <4 x i32> %val1, i32 3
  %elem8 = extractelement <4 x i32> %val2, i32 0
  %elem9 = extractelement <4 x i32> %val2, i32 1
  %elem10 = extractelement <4 x i32> %val2, i32 2
  %elem11 = extractelement <4 x i32> %val2, i32 3
  %elem12 = extractelement <4 x i32> %val3, i32 0
  %elem13 = extractelement <4 x i32> %val3, i32 1
  %elem14 = extractelement <4 x i32> %val3, i32 2
  %elem15 = extractelement <4 x i32> %val3, i32 3
  %bitcast0 = bitcast i32 %elem0 to <2 x i16>
  %bitcast1 = bitcast i32 %elem1 to <2 x i16>
  %bitcast2 = bitcast i32 %elem2 to <2 x i16>
  %bitcast3 = bitcast i32 %elem3 to <2 x i16>
  %bitcast4 = bitcast i32 %elem4 to <2 x i16>
  %bitcast5 = bitcast i32 %elem5 to <2 x i16>
  %bitcast6 = bitcast i32 %elem6 to <2 x i16>
  %bitcast7 = bitcast i32 %elem7 to <2 x i16>
  %bitcast8 = bitcast i32 %elem8 to <2 x i16>
  %bitcast9 = bitcast i32 %elem9 to <2 x i16>
  %bitcast10 = bitcast i32 %elem10 to <2 x i16>
  %bitcast11 = bitcast i32 %elem11 to <2 x i16>
  %bitcast12 = bitcast i32 %elem12 to <2 x i16>
  %bitcast13 = bitcast i32 %elem13 to <2 x i16>
  %bitcast14 = bitcast i32 %elem14 to <2 x i16>
  %bitcast15 = bitcast i32 %elem15 to <2 x i16>
  %low0 = shufflevector <2 x i16> %bitcast0, <2 x i16> %bitcast1,
                        <2 x i32> <i32 1, i32 3>
  %low1 = shufflevector <2 x i16> %bitcast2, <2 x i16> %bitcast3,
                        <2 x i32> <i32 1, i32 3>
  %low2 = shufflevector <2 x i16> %bitcast4, <2 x i16> %bitcast5,
                        <2 x i32> <i32 1, i32 3>
  %low3 = shufflevector <2 x i16> %bitcast6, <2 x i16> %bitcast7,
                        <2 x i32> <i32 1, i32 3>
  %low4 = shufflevector <2 x i16> %bitcast8, <2 x i16> %bitcast9,
                        <2 x i32> <i32 1, i32 3>
  %low5 = shufflevector <2 x i16> %bitcast10, <2 x i16> %bitcast11,
                        <2 x i32> <i32 1, i32 3>
  %low6 = shufflevector <2 x i16> %bitcast12, <2 x i16> %bitcast13,
                        <2 x i32> <i32 1, i32 3>
  %low7 = shufflevector <2 x i16> %bitcast14, <2 x i16> %bitcast15,
                        <2 x i32> <i32 1, i32 3>
  %bytes0 = bitcast <2 x i16> %low0 to <4 x i8>
  %bytes1 = bitcast <2 x i16> %low1 to <4 x i8>
  %bytes2 = bitcast <2 x i16> %low2 to <4 x i8>
  %bytes3 = bitcast <2 x i16> %low3 to <4 x i8>
  %bytes4 = bitcast <2 x i16> %low4 to <4 x i8>
  %bytes5 = bitcast <2 x i16> %low5 to <4 x i8>
  %bytes6 = bitcast <2 x i16> %low6 to <4 x i8>
  %bytes7 = bitcast <2 x i16> %low7 to <4 x i8>
  %blow0 = shufflevector <4 x i8> %bytes0, <4 x i8> %bytes1,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %blow1 = shufflevector <4 x i8> %bytes2, <4 x i8> %bytes3,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %blow2 = shufflevector <4 x i8> %bytes4, <4 x i8> %bytes5,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %blow3 = shufflevector <4 x i8> %bytes6, <4 x i8> %bytes7,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %join0 = shufflevector <4 x i8> %blow0, <4 x i8> %blow1,
                         <8 x i32> <i32 0, i32 1, i32 2, i32 3,
                                    i32 4, i32 5, i32 6, i32 7>
  %join1 = shufflevector <4 x i8> %blow2, <4 x i8> %blow3,
                         <8 x i32> <i32 0, i32 1, i32 2, i32 3,
                                    i32 4, i32 5, i32 6, i32 7>
  %ret = shufflevector <8 x i8> %join0, <8 x i8> %join1,
                       <16 x i32> <i32 0, i32 1, i32 2, i32 3,
                                   i32 4, i32 5, i32 6, i32 7,
                                   i32 8, i32 9, i32 10, i32 11,
                                   i32 12, i32 13, i32 14, i32 15>
  ret <16 x i8> %ret
}

; One way of writing a <2 x i64> -> <16 x i8> pack.
define <16 x i8> @f7(<2 x i64> %val0, <2 x i64> %val1,
                     <2 x i64> %val2, <2 x i64> %val3,
                     <2 x i64> %val4, <2 x i64> %val5,
                     <2 x i64> %val6, <2 x i64> %val7) {
; CHECK-LABEL: f7:
; CHECK-DAG: vpk{{[hfg]}} [[REG1:%v[0-9]+]], %v24, %v26
; CHECK-DAG: vpk{{[hfg]}} [[REG2:%v[0-9]+]], %v28, %v30
; CHECK-DAG: vpk{{[hfg]}} [[REG3:%v[0-9]+]], %v25, %v27
; CHECK-DAG: vpk{{[hfg]}} [[REG4:%v[0-9]+]], %v29, %v31
; CHECK-DAG: vpk{{[hf]}} [[REG5:%v[0-9]+]], [[REG1]], [[REG2]]
; CHECK-DAG: vpk{{[hf]}} [[REG6:%v[0-9]+]], [[REG3]], [[REG4]]
; CHECK: vpkh %v24, [[REG5]], [[REG6]]
; CHECK: br %r14
  %elem0 = extractelement <2 x i64> %val0, i32 0
  %elem1 = extractelement <2 x i64> %val0, i32 1
  %elem2 = extractelement <2 x i64> %val1, i32 0
  %elem3 = extractelement <2 x i64> %val1, i32 1
  %elem4 = extractelement <2 x i64> %val2, i32 0
  %elem5 = extractelement <2 x i64> %val2, i32 1
  %elem6 = extractelement <2 x i64> %val3, i32 0
  %elem7 = extractelement <2 x i64> %val3, i32 1
  %elem8 = extractelement <2 x i64> %val4, i32 0
  %elem9 = extractelement <2 x i64> %val4, i32 1
  %elem10 = extractelement <2 x i64> %val5, i32 0
  %elem11 = extractelement <2 x i64> %val5, i32 1
  %elem12 = extractelement <2 x i64> %val6, i32 0
  %elem13 = extractelement <2 x i64> %val6, i32 1
  %elem14 = extractelement <2 x i64> %val7, i32 0
  %elem15 = extractelement <2 x i64> %val7, i32 1
  %bitcast0 = bitcast i64 %elem0 to <2 x i32>
  %bitcast1 = bitcast i64 %elem1 to <2 x i32>
  %bitcast2 = bitcast i64 %elem2 to <2 x i32>
  %bitcast3 = bitcast i64 %elem3 to <2 x i32>
  %bitcast4 = bitcast i64 %elem4 to <2 x i32>
  %bitcast5 = bitcast i64 %elem5 to <2 x i32>
  %bitcast6 = bitcast i64 %elem6 to <2 x i32>
  %bitcast7 = bitcast i64 %elem7 to <2 x i32>
  %bitcast8 = bitcast i64 %elem8 to <2 x i32>
  %bitcast9 = bitcast i64 %elem9 to <2 x i32>
  %bitcast10 = bitcast i64 %elem10 to <2 x i32>
  %bitcast11 = bitcast i64 %elem11 to <2 x i32>
  %bitcast12 = bitcast i64 %elem12 to <2 x i32>
  %bitcast13 = bitcast i64 %elem13 to <2 x i32>
  %bitcast14 = bitcast i64 %elem14 to <2 x i32>
  %bitcast15 = bitcast i64 %elem15 to <2 x i32>
  %low0 = shufflevector <2 x i32> %bitcast0, <2 x i32> %bitcast1,
                        <2 x i32> <i32 1, i32 3>
  %low1 = shufflevector <2 x i32> %bitcast2, <2 x i32> %bitcast3,
                        <2 x i32> <i32 1, i32 3>
  %low2 = shufflevector <2 x i32> %bitcast4, <2 x i32> %bitcast5,
                        <2 x i32> <i32 1, i32 3>
  %low3 = shufflevector <2 x i32> %bitcast6, <2 x i32> %bitcast7,
                        <2 x i32> <i32 1, i32 3>
  %low4 = shufflevector <2 x i32> %bitcast8, <2 x i32> %bitcast9,
                        <2 x i32> <i32 1, i32 3>
  %low5 = shufflevector <2 x i32> %bitcast10, <2 x i32> %bitcast11,
                        <2 x i32> <i32 1, i32 3>
  %low6 = shufflevector <2 x i32> %bitcast12, <2 x i32> %bitcast13,
                        <2 x i32> <i32 1, i32 3>
  %low7 = shufflevector <2 x i32> %bitcast14, <2 x i32> %bitcast15,
                        <2 x i32> <i32 1, i32 3>
  %half0 = bitcast <2 x i32> %low0 to <4 x i16>
  %half1 = bitcast <2 x i32> %low1 to <4 x i16>
  %half2 = bitcast <2 x i32> %low2 to <4 x i16>
  %half3 = bitcast <2 x i32> %low3 to <4 x i16>
  %half4 = bitcast <2 x i32> %low4 to <4 x i16>
  %half5 = bitcast <2 x i32> %low5 to <4 x i16>
  %half6 = bitcast <2 x i32> %low6 to <4 x i16>
  %half7 = bitcast <2 x i32> %low7 to <4 x i16>
  %hlow0 = shufflevector <4 x i16> %half0, <4 x i16> %half1,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %hlow1 = shufflevector <4 x i16> %half2, <4 x i16> %half3,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %hlow2 = shufflevector <4 x i16> %half4, <4 x i16> %half5,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %hlow3 = shufflevector <4 x i16> %half6, <4 x i16> %half7,
                         <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %bytes0 = bitcast <4 x i16> %hlow0 to <8 x i8>
  %bytes1 = bitcast <4 x i16> %hlow1 to <8 x i8>
  %bytes2 = bitcast <4 x i16> %hlow2 to <8 x i8>
  %bytes3 = bitcast <4 x i16> %hlow3 to <8 x i8>
  %join0 = shufflevector <8 x i8> %bytes0, <8 x i8> %bytes1,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %join1 = shufflevector <8 x i8> %bytes2, <8 x i8> %bytes3,
                         <8 x i32> <i32 1, i32 3, i32 5, i32 7,
                                    i32 9, i32 11, i32 13, i32 15>
  %ret = shufflevector <8 x i8> %join0, <8 x i8> %join1,
                       <16 x i32> <i32 0, i32 1, i32 2, i32 3,
                                   i32 4, i32 5, i32 6, i32 7,
                                   i32 8, i32 9, i32 10, i32 11,
                                   i32 12, i32 13, i32 14, i32 15>
  ret <16 x i8> %ret
}

; Test a <2 x i64> -> <4 x f32> pack in which only individual elements are
; needed.
define float @f8(i64 %scalar0, i64 %scalar1, i64 %scalar2, i64 %scalar3) {
; CHECK-LABEL: f8:
; CHECK-NOT: vperm
; CHECK-NOT: vpk
; CHECK-NOT: vmrh
; CHECK: aebr {{%f[0-7]}},
; CHECK: aebr {{%f[0-7]}},
; CHECK: meebr %f0,
; CHECK: br %r14
  %vec0 = insertelement <2 x i64> undef, i64 %scalar0, i32 0
  %vec1 = insertelement <2 x i64> undef, i64 %scalar1, i32 0
  %vec2 = insertelement <2 x i64> undef, i64 %scalar2, i32 0
  %vec3 = insertelement <2 x i64> undef, i64 %scalar3, i32 0
  %join0 = shufflevector <2 x i64> %vec0, <2 x i64> %vec1,
                         <2 x i32> <i32 0, i32 2>
  %join1 = shufflevector <2 x i64> %vec2, <2 x i64> %vec3,
                         <2 x i32> <i32 0, i32 2>
  %bitcast0 = bitcast <2 x i64> %join0 to <4 x float>
  %bitcast1 = bitcast <2 x i64> %join1 to <4 x float>
  %pack = shufflevector <4 x float> %bitcast0, <4 x float> %bitcast1,
                        <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %elt0 = extractelement <4 x float> %pack, i32 0
  %elt1 = extractelement <4 x float> %pack, i32 1
  %elt2 = extractelement <4 x float> %pack, i32 2
  %elt3 = extractelement <4 x float> %pack, i32 3
  %add0 = fadd float %elt0, %elt2
  %add1 = fadd float %elt1, %elt3
  %ret = fmul float %add0, %add1
  ret float %ret
}

; Test a <2 x f64> -> <4 x i32> pack in which only individual elements are
; needed.
define i32 @f9(double %scalar0, double %scalar1, double %scalar2,
               double %scalar3) {
; CHECK-LABEL: f9:
; CHECK-NOT: vperm
; CHECK-NOT: vpk
; CHECK-NOT: vmrh
; CHECK: ar {{%r[0-5]}},
; CHECK: ar {{%r[0-5]}},
; CHECK: ork %r2,
; CHECK: br %r14
  %vec0 = insertelement <2 x double> undef, double %scalar0, i32 0
  %vec1 = insertelement <2 x double> undef, double %scalar1, i32 0
  %vec2 = insertelement <2 x double> undef, double %scalar2, i32 0
  %vec3 = insertelement <2 x double> undef, double %scalar3, i32 0
  %join0 = shufflevector <2 x double> %vec0, <2 x double> %vec1,
                         <2 x i32> <i32 0, i32 2>
  %join1 = shufflevector <2 x double> %vec2, <2 x double> %vec3,
                         <2 x i32> <i32 0, i32 2>
  %bitcast0 = bitcast <2 x double> %join0 to <4 x i32>
  %bitcast1 = bitcast <2 x double> %join1 to <4 x i32>
  %pack = shufflevector <4 x i32> %bitcast0, <4 x i32> %bitcast1,
                        <4 x i32> <i32 1, i32 3, i32 5, i32 7>
  %elt0 = extractelement <4 x i32> %pack, i32 0
  %elt1 = extractelement <4 x i32> %pack, i32 1
  %elt2 = extractelement <4 x i32> %pack, i32 2
  %elt3 = extractelement <4 x i32> %pack, i32 3
  %add0 = add i32 %elt0, %elt2
  %add1 = add i32 %elt1, %elt3
  %ret = or i32 %add0, %add1
  ret i32 %ret
}