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=riscv64 -mattr=+v -S %s | FileCheck --check-prefixes=NON-POW2 %s
3 ; RUN: opt -passes=slp-vectorizer -slp-vectorize-non-power-of-2=false -mtriple=riscv64 -mattr=+v -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:%.*]]) #[[ATTR0:[0-9]+]] {
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:%.*]]) #[[ATTR0:[0-9]+]] {
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: [[DST_12:%.*]] = getelementptr i8, ptr [[DST]], i8 12
29 ; POW2-ONLY-NEXT: [[TMP4:%.*]] = load <2 x i8>, ptr [[GEP_SRC_12]], align 4
30 ; POW2-ONLY-NEXT: [[TMP5:%.*]] = mul nsw <2 x i8> [[TMP4]], splat (i8 10)
31 ; POW2-ONLY-NEXT: store <2 x i8> [[TMP5]], ptr [[DST_12]], align 1
32 ; POW2-ONLY-NEXT: [[GEP_SRC_14:%.*]] = getelementptr inbounds i8, ptr [[SRC]], i8 14
33 ; POW2-ONLY-NEXT: [[L_SRC_14:%.*]] = load i8, ptr [[GEP_SRC_14]], align 4
34 ; POW2-ONLY-NEXT: [[MUL_14:%.*]] = mul nsw i8 [[L_SRC_14]], 10
35 ; POW2-ONLY-NEXT: [[DST_14:%.*]] = getelementptr i8, ptr [[DST]], i8 14
36 ; POW2-ONLY-NEXT: store i8 [[MUL_14]], ptr [[DST_14]], align 1
37 ; POW2-ONLY-NEXT: ret void
40 %gep.src.0 = getelementptr inbounds i8, ptr %src, i8 0
41 %l.src.0 = load i8, ptr %gep.src.0, align 4
42 %mul.0 = mul nsw i8 %l.src.0, 10
43 store i8 %mul.0, ptr %dst
45 %gep.src.1 = getelementptr inbounds i8, ptr %src, i8 1
46 %l.src.1 = load i8, ptr %gep.src.1, align 4
47 %mul.1 = mul nsw i8 %l.src.1, 10
48 %dst.1 = getelementptr i8, ptr %dst, i8 1
49 store i8 %mul.1, ptr %dst.1
51 %gep.src.2 = getelementptr inbounds i8, ptr %src, i8 2
52 %l.src.2 = load i8, ptr %gep.src.2, align 4
53 %mul.2 = mul nsw i8 %l.src.2, 10
54 %dst.2 = getelementptr i8, ptr %dst, i8 2
55 store i8 %mul.2, ptr %dst.2
57 %gep.src.3 = getelementptr inbounds i8, ptr %src, i8 3
58 %l.src.3 = load i8, ptr %gep.src.3, align 4
59 %mul.3 = mul nsw i8 %l.src.3, 10
60 %dst.3 = getelementptr i8, ptr %dst, i8 3
61 store i8 %mul.3, ptr %dst.3
63 %gep.src.4 = getelementptr inbounds i8, ptr %src, i8 4
64 %l.src.4 = load i8, ptr %gep.src.4, align 4
65 %mul.4 = mul nsw i8 %l.src.4, 10
66 %dst.4 = getelementptr i8, ptr %dst, i8 4
67 store i8 %mul.4, ptr %dst.4
69 %gep.src.5 = getelementptr inbounds i8, ptr %src, i8 5
70 %l.src.5 = load i8, ptr %gep.src.5, align 4
71 %mul.5 = mul nsw i8 %l.src.5, 10
72 %dst.5 = getelementptr i8, ptr %dst, i8 5
73 store i8 %mul.5, ptr %dst.5
75 %gep.src.6 = getelementptr inbounds i8, ptr %src, i8 6
76 %l.src.6 = load i8, ptr %gep.src.6, align 4
77 %mul.6 = mul nsw i8 %l.src.6, 10
78 %dst.6 = getelementptr i8, ptr %dst, i8 6
79 store i8 %mul.6, ptr %dst.6
81 %gep.src.7 = getelementptr inbounds i8, ptr %src, i8 7
82 %l.src.7 = load i8, ptr %gep.src.7, align 4
83 %mul.7 = mul nsw i8 %l.src.7, 10
84 %dst.7 = getelementptr i8, ptr %dst, i8 7
85 store i8 %mul.7, ptr %dst.7
87 %gep.src.8 = getelementptr inbounds i8, ptr %src, i8 8
88 %l.src.8 = load i8, ptr %gep.src.8, align 4
89 %mul.8 = mul nsw i8 %l.src.8, 10
90 %dst.8 = getelementptr i8, ptr %dst, i8 8
91 store i8 %mul.8, ptr %dst.8
93 %gep.src.9 = getelementptr inbounds i8, ptr %src, i8 9
94 %l.src.9 = load i8, ptr %gep.src.9, align 4
95 %mul.9 = mul nsw i8 %l.src.9, 10
96 %dst.9 = getelementptr i8, ptr %dst, i8 9
97 store i8 %mul.9, ptr %dst.9
99 %gep.src.10 = getelementptr inbounds i8, ptr %src, i8 10
100 %l.src.10 = load i8, ptr %gep.src.10, align 4
101 %mul.10 = mul nsw i8 %l.src.10, 10
102 %dst.10 = getelementptr i8, ptr %dst, i8 10
103 store i8 %mul.10, ptr %dst.10
105 %gep.src.11 = getelementptr inbounds i8, ptr %src, i8 11
106 %l.src.11 = load i8, ptr %gep.src.11, align 4
107 %mul.11 = mul nsw i8 %l.src.11, 10
108 %dst.11 = getelementptr i8, ptr %dst, i8 11
109 store i8 %mul.11, ptr %dst.11
111 %gep.src.12 = getelementptr inbounds i8, ptr %src, i8 12
112 %l.src.12 = load i8, ptr %gep.src.12, align 4
113 %mul.12 = mul nsw i8 %l.src.12, 10
114 %dst.12 = getelementptr i8, ptr %dst, i8 12
115 store i8 %mul.12, ptr %dst.12
117 %gep.src.13 = getelementptr inbounds i8, ptr %src, i8 13
118 %l.src.13 = load i8, ptr %gep.src.13, align 4
119 %mul.13 = mul nsw i8 %l.src.13, 10
120 %dst.13 = getelementptr i8, ptr %dst, i8 13
121 store i8 %mul.13, ptr %dst.13
123 %gep.src.14 = getelementptr inbounds i8, ptr %src, i8 14
124 %l.src.14 = load i8, ptr %gep.src.14, align 4
125 %mul.14 = mul nsw i8 %l.src.14, 10
126 %dst.14 = getelementptr i8, ptr %dst, i8 14
127 store i8 %mul.14, ptr %dst.14