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)
250 ; CHECK: [[T2:%[0-9]+]]:_(s64) = G_ANYEXT [[T1]]
251 ; CHECK: $x0 = COPY [[T2]](s64)
252 ; CHECK: $w1 = COPY [[T1]](s32)
254 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
255 %2:_(s64) = G_ANYEXT %1
256 %3:_(s32) = G_SEXT %1
262 name: test_1anyext32_1signext64
266 ; CHECK-LABEL: name: test_1anyext32_1signext64
267 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
268 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
269 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
270 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
271 ; CHECK: $w0 = COPY [[T3]](s32)
272 ; CHECK: $x1 = COPY [[T1]](s64)
274 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
275 %2:_(s32) = G_ANYEXT %1
276 %3:_(s64) = G_SEXT %1
282 name: test_2anyext32_1signext64
286 ; CHECK-LABEL: name: test_2anyext32_1signext64
287 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
288 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
289 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
290 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
291 ; CHECK: [[T5:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
292 ; CHECK: $w0 = COPY [[T3]](s32)
293 ; CHECK: $x1 = COPY [[T1]](s64)
294 ; CHECK: $w2 = COPY [[T5]](s32)
296 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
297 %2:_(s32) = G_ANYEXT %1
298 %3:_(s64) = G_SEXT %1
299 %4:_(s32) = G_ANYEXT %1
306 name: test_multiblock_anyext
310 ; CHECK-LABEL: name: test_multiblock_anyext
311 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
312 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
314 ; CHECK: $w0 = COPY [[T1]](s32)
316 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
319 %2:_(s32) = G_ANYEXT %1
324 name: test_multiblock_signext
328 ; CHECK-LABEL: name: test_multiblock_signext
329 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
330 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
331 ; CHECK: $w0 = COPY [[T1]](s32)
333 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
336 %2:_(s32) = G_SEXT %1
341 name: test_multiblock_zeroext
345 ; CHECK-LABEL: name: test_multiblock_zeroext
346 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
347 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_ZEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
348 ; CHECK: $w0 = COPY [[T1]](s32)
350 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
353 %2:_(s32) = G_ZEXT %1
358 name: test_multiblock_2anyext
362 ; CHECK-LABEL: name: test_multiblock
363 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
364 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_LOAD [[T0]](p0) :: (load 1 from %ir.addr)
365 ; CHECK: $w0 = COPY [[T1]](s32)
366 ; CHECK: $w1 = COPY [[T1]](s32)
368 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
369 %2:_(s32) = G_ANYEXT %1
372 %3:_(s32) = G_ANYEXT %1
378 name: test_multiblock_1anyext64_1signext32
382 ; CHECK-LABEL: name: test_multiblock_1anyext64_1signext32
383 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
384 ; CHECK: [[T1:%[0-9]+]]:_(s32) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
386 ; CHECK: [[T2:%[0-9]+]]:_(s64) = G_ANYEXT [[T1]]
387 ; CHECK: $x0 = COPY [[T2]](s64)
388 ; CHECK: $w1 = COPY [[T1]](s32)
390 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
393 %2:_(s64) = G_ANYEXT %1
394 %3:_(s32) = G_SEXT %1
400 name: test_multiblock_1anyext32_1signext64
404 ; CHECK-LABEL: name: test_multiblock_1anyext32_1signext64
405 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
406 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
408 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
409 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
410 ; CHECK: $w0 = COPY [[T3]](s32)
411 ; CHECK: $x1 = COPY [[T1]](s64)
413 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
416 %2:_(s32) = G_ANYEXT %1
417 %3:_(s64) = G_SEXT %1
423 name: test_multiblock_2anyext32_1signext64
427 ; CHECK-LABEL: name: test_multiblock_2anyext32_1signext64
428 ; CHECK: [[T0:%[0-9]+]]:_(p0) = COPY $x0
429 ; CHECK: [[T1:%[0-9]+]]:_(s64) = G_SEXTLOAD [[T0]](p0) :: (load 1 from %ir.addr)
430 ; CHECK: [[T2:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
431 ; CHECK: [[T3:%[0-9]+]]:_(s32) = G_ANYEXT [[T2]]
433 ; CHECK: [[T4:%[0-9]+]]:_(s8) = G_TRUNC [[T1]]
434 ; CHECK: [[T5:%[0-9]+]]:_(s32) = G_ANYEXT [[T4]]
435 ; CHECK: $w0 = COPY [[T5]](s32)
436 ; CHECK: $x1 = COPY [[T1]](s64)
437 ; CHECK: $w2 = COPY [[T3]](s32)
439 %1:_(s8) = G_LOAD %0 :: (load 1 from %ir.addr)
440 %4:_(s32) = G_ANYEXT %1
443 %2:_(s32) = G_ANYEXT %1
444 %3:_(s64) = G_SEXT %1