1 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s
3 @e = dso_local global [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8], align 16
4 @d = dso_local global [8 x i32] [i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1, i32 1], align 16
6 ; The global 'e' has 16 byte alignment, so make sure we don't generate an
7 ; aligned 32-byte load instruction when we combine the load+insert sequence.
9 define dso_local i32 @subb() nounwind ssp {
11 ; CHECK: vmovups e(%rip), %ymm
13 %0 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 7), align 4
14 %1 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 6), align 8
15 %2 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 5), align 4
16 %3 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 4), align 16
17 %4 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 3), align 4
18 %5 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 2), align 8
19 %6 = load i32, ptr getelementptr inbounds ([8 x i32], ptr @e, i64 0, i64 1), align 4
20 %7 = load i32, ptr @e, align 16
21 %vecinit.i = insertelement <8 x i32> undef, i32 %7, i32 0
22 %vecinit1.i = insertelement <8 x i32> %vecinit.i, i32 %6, i32 1
23 %vecinit2.i = insertelement <8 x i32> %vecinit1.i, i32 %5, i32 2
24 %vecinit3.i = insertelement <8 x i32> %vecinit2.i, i32 %4, i32 3
25 %vecinit4.i = insertelement <8 x i32> %vecinit3.i, i32 %3, i32 4
26 %vecinit5.i = insertelement <8 x i32> %vecinit4.i, i32 %2, i32 5
27 %vecinit6.i = insertelement <8 x i32> %vecinit5.i, i32 %1, i32 6
28 %vecinit7.i = insertelement <8 x i32> %vecinit6.i, i32 %0, i32 7
29 %8 = bitcast <8 x i32> %vecinit7.i to <32 x i8>
30 tail call void @llvm.x86.avx.storeu.dq.256(ptr @d, <32 x i8> %8)
34 declare void @llvm.x86.avx.storeu.dq.256(ptr, <32 x i8>) nounwind