1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -S -mtriple=x86_64-unknown -slp-vectorizer -slp-max-store-lookup=2 -slp-min-reg-size=64 -slp-threshold=-1000 | FileCheck %s
4 define i32 @non-ordered-stores(i32* noalias nocapture %in, i32* noalias nocapture %inn, i32* noalias nocapture %out) {
5 ; CHECK-LABEL: @non-ordered-stores(
6 ; CHECK-NEXT: [[IN_ADDR:%.*]] = getelementptr inbounds i32, i32* [[IN:%.*]], i64 0
7 ; CHECK-NEXT: [[LOAD_1:%.*]] = load i32, i32* [[IN_ADDR]], align 4
8 ; CHECK-NEXT: [[GEP_1:%.*]] = getelementptr inbounds i32, i32* [[IN_ADDR]], i64 1
9 ; CHECK-NEXT: [[LOAD_2:%.*]] = load i32, i32* [[GEP_1]], align 4
10 ; CHECK-NEXT: [[GEP_2:%.*]] = getelementptr inbounds i32, i32* [[IN_ADDR]], i64 2
11 ; CHECK-NEXT: [[LOAD_3:%.*]] = load i32, i32* [[GEP_2]], align 4
12 ; CHECK-NEXT: [[GEP_3:%.*]] = getelementptr inbounds i32, i32* [[IN_ADDR]], i64 3
13 ; CHECK-NEXT: [[LOAD_4:%.*]] = load i32, i32* [[GEP_3]], align 4
14 ; CHECK-NEXT: [[INN_ADDR:%.*]] = getelementptr inbounds i32, i32* [[INN:%.*]], i64 0
15 ; CHECK-NEXT: [[LOAD_5:%.*]] = load i32, i32* [[INN_ADDR]], align 4
16 ; CHECK-NEXT: [[GEP_4:%.*]] = getelementptr inbounds i32, i32* [[INN_ADDR]], i64 1
17 ; CHECK-NEXT: [[LOAD_6:%.*]] = load i32, i32* [[GEP_4]], align 4
18 ; CHECK-NEXT: [[GEP_5:%.*]] = getelementptr inbounds i32, i32* [[INN_ADDR]], i64 2
19 ; CHECK-NEXT: [[LOAD_7:%.*]] = load i32, i32* [[GEP_5]], align 4
20 ; CHECK-NEXT: [[GEP_6:%.*]] = getelementptr inbounds i32, i32* [[INN_ADDR]], i64 3
21 ; CHECK-NEXT: [[LOAD_8:%.*]] = load i32, i32* [[GEP_6]], align 4
22 ; CHECK-NEXT: [[TMP1:%.*]] = insertelement <2 x i32> poison, i32 [[LOAD_1]], i32 0
23 ; CHECK-NEXT: [[TMP2:%.*]] = insertelement <2 x i32> [[TMP1]], i32 [[LOAD_3]], i32 1
24 ; CHECK-NEXT: [[TMP3:%.*]] = insertelement <2 x i32> poison, i32 [[LOAD_5]], i32 0
25 ; CHECK-NEXT: [[TMP4:%.*]] = insertelement <2 x i32> [[TMP3]], i32 [[LOAD_7]], i32 1
26 ; CHECK-NEXT: [[TMP5:%.*]] = mul <2 x i32> [[TMP2]], [[TMP4]]
27 ; CHECK-NEXT: [[TMP6:%.*]] = insertelement <2 x i32> poison, i32 [[LOAD_2]], i32 0
28 ; CHECK-NEXT: [[TMP7:%.*]] = insertelement <2 x i32> [[TMP6]], i32 [[LOAD_4]], i32 1
29 ; CHECK-NEXT: [[TMP8:%.*]] = insertelement <2 x i32> poison, i32 [[LOAD_6]], i32 0
30 ; CHECK-NEXT: [[TMP9:%.*]] = insertelement <2 x i32> [[TMP8]], i32 [[LOAD_8]], i32 1
31 ; CHECK-NEXT: [[TMP10:%.*]] = mul <2 x i32> [[TMP7]], [[TMP9]]
32 ; CHECK-NEXT: br label [[BLOCK1:%.*]]
34 ; CHECK-NEXT: [[GEP_X:%.*]] = getelementptr inbounds i32, i32* [[INN_ADDR]], i64 5
35 ; CHECK-NEXT: [[LOAD_9:%.*]] = load i32, i32* [[GEP_X]], align 4
36 ; CHECK-NEXT: br label [[BLOCK2:%.*]]
38 ; CHECK-NEXT: [[GEP_7:%.*]] = getelementptr inbounds i32, i32* [[OUT:%.*]], i64 0
39 ; CHECK-NEXT: [[GEP_8:%.*]] = getelementptr inbounds i32, i32* [[OUT]], i64 1
40 ; CHECK-NEXT: [[GEP_9:%.*]] = getelementptr inbounds i32, i32* [[OUT]], i64 2
41 ; CHECK-NEXT: [[GEP_10:%.*]] = getelementptr inbounds i32, i32* [[OUT]], i64 3
42 ; CHECK-NEXT: [[GEP_11:%.*]] = getelementptr inbounds i32, i32* [[OUT]], i64 4
43 ; CHECK-NEXT: store i32 [[LOAD_9]], i32* [[GEP_9]], align 4
44 ; CHECK-NEXT: [[TMP11:%.*]] = bitcast i32* [[GEP_10]] to <2 x i32>*
45 ; CHECK-NEXT: store <2 x i32> [[TMP5]], <2 x i32>* [[TMP11]], align 4
46 ; CHECK-NEXT: [[TMP12:%.*]] = bitcast i32* [[GEP_7]] to <2 x i32>*
47 ; CHECK-NEXT: store <2 x i32> [[TMP10]], <2 x i32>* [[TMP12]], align 4
48 ; CHECK-NEXT: ret i32 undef
50 %in.addr = getelementptr inbounds i32, i32* %in, i64 0
51 %load.1 = load i32, i32* %in.addr, align 4
52 %gep.1 = getelementptr inbounds i32, i32* %in.addr, i64 1
53 %load.2 = load i32, i32* %gep.1, align 4
54 %gep.2 = getelementptr inbounds i32, i32* %in.addr, i64 2
55 %load.3 = load i32, i32* %gep.2, align 4
56 %gep.3 = getelementptr inbounds i32, i32* %in.addr, i64 3
57 %load.4 = load i32, i32* %gep.3, align 4
58 %inn.addr = getelementptr inbounds i32, i32* %inn, i64 0
59 %load.5 = load i32, i32* %inn.addr, align 4
60 %gep.4 = getelementptr inbounds i32, i32* %inn.addr, i64 1
61 %load.6 = load i32, i32* %gep.4, align 4
62 %gep.5 = getelementptr inbounds i32, i32* %inn.addr, i64 2
63 %load.7 = load i32, i32* %gep.5, align 4
64 %gep.6 = getelementptr inbounds i32, i32* %inn.addr, i64 3
65 %load.8 = load i32, i32* %gep.6, align 4
66 %mul.1 = mul i32 %load.1, %load.5
67 %mul.2 = mul i32 %load.2, %load.6
68 %mul.3 = mul i32 %load.3, %load.7
69 %mul.4 = mul i32 %load.4, %load.8
73 %gep.x = getelementptr inbounds i32, i32* %inn.addr, i64 5
74 %load.9 = load i32, i32* %gep.x, align 4
78 %gep.7 = getelementptr inbounds i32, i32* %out, i64 0
79 %gep.8 = getelementptr inbounds i32, i32* %out, i64 1
80 %gep.9 = getelementptr inbounds i32, i32* %out, i64 2
81 %gep.10 = getelementptr inbounds i32, i32* %out, i64 3
82 %gep.11 = getelementptr inbounds i32, i32* %out, i64 4
83 store i32 %mul.1, i32* %gep.10, align 4
84 store i32 %load.9, i32* %gep.9, align 4
85 store i32 %mul.2, i32* %gep.7, align 4
86 store i32 %mul.3, i32* %gep.11, align 4
87 store i32 %mul.4, i32* %gep.8, align 4