1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -O3 -mtriple=riscv32 -mattr=+xcvmem -verify-machineinstrs < %s \
3 ; RUN: | FileCheck %s --check-prefixes=CHECK
5 define <2 x i32> @lb_ri_inc(i8* %a) {
6 ; CHECK-LABEL: lb_ri_inc:
8 ; CHECK-NEXT: cv.lb a1, (a0), 42
11 %2 = sext i8 %1 to i32
12 %3 = getelementptr i8, i8* %a, i32 42
13 %4 = ptrtoint i8* %3 to i32
14 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
15 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
19 define <2 x i32> @lb_rr_inc(i8* %a, i32 %b) {
20 ; CHECK-LABEL: lb_rr_inc:
22 ; CHECK-NEXT: cv.lb a1, (a0), a1
25 %2 = sext i8 %1 to i32
26 %3 = getelementptr i8, i8* %a, i32 %b
27 %4 = ptrtoint i8* %3 to i32
28 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
29 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
33 define i32 @lb_rr(i8* %a, i32 %b) {
36 ; CHECK-NEXT: cv.lb a0, a1(a0)
38 %1 = getelementptr i8, i8* %a, i32 %b
40 %3 = sext i8 %2 to i32
44 define <2 x i32> @lbu_ri_inc(i8* %a) {
45 ; CHECK-LABEL: lbu_ri_inc:
47 ; CHECK-NEXT: cv.lbu a1, (a0), 42
50 %2 = zext i8 %1 to i32
51 %3 = getelementptr i8, i8* %a, i32 42
52 %4 = ptrtoint i8* %3 to i32
53 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
54 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
58 define <2 x i32> @lbu_rr_inc(i8* %a, i32 %b) {
59 ; CHECK-LABEL: lbu_rr_inc:
61 ; CHECK-NEXT: cv.lbu a1, (a0), a1
64 %2 = zext i8 %1 to i32
65 %3 = getelementptr i8, i8* %a, i32 %b
66 %4 = ptrtoint i8* %3 to i32
67 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
68 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
72 define i32 @lbu_rr(i8* %a, i32 %b) {
73 ; CHECK-LABEL: lbu_rr:
75 ; CHECK-NEXT: cv.lbu a0, a1(a0)
77 %1 = getelementptr i8, i8* %a, i32 %b
79 %3 = zext i8 %2 to i32
83 define <2 x i32> @lh_ri_inc(i16* %a) {
84 ; CHECK-LABEL: lh_ri_inc:
86 ; CHECK-NEXT: cv.lh a1, (a0), 84
88 %1 = load i16, i16* %a
89 %2 = sext i16 %1 to i32
90 %3 = getelementptr i16, i16* %a, i32 42
91 %4 = ptrtoint i16* %3 to i32
92 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
93 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
97 define <2 x i32> @lh_rr_inc(i16* %a, i32 %b) {
98 ; CHECK-LABEL: lh_rr_inc:
100 ; CHECK-NEXT: slli a1, a1, 1
101 ; CHECK-NEXT: cv.lh a1, (a0), a1
103 %1 = load i16, i16* %a
104 %2 = sext i16 %1 to i32
105 %3 = getelementptr i16, i16* %a, i32 %b
106 %4 = ptrtoint i16* %3 to i32
107 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
108 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
112 define i32 @lh_rr(i16* %a, i32 %b) {
113 ; CHECK-LABEL: lh_rr:
115 ; CHECK-NEXT: slli a1, a1, 1
116 ; CHECK-NEXT: cv.lh a0, a1(a0)
118 %1 = getelementptr i16, i16* %a, i32 %b
119 %2 = load i16, i16* %1
120 %3 = sext i16 %2 to i32
124 define <2 x i32> @lhu_ri_inc(i16* %a) {
125 ; CHECK-LABEL: lhu_ri_inc:
127 ; CHECK-NEXT: cv.lhu a1, (a0), 84
129 %1 = load i16, i16* %a
130 %2 = zext i16 %1 to i32
131 %3 = getelementptr i16, i16* %a, i32 42
132 %4 = ptrtoint i16* %3 to i32
133 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
134 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
138 define <2 x i32> @lhu_rr_inc(i16* %a, i32 %b) {
139 ; CHECK-LABEL: lhu_rr_inc:
141 ; CHECK-NEXT: slli a1, a1, 1
142 ; CHECK-NEXT: cv.lhu a1, (a0), a1
144 %1 = load i16, i16* %a
145 %2 = zext i16 %1 to i32
146 %3 = getelementptr i16, i16* %a, i32 %b
147 %4 = ptrtoint i16* %3 to i32
148 %5 = insertelement <2 x i32> undef, i32 %4, i32 0
149 %6 = insertelement <2 x i32> %5, i32 %2, i32 1
153 define i32 @lhu_rr(i16* %a, i32 %b) {
154 ; CHECK-LABEL: lhu_rr:
156 ; CHECK-NEXT: slli a1, a1, 1
157 ; CHECK-NEXT: cv.lhu a0, a1(a0)
159 %1 = getelementptr i16, i16* %a, i32 %b
160 %2 = load i16, i16* %1
161 %3 = zext i16 %2 to i32
165 define <2 x i32> @lw_ri_inc(i32* %a) {
166 ; CHECK-LABEL: lw_ri_inc:
168 ; CHECK-NEXT: cv.lw a1, (a0), 168
170 %1 = load i32, i32* %a
171 %2 = getelementptr i32, i32* %a, i32 42
172 %3 = ptrtoint i32* %2 to i32
173 %4 = insertelement <2 x i32> undef, i32 %3, i32 0
174 %5 = insertelement <2 x i32> %4, i32 %1, i32 1
178 define <2 x i32> @lw_rr_inc(i32* %a, i32 %b) {
179 ; CHECK-LABEL: lw_rr_inc:
181 ; CHECK-NEXT: slli a1, a1, 2
182 ; CHECK-NEXT: cv.lw a1, (a0), a1
184 %1 = load i32, i32* %a
185 %2 = getelementptr i32, i32* %a, i32 %b
186 %3 = ptrtoint i32* %2 to i32
187 %4 = insertelement <2 x i32> undef, i32 %3, i32 0
188 %5 = insertelement <2 x i32> %4, i32 %1, i32 1
192 define i32 @lw_rr(i32* %a, i32 %b) {
193 ; CHECK-LABEL: lw_rr:
195 ; CHECK-NEXT: slli a1, a1, 2
196 ; CHECK-NEXT: cv.lw a0, a1(a0)
198 %1 = getelementptr i32, i32* %a, i32 %b
199 %2 = load i32, i32* %1
203 define i8* @sb_ri_inc(i8* %a, i8 %b) {
204 ; CHECK-LABEL: sb_ri_inc:
206 ; CHECK-NEXT: cv.sb a1, (a0), 42
209 %1 = getelementptr i8, i8* %a, i32 42
213 define i8* @sb_rr_inc(i8* %a, i8 %b, i32 %c) {
214 ; CHECK-LABEL: sb_rr_inc:
216 ; CHECK-NEXT: cv.sb a1, (a0), a2
219 %1 = getelementptr i8, i8* %a, i32 %c
223 define void @sb_rr(i8* %a, i8 %b, i32 %c) {
224 ; CHECK-LABEL: sb_rr:
226 ; CHECK-NEXT: cv.sb a1, a2(a0)
228 %1 = getelementptr i8, i8* %a, i32 %c
233 define i16* @sh_ri_inc(i16* %a, i16 %b) {
234 ; CHECK-LABEL: sh_ri_inc:
236 ; CHECK-NEXT: cv.sh a1, (a0), 84
238 store i16 %b, i16* %a
239 %1 = getelementptr i16, i16* %a, i32 42
243 define i16* @sh_rr_inc(i16* %a, i16 %b, i32 %c) {
244 ; CHECK-LABEL: sh_rr_inc:
246 ; CHECK-NEXT: slli a2, a2, 1
247 ; CHECK-NEXT: cv.sh a1, (a0), a2
249 store i16 %b, i16* %a
250 %1 = getelementptr i16, i16* %a, i32 %c
254 define void @sh_rr(i16* %a, i16 %b, i32 %c) {
255 ; CHECK-LABEL: sh_rr:
257 ; CHECK-NEXT: slli a2, a2, 1
258 ; CHECK-NEXT: cv.sh a1, a2(a0)
260 %1 = getelementptr i16, i16* %a, i32 %c
261 store i16 %b, i16* %1
265 define i32* @sw_ri_inc(i32* %a, i32 %b) {
266 ; CHECK-LABEL: sw_ri_inc:
268 ; CHECK-NEXT: cv.sw a1, (a0), 168
270 store i32 %b, i32* %a
271 %1 = getelementptr i32, i32* %a, i32 42
275 define i32* @sw_rr_inc(i32* %a, i32 %b, i32 %c) {
276 ; CHECK-LABEL: sw_rr_inc:
278 ; CHECK-NEXT: slli a2, a2, 2
279 ; CHECK-NEXT: cv.sw a1, (a0), a2
281 store i32 %b, i32* %a
282 %1 = getelementptr i32, i32* %a, i32 %c
286 define void @sw_rr(i32* %a, i32 %b, i32 %c) {
287 ; CHECK-LABEL: sw_rr:
289 ; CHECK-NEXT: slli a2, a2, 2
290 ; CHECK-NEXT: cv.sw a1, a2(a0)
292 %1 = getelementptr i32, i32* %a, i32 %c
293 store i32 %b, i32* %1