1 ; NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 ; RUN: llc -mtriple=riscv32 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
3 ; RUN: | FileCheck -check-prefix=RV32I %s
4 ; RUN: llc -mtriple=riscv64 -global-isel -stop-after=irtranslator -verify-machineinstrs < %s \
5 ; RUN: | FileCheck -check-prefix=RV64I %s
7 define void @test_args_i8(i8 %a) {
9 ; RV32I-LABEL: name: test_args_i8
11 ; RV32I-NEXT: liveins: $x10
13 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
14 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
15 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
16 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s8) = G_ADD [[TRUNC]], [[C]]
17 ; RV32I-NEXT: PseudoRET
18 ; RV64I-LABEL: name: test_args_i8
20 ; RV64I-NEXT: liveins: $x10
22 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
23 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s64)
24 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s8) = G_CONSTANT i8 1
25 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s8) = G_ADD [[TRUNC]], [[C]]
26 ; RV64I-NEXT: PseudoRET
32 define void @test_args_i16(i16 %a) {
34 ; RV32I-LABEL: name: test_args_i16
36 ; RV32I-NEXT: liveins: $x10
38 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
39 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
40 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
41 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s16) = G_ADD [[TRUNC]], [[C]]
42 ; RV32I-NEXT: PseudoRET
43 ; RV64I-LABEL: name: test_args_i16
45 ; RV64I-NEXT: liveins: $x10
47 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
48 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s64)
49 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s16) = G_CONSTANT i16 1
50 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s16) = G_ADD [[TRUNC]], [[C]]
51 ; RV64I-NEXT: PseudoRET
57 define void @test_args_i32(i32 %a) {
59 ; RV32I-LABEL: name: test_args_i32
61 ; RV32I-NEXT: liveins: $x10
63 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
64 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
65 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[C]]
66 ; RV32I-NEXT: PseudoRET
67 ; RV64I-LABEL: name: test_args_i32
69 ; RV64I-NEXT: liveins: $x10
71 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
72 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
73 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s32) = G_CONSTANT i32 1
74 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[C]]
75 ; RV64I-NEXT: PseudoRET
81 define void @test_args_i64(i64 %a) {
83 ; RV32I-LABEL: name: test_args_i64
85 ; RV32I-NEXT: liveins: $x10, $x11
87 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
88 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
89 ; RV32I-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
90 ; RV32I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
91 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MV]], [[C]]
92 ; RV32I-NEXT: PseudoRET
93 ; RV64I-LABEL: name: test_args_i64
95 ; RV64I-NEXT: liveins: $x10
97 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
98 ; RV64I-NEXT: [[C:%[0-9]+]]:_(s64) = G_CONSTANT i64 1
99 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[C]]
100 ; RV64I-NEXT: PseudoRET
106 define void @test_args_i8_ptr(ptr %a) {
108 ; RV32I-LABEL: name: test_args_i8_ptr
110 ; RV32I-NEXT: liveins: $x10
112 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
113 ; RV32I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.a)
114 ; RV32I-NEXT: PseudoRET
115 ; RV64I-LABEL: name: test_args_i8_ptr
117 ; RV64I-NEXT: liveins: $x10
119 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
120 ; RV64I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.a)
121 ; RV64I-NEXT: PseudoRET
127 define void @test_args_2xi8(i8 %a, i8 %b) {
129 ; RV32I-LABEL: name: test_args_2xi8
131 ; RV32I-NEXT: liveins: $x10, $x11
133 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
134 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s32)
135 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
136 ; RV32I-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s32)
137 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s8) = G_ADD [[TRUNC]], [[TRUNC1]]
138 ; RV32I-NEXT: PseudoRET
139 ; RV64I-LABEL: name: test_args_2xi8
141 ; RV64I-NEXT: liveins: $x10, $x11
143 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
144 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s8) = G_TRUNC [[COPY]](s64)
145 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
146 ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:_(s8) = G_TRUNC [[COPY1]](s64)
147 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s8) = G_ADD [[TRUNC]], [[TRUNC1]]
148 ; RV64I-NEXT: PseudoRET
154 define void @test_args_2xi16(i16 %a, i16 %b) {
156 ; RV32I-LABEL: name: test_args_2xi16
158 ; RV32I-NEXT: liveins: $x10, $x11
160 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
161 ; RV32I-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s32)
162 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
163 ; RV32I-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s32)
164 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s16) = G_ADD [[TRUNC]], [[TRUNC1]]
165 ; RV32I-NEXT: PseudoRET
166 ; RV64I-LABEL: name: test_args_2xi16
168 ; RV64I-NEXT: liveins: $x10, $x11
170 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
171 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s16) = G_TRUNC [[COPY]](s64)
172 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
173 ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:_(s16) = G_TRUNC [[COPY1]](s64)
174 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s16) = G_ADD [[TRUNC]], [[TRUNC1]]
175 ; RV64I-NEXT: PseudoRET
181 define void @test_args_2xi32(i32 %a, i32 %b) {
183 ; RV32I-LABEL: name: test_args_2xi32
185 ; RV32I-NEXT: liveins: $x10, $x11
187 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
188 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
189 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[COPY]], [[COPY1]]
190 ; RV32I-NEXT: PseudoRET
191 ; RV64I-LABEL: name: test_args_2xi32
193 ; RV64I-NEXT: liveins: $x10, $x11
195 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
196 ; RV64I-NEXT: [[TRUNC:%[0-9]+]]:_(s32) = G_TRUNC [[COPY]](s64)
197 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
198 ; RV64I-NEXT: [[TRUNC1:%[0-9]+]]:_(s32) = G_TRUNC [[COPY1]](s64)
199 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s32) = G_ADD [[TRUNC]], [[TRUNC1]]
200 ; RV64I-NEXT: PseudoRET
206 define void @test_args_2xi64(i64 %a, i64 %b) {
208 ; RV32I-LABEL: name: test_args_2xi64
210 ; RV32I-NEXT: liveins: $x10, $x11, $x12, $x13
212 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(s32) = COPY $x10
213 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(s32) = COPY $x11
214 ; RV32I-NEXT: [[MV:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY]](s32), [[COPY1]](s32)
215 ; RV32I-NEXT: [[COPY2:%[0-9]+]]:_(s32) = COPY $x12
216 ; RV32I-NEXT: [[COPY3:%[0-9]+]]:_(s32) = COPY $x13
217 ; RV32I-NEXT: [[MV1:%[0-9]+]]:_(s64) = G_MERGE_VALUES [[COPY2]](s32), [[COPY3]](s32)
218 ; RV32I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[MV]], [[MV1]]
219 ; RV32I-NEXT: PseudoRET
220 ; RV64I-LABEL: name: test_args_2xi64
222 ; RV64I-NEXT: liveins: $x10, $x11
224 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(s64) = COPY $x10
225 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(s64) = COPY $x11
226 ; RV64I-NEXT: [[ADD:%[0-9]+]]:_(s64) = G_ADD [[COPY]], [[COPY1]]
227 ; RV64I-NEXT: PseudoRET
233 define void @test_args_2xi8_ptr(ptr %a, ptr %b) {
235 ; RV32I-LABEL: name: test_args_2xi8_ptr
237 ; RV32I-NEXT: liveins: $x10, $x11
239 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
240 ; RV32I-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
241 ; RV32I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.a)
242 ; RV32I-NEXT: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[COPY1]](p0) :: (load (s8) from %ir.b)
243 ; RV32I-NEXT: PseudoRET
244 ; RV64I-LABEL: name: test_args_2xi8_ptr
246 ; RV64I-NEXT: liveins: $x10, $x11
248 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
249 ; RV64I-NEXT: [[COPY1:%[0-9]+]]:_(p0) = COPY $x11
250 ; RV64I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (load (s8) from %ir.a)
251 ; RV64I-NEXT: [[LOAD1:%[0-9]+]]:_(s8) = G_LOAD [[COPY1]](p0) :: (load (s8) from %ir.b)
252 ; RV64I-NEXT: PseudoRET
259 define void @test_args_ptr_byval(ptr byval(i8) %a) {
260 ; RV32I-LABEL: name: test_args_ptr_byval
262 ; RV32I-NEXT: liveins: $x10
264 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
265 ; RV32I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (dereferenceable load (s8) from %ir.a)
266 ; RV32I-NEXT: PseudoRET
267 ; RV64I-LABEL: name: test_args_ptr_byval
269 ; RV64I-NEXT: liveins: $x10
271 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
272 ; RV64I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (dereferenceable load (s8) from %ir.a)
273 ; RV64I-NEXT: PseudoRET
279 define void @test_args_ptr_sret(ptr sret(i8) %a) {
280 ; RV32I-LABEL: name: test_args_ptr_sret
282 ; RV32I-NEXT: liveins: $x10
284 ; RV32I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
285 ; RV32I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (dereferenceable load (s8) from %ir.a)
286 ; RV32I-NEXT: PseudoRET
287 ; RV64I-LABEL: name: test_args_ptr_sret
289 ; RV64I-NEXT: liveins: $x10
291 ; RV64I-NEXT: [[COPY:%[0-9]+]]:_(p0) = COPY $x10
292 ; RV64I-NEXT: [[LOAD:%[0-9]+]]:_(s8) = G_LOAD [[COPY]](p0) :: (dereferenceable load (s8) from %ir.a)
293 ; RV64I-NEXT: PseudoRET