1 # RUN: llc -O0 -run-pass=aarch64-prelegalizer-combiner -global-isel -verify-machineinstrs %s -o - | FileCheck %s
4 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
5 target triple = "aarch64--"
6 define void @test_anyext(i8* %addr) {
10 define void @test_anyext_with_copy(i8* %addr) {
14 define void @test_signext(i8* %addr) {
18 define void @test_zeroext(i8* %addr) {
22 define void @test_2anyext(i8* %addr) {
26 define void @test_1anyext_1signext(i8* %addr) {
30 define void @test_1xor_1signext(i8* %addr) {
34 define void @test_1anyext_1zeroext(i8* %addr) {
38 define void @test_1signext_1zeroext(i8* %addr) {
42 define void @test_1anyext64_1signext32(i8* %addr) {
46 define void @test_1anyext32_1signext64(i8* %addr) {
50 define void @test_2anyext32_1signext64(i8* %addr) {
54 define void @test_multiblock_anyext(i8* %addr) {
58 define void @test_multiblock_signext(i8* %addr) {
62 define void @test_multiblock_zeroext(i8* %addr) {
66 define void @test_multiblock_2anyext(i8* %addr) {
70 define void @test_multiblock_1anyext64_1signext32(i8* %addr) {
74 define void @test_multiblock_1anyext32_1signext64(i8* %addr) {
78 define void @test_multiblock_2anyext32_1signext64(i8* %addr) {
89 ; CHECK-LABEL: name: test_anyext
90 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
91 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
92 ; CHECK: $w0 = COPY [[T1]](s32)
94 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
95 %2:_(s32) = G_ANYEXT %1
100 name: test_anyext_with_copy
104 ; CHECK-LABEL: name: test_anyext
105 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
106 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
107 ; CHECK: $w0 = COPY [[T1]](s32)
109 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
111 %3:_(s32) = G_ANYEXT %1
120 ; CHECK-LABEL: name: test_signext
121 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
122 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
123 ; CHECK: $w0 = COPY [[T1]](s32)
125 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
126 %2:_(s32) = G_SEXT %1
135 ; CHECK-LABEL: name: test_zeroext
136 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
137 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
138 ; CHECK: $w0 = COPY [[T1]](s32)
140 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
141 %2:_(s32) = G_ZEXT %1
150 ; CHECK-LABEL: name: test_2anyext
151 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
152 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
153 ; CHECK: $w0 = COPY [[T1]](s32)
154 ; CHECK: $w1 = COPY [[T1]](s32)
156 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
157 %2:_(s32) = G_ANYEXT %1
158 %3:_(s32) = G_ANYEXT %1
164 name: test_1anyext_1signext
168 ; CHECK-LABEL: name: test_1anyext_1signext
169 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
170 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
171 ; CHECK: $w0 = COPY [[T1]](s32)
172 ; CHECK: $w1 = COPY [[T1]](s32)
174 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
175 %2:_(s32) = G_ANYEXT %1
176 %3:_(s32) = G_SEXT %1
182 name: test_1xor_1signext
186 ; CHECK-LABEL: name: test_1xor_1signext
187 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
188 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
189 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
190 ; CHECK: [[T3:%[0-9]+]]:_(s8) = G_XOR [[T2]], {{%[0-9]+}}
191 ; CHECK: [[T4:%[0-9]+]]:_(s32) = G_ANYEXT [[T3]]
192 ; CHECK: $w0 = COPY [[T4]](s32)
193 ; CHECK: $w1 = COPY [[T1]](s32)
195 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
196 %2:_(s8) = G_CONSTANT i8 -1
197 %3:_(s8) = G_XOR %1, %2
198 %5:_(s32) = G_ANYEXT %3
199 %6:_(s32) = G_SEXT %1
205 name: test_1anyext_1zeroext
209 ; CHECK-LABEL: name: test_1anyext_1zeroext
210 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
211 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
212 ; CHECK: $w0 = COPY [[T1]](s32)
213 ; CHECK: $w1 = COPY [[T1]](s32)
215 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
216 %2:_(s32) = G_ANYEXT %1
217 %3:_(s32) = G_ZEXT %1
223 name: test_1signext_1zeroext
227 ; CHECK-LABEL: name: test_1signext_1zeroext
228 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
229 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
230 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
231 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ZEXT [[T2]]
232 ; CHECK: $w0 = COPY [[T3]](s32)
233 ; CHECK: $w1 = COPY [[T1]](s32)
235 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
236 %2:_(s32) = G_ZEXT %1
237 %3:_(s32) = G_SEXT %1
243 name: test_1anyext64_1signext32
247 ; CHECK-LABEL: name: test_1anyext64_1signext32
248 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
249 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
251 ; CHECK: [[T2:%[0-9]+]]:_(s64) = G_ANYEXT [[T1]]
253 ; CHECK: $x0 = COPY [[T2]](s64)
254 ; CHECK: $w1 = COPY [[T1]](s32)
256 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
257 %2:_(s64) = G_ANYEXT %1
258 %3:_(s32) = G_SEXT %1
264 name: test_1anyext32_1signext64
268 ; CHECK-LABEL: name: test_1anyext32_1signext64
269 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
270 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
271 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
272 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
273 ; CHECK: $w0 = COPY [[T3]](s32)
274 ; CHECK: $x1 = COPY [[T1]](s64)
276 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
277 %2:_(s32) = G_ANYEXT %1
278 %3:_(s64) = G_SEXT %1
284 name: test_2anyext32_1signext64
288 ; CHECK-LABEL: name: test_2anyext32_1signext64
289 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
290 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
291 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
292 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
293 ; CHECK: [[T5:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
294 ; CHECK: $w0 = COPY [[T3]](s32)
295 ; CHECK: $x1 = COPY [[T1]](s64)
296 ; CHECK: $w2 = COPY [[T5]](s32)
298 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
299 %2:_(s32) = G_ANYEXT %1
300 %3:_(s64) = G_SEXT %1
301 %4:_(s32) = G_ANYEXT %1
308 name: test_multiblock_anyext
312 ; CHECK-LABEL: name: test_multiblock_anyext
313 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
314 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
316 ; CHECK: $w0 = COPY [[T1]](s32)
318 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
321 %2:_(s32) = G_ANYEXT %1
326 name: test_multiblock_signext
330 ; CHECK-LABEL: name: test_multiblock_signext
331 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
332 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
333 ; CHECK: $w0 = COPY [[T1]](s32)
335 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
338 %2:_(s32) = G_SEXT %1
343 name: test_multiblock_zeroext
347 ; CHECK-LABEL: name: test_multiblock_zeroext
348 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
349 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
350 ; CHECK: $w0 = COPY [[T1]](s32)
352 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
355 %2:_(s32) = G_ZEXT %1
360 name: test_multiblock_2anyext
364 ; CHECK-LABEL: name: test_multiblock
365 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
366 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
367 ; CHECK: $w0 = COPY [[T1]](s32)
368 ; CHECK: $w1 = COPY [[T1]](s32)
370 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
371 %2:_(s32) = G_ANYEXT %1
374 %3:_(s32) = G_ANYEXT %1
380 name: test_multiblock_1anyext64_1signext32
384 ; CHECK-LABEL: name: test_multiblock_1anyext64_1signext32
385 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
386 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
388 ; CHECK: [[T2:%[0-9]+]]:_(s64) = G_ANYEXT [[T1]]
389 ; CHECK: $x0 = COPY [[T2]](s64)
390 ; CHECK: $w1 = COPY [[T1]](s32)
392 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
395 %2:_(s64) = G_ANYEXT %1
396 %3:_(s32) = G_SEXT %1
402 name: test_multiblock_1anyext32_1signext64
406 ; CHECK-LABEL: name: test_multiblock_1anyext32_1signext64
407 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
408 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
410 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
411 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
412 ; CHECK: $w0 = COPY [[T3]](s32)
413 ; CHECK: $x1 = COPY [[T1]](s64)
415 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
418 %2:_(s32) = G_ANYEXT %1
419 %3:_(s64) = G_SEXT %1
425 name: test_multiblock_2anyext32_1signext64
429 ; CHECK-LABEL: name: test_multiblock_2anyext32_1signext64
430 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
431 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
432 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
433 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
435 ; CHECK: [[T4:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
436 ; CHECK: [[T5:%[0-9]+]]:_(s32) = G_ANYEXT [[T4]]
437 ; CHECK: $w0 = COPY [[T5]](s32)
438 ; CHECK: $x1 = COPY [[T1]](s64)
439 ; CHECK: $w2 = COPY [[T3]](s32)
441 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
442 %4:_(s32) = G_ANYEXT %1
445 %2:_(s32) = G_ANYEXT %1
446 %3:_(s64) = G_SEXT %1