1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
2 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-non-power-of-2 -mtriple=arm64-apple-ios -S %s | FileCheck --check-prefixes=NON-POW2 %s
3 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-non-power-of-2=false -mtriple=arm64-apple-ios -S %s | FileCheck --check-prefixes=POW2-ONLY %s
5 define void @v15_load_i8_mul_by_constant_store(ptr %src, ptr noalias %dst) {
6 ; NON-POW2-LABEL: define void @v15_load_i8_mul_by_constant_store(
7 ; NON-POW2-SAME: ptr [[SRC:%.*]], ptr noalias [[DST:%.*]]) {
8 ; NON-POW2-NEXT: entry:
9 ; NON-POW2-NEXT: [[GEP_SRC_0:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 0
10 ; NON-POW2-NEXT: [[TMP0:%.*]] = load <15 x i8>, ptr [[GEP_SRC_0]], align 4
11 ; NON-POW2-NEXT: [[TMP1:%.*]] = mul nsw <15 x i8> [[TMP0]], splat (i8 10)
12 ; NON-POW2-NEXT: store <15 x i8> [[TMP1]], ptr [[DST]], align 1
13 ; NON-POW2-NEXT: ret void
15 ; POW2-ONLY-LABEL: define void @v15_load_i8_mul_by_constant_store(
16 ; POW2-ONLY-SAME: ptr [[SRC:%.*]], ptr noalias [[DST:%.*]]) {
17 ; POW2-ONLY-NEXT: entry:
18 ; POW2-ONLY-NEXT: [[GEP_SRC_0:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 0
19 ; POW2-ONLY-NEXT: [[TMP0:%.*]] = load <8 x i8>, ptr [[GEP_SRC_0]], align 4
20 ; POW2-ONLY-NEXT: [[TMP1:%.*]] = mul nsw <8 x i8> [[TMP0]], splat (i8 10)
21 ; POW2-ONLY-NEXT: store <8 x i8> [[TMP1]], ptr [[DST]], align 1
22 ; POW2-ONLY-NEXT: [[GEP_SRC_8:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 8
23 ; POW2-ONLY-NEXT: [[DST_8:%.*]] = getelementptr i8, ptr [[DST]], i8 8
24 ; POW2-ONLY-NEXT: [[TMP2:%.*]] = load <4 x i8>, ptr [[GEP_SRC_8]], align 4
25 ; POW2-ONLY-NEXT: [[TMP3:%.*]] = mul nsw <4 x i8> [[TMP2]], splat (i8 10)
26 ; POW2-ONLY-NEXT: store <4 x i8> [[TMP3]], ptr [[DST_8]], align 1
27 ; POW2-ONLY-NEXT: [[GEP_SRC_12:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 12
28 ; POW2-ONLY-NEXT: [[L_SRC_12:%.*]] = load i8, ptr [[GEP_SRC_12]], align 4
29 ; POW2-ONLY-NEXT: [[MUL_12:%.*]] = mul nsw i8 [[L_SRC_12]], 10
30 ; POW2-ONLY-NEXT: [[DST_12:%.*]] = getelementptr i8, ptr [[DST]], i8 12
31 ; POW2-ONLY-NEXT: store i8 [[MUL_12]], ptr [[DST_12]], align 1
32 ; POW2-ONLY-NEXT: [[GEP_SRC_13:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 13
33 ; POW2-ONLY-NEXT: [[L_SRC_13:%.*]] = load i8, ptr [[GEP_SRC_13]], align 4
34 ; POW2-ONLY-NEXT: [[MUL_13:%.*]] = mul nsw i8 [[L_SRC_13]], 10
35 ; POW2-ONLY-NEXT: [[DST_13:%.*]] = getelementptr i8, ptr [[DST]], i8 13
36 ; POW2-ONLY-NEXT: store i8 [[MUL_13]], ptr [[DST_13]], align 1
37 ; POW2-ONLY-NEXT: [[GEP_SRC_14:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 14
38 ; POW2-ONLY-NEXT: [[L_SRC_14:%.*]] = load i8, ptr [[GEP_SRC_14]], align 4
39 ; POW2-ONLY-NEXT: [[MUL_14:%.*]] = mul nsw i8 [[L_SRC_14]], 10
40 ; POW2-ONLY-NEXT: [[DST_14:%.*]] = getelementptr i8, ptr [[DST]], i8 14
41 ; POW2-ONLY-NEXT: store i8 [[MUL_14]], ptr [[DST_14]], align 1
42 ; POW2-ONLY-NEXT: ret void
45 %gep.src.0 = getelementptr inbounds i8, ptr %src, i8 0
46 %l.src.0 = load i8, ptr %gep.src.0, align 4
47 %mul.0 = mul nsw i8 %l.src.0, 10
48 store i8 %mul.0, ptr %dst
50 %gep.src.1 = getelementptr inbounds i8, ptr %src, i8 1
51 %l.src.1 = load i8, ptr %gep.src.1, align 4
52 %mul.1 = mul nsw i8 %l.src.1, 10
53 %dst.1 = getelementptr i8, ptr %dst, i8 1
54 store i8 %mul.1, ptr %dst.1
56 %gep.src.2 = getelementptr inbounds i8, ptr %src, i8 2
57 %l.src.2 = load i8, ptr %gep.src.2, align 4
58 %mul.2 = mul nsw i8 %l.src.2, 10
59 %dst.2 = getelementptr i8, ptr %dst, i8 2
60 store i8 %mul.2, ptr %dst.2
62 %gep.src.3 = getelementptr inbounds i8, ptr %src, i8 3
63 %l.src.3 = load i8, ptr %gep.src.3, align 4
64 %mul.3 = mul nsw i8 %l.src.3, 10
65 %dst.3 = getelementptr i8, ptr %dst, i8 3
66 store i8 %mul.3, ptr %dst.3
68 %gep.src.4 = getelementptr inbounds i8, ptr %src, i8 4
69 %l.src.4 = load i8, ptr %gep.src.4, align 4
70 %mul.4 = mul nsw i8 %l.src.4, 10
71 %dst.4 = getelementptr i8, ptr %dst, i8 4
72 store i8 %mul.4, ptr %dst.4
74 %gep.src.5 = getelementptr inbounds i8, ptr %src, i8 5
75 %l.src.5 = load i8, ptr %gep.src.5, align 4
76 %mul.5 = mul nsw i8 %l.src.5, 10
77 %dst.5 = getelementptr i8, ptr %dst, i8 5
78 store i8 %mul.5, ptr %dst.5
80 %gep.src.6 = getelementptr inbounds i8, ptr %src, i8 6
81 %l.src.6 = load i8, ptr %gep.src.6, align 4
82 %mul.6 = mul nsw i8 %l.src.6, 10
83 %dst.6 = getelementptr i8, ptr %dst, i8 6
84 store i8 %mul.6, ptr %dst.6
86 %gep.src.7 = getelementptr inbounds i8, ptr %src, i8 7
87 %l.src.7 = load i8, ptr %gep.src.7, align 4
88 %mul.7 = mul nsw i8 %l.src.7, 10
89 %dst.7 = getelementptr i8, ptr %dst, i8 7
90 store i8 %mul.7, ptr %dst.7
92 %gep.src.8 = getelementptr inbounds i8, ptr %src, i8 8
93 %l.src.8 = load i8, ptr %gep.src.8, align 4
94 %mul.8 = mul nsw i8 %l.src.8, 10
95 %dst.8 = getelementptr i8, ptr %dst, i8 8
96 store i8 %mul.8, ptr %dst.8
98 %gep.src.9 = getelementptr inbounds i8, ptr %src, i8 9
99 %l.src.9 = load i8, ptr %gep.src.9, align 4
100 %mul.9 = mul nsw i8 %l.src.9, 10
101 %dst.9 = getelementptr i8, ptr %dst, i8 9
102 store i8 %mul.9, ptr %dst.9
104 %gep.src.10 = getelementptr inbounds i8, ptr %src, i8 10
105 %l.src.10 = load i8, ptr %gep.src.10, align 4
106 %mul.10 = mul nsw i8 %l.src.10, 10
107 %dst.10 = getelementptr i8, ptr %dst, i8 10
108 store i8 %mul.10, ptr %dst.10
110 %gep.src.11 = getelementptr inbounds i8, ptr %src, i8 11
111 %l.src.11 = load i8, ptr %gep.src.11, align 4
112 %mul.11 = mul nsw i8 %l.src.11, 10
113 %dst.11 = getelementptr i8, ptr %dst, i8 11
114 store i8 %mul.11, ptr %dst.11
116 %gep.src.12 = getelementptr inbounds i8, ptr %src, i8 12
117 %l.src.12 = load i8, ptr %gep.src.12, align 4
118 %mul.12 = mul nsw i8 %l.src.12, 10
119 %dst.12 = getelementptr i8, ptr %dst, i8 12
120 store i8 %mul.12, ptr %dst.12
122 %gep.src.13 = getelementptr inbounds i8, ptr %src, i8 13
123 %l.src.13 = load i8, ptr %gep.src.13, align 4
124 %mul.13 = mul nsw i8 %l.src.13, 10
125 %dst.13 = getelementptr i8, ptr %dst, i8 13
126 store i8 %mul.13, ptr %dst.13
128 %gep.src.14 = getelementptr inbounds i8, ptr %src, i8 14
129 %l.src.14 = load i8, ptr %gep.src.14, align 4
130 %mul.14 = mul nsw i8 %l.src.14, 10
131 %dst.14 = getelementptr i8, ptr %dst, i8 14
132 store i8 %mul.14, ptr %dst.14