[llvm] 617cfed - [AArch64] Generate check lines for GlobalISel in test.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed May 28 08:59:59 PDT 2025
Author: Florian Hahn
Date: 2025-05-28T16:59:27+01:00
New Revision: 617cfedc43ae93960633909c00feed5345eeac6a
URL: https://github.com/llvm/llvm-project/commit/617cfedc43ae93960633909c00feed5345eeac6a
DIFF: https://github.com/llvm/llvm-project/commit/617cfedc43ae93960633909c00feed5345eeac6a.diff
LOG: [AArch64] Generate check lines for GlobalISel in test.
Add GlobalISel test coverage for
https://github.com/llvm/llvm-project/pull/139736.
Added:
Modified:
llvm/test/CodeGen/AArch64/switch-cases-to-branch-and.ll
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/AArch64/switch-cases-to-branch-and.ll b/llvm/test/CodeGen/AArch64/switch-cases-to-branch-and.ll
index 04d4ce8493e1b..4d36a003cbfe4 100644
--- a/llvm/test/CodeGen/AArch64/switch-cases-to-branch-and.ll
+++ b/llvm/test/CodeGen/AArch64/switch-cases-to-branch-and.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
; RUN: llc -O3 -mtriple=arm64-apple-macosx -o - %s | FileCheck %s
+; RUN: llc -O3 -mtriple=arm64-apple-macosx -global-isel -o - %s | FileCheck --check-prefix=GISEL %s
define i32 @switch_with_matching_dests_0_and_pow2_3_cases(i8 %v) {
; CHECK-LABEL: switch_with_matching_dests_0_and_pow2_3_cases:
@@ -30,6 +31,33 @@ define i32 @switch_with_matching_dests_0_and_pow2_3_cases(i8 %v) {
; CHECK-NEXT: LBB0_7: ; %e2
; CHECK-NEXT: mov w0, #30 ; =0x1e
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_with_matching_dests_0_and_pow2_3_cases:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, w0
+; GISEL-NEXT: mov w0, #20 ; =0x14
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: LBB0_1: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ands w10, w8, #0xff
+; GISEL-NEXT: b.eq LBB0_5
+; GISEL-NEXT: ; %bb.2: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB0_1 Depth=1
+; GISEL-NEXT: cmp w10, #32
+; GISEL-NEXT: b.eq LBB0_5
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB0_1 Depth=1
+; GISEL-NEXT: cmp w10, #124
+; GISEL-NEXT: b.eq LBB0_6
+; GISEL-NEXT: ; %bb.4: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB0_1 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.ne LBB0_1
+; GISEL-NEXT: LBB0_5: ; %common.ret
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB0_6: ; %e2
+; GISEL-NEXT: mov w0, #30 ; =0x1e
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -82,6 +110,35 @@ define i32 @switch_with_matching_dests_0_and_pow2_3_cases_swapped(i8 %v) {
; CHECK-NEXT: LBB1_7: ; %e2
; CHECK-NEXT: mov w0, #30 ; =0x1e
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_with_matching_dests_0_and_pow2_3_cases_swapped:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: mov w8, #20 ; =0x14
+; GISEL-NEXT: LBB1_1: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ands w10, w0, #0xff
+; GISEL-NEXT: b.eq LBB1_6
+; GISEL-NEXT: ; %bb.2: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB1_1 Depth=1
+; GISEL-NEXT: cmp w10, #32
+; GISEL-NEXT: b.eq LBB1_6
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB1_1 Depth=1
+; GISEL-NEXT: cmp w10, #124
+; GISEL-NEXT: b.eq LBB1_7
+; GISEL-NEXT: ; %bb.4: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB1_1 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.ne LBB1_1
+; GISEL-NEXT: ; %bb.5:
+; GISEL-NEXT: mov w8, #10 ; =0xa
+; GISEL-NEXT: LBB1_6: ; %common.ret
+; GISEL-NEXT: mov w0, w8
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB1_7: ; %e2
+; GISEL-NEXT: mov w0, #30 ; =0x1e
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -142,6 +199,38 @@ define i32 @switch_with_matching_dests_0_and_pow2_3_cases_with_phi(i8 %v, i1 %c)
; CHECK-NEXT: LBB2_9: ; %e2
; CHECK-NEXT: mov w0, #30 ; =0x1e
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_with_matching_dests_0_and_pow2_3_cases_with_phi:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, wzr
+; GISEL-NEXT: tbz w1, #0, LBB2_7
+; GISEL-NEXT: ; %bb.1: ; %loop.header.preheader
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: mov w8, #20 ; =0x14
+; GISEL-NEXT: LBB2_2: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ands w10, w0, #0xff
+; GISEL-NEXT: b.eq LBB2_7
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB2_2 Depth=1
+; GISEL-NEXT: cmp w10, #32
+; GISEL-NEXT: b.eq LBB2_7
+; GISEL-NEXT: ; %bb.4: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB2_2 Depth=1
+; GISEL-NEXT: cmp w10, #124
+; GISEL-NEXT: b.eq LBB2_8
+; GISEL-NEXT: ; %bb.5: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB2_2 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.ne LBB2_2
+; GISEL-NEXT: ; %bb.6:
+; GISEL-NEXT: mov w8, #10 ; =0xa
+; GISEL-NEXT: LBB2_7: ; %common.ret
+; GISEL-NEXT: mov w0, w8
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB2_8: ; %e2
+; GISEL-NEXT: mov w0, #30 ; =0x1e
+; GISEL-NEXT: ret
entry:
br i1 %c, label %then, label %e1
@@ -204,6 +293,38 @@ define i32 @switch_with_matching_dests_0_and_pow2_3_cases_all_
diff erent_succs(i8
; CHECK-NEXT: LBB3_8:
; CHECK-NEXT: mov w0, #20 ; =0x14
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_with_matching_dests_0_and_pow2_3_cases_all_
diff erent_succs:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, #100 ; =0x64
+; GISEL-NEXT: LBB3_1: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ands w9, w0, #0xff
+; GISEL-NEXT: b.eq LBB3_6
+; GISEL-NEXT: ; %bb.2: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB3_1 Depth=1
+; GISEL-NEXT: cmp w9, #32
+; GISEL-NEXT: b.eq LBB3_8
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB3_1 Depth=1
+; GISEL-NEXT: cmp w9, #124
+; GISEL-NEXT: b.eq LBB3_7
+; GISEL-NEXT: ; %bb.4: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB3_1 Depth=1
+; GISEL-NEXT: subs w8, w8, #1
+; GISEL-NEXT: b.ne LBB3_1
+; GISEL-NEXT: ; %bb.5:
+; GISEL-NEXT: mov w0, #10 ; =0xa
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB3_6: ; %e2
+; GISEL-NEXT: mov w0, #30 ; =0x1e
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB3_7: ; %e3
+; GISEL-NEXT: mov w0, #40 ; =0x28
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB3_8:
+; GISEL-NEXT: mov w0, #20 ; =0x14
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -255,6 +376,28 @@ define i32 @switch_in_loop_with_matching_dests_0_and_pow2_3_cases(ptr %start) {
; CHECK-NEXT: LBB4_5: ; %e2.loopexit
; CHECK-NEXT: mov w0, wzr
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_in_loop_with_matching_dests_0_and_pow2_3_cases:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: add x8, x0, #1
+; GISEL-NEXT: LBB4_1: ; %loop
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ldrb w9, [x8], #1
+; GISEL-NEXT: cbz w9, LBB4_4
+; GISEL-NEXT: ; %bb.2: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB4_1 Depth=1
+; GISEL-NEXT: cmp w9, #124
+; GISEL-NEXT: b.eq LBB4_5
+; GISEL-NEXT: ; %bb.3: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB4_1 Depth=1
+; GISEL-NEXT: cmp w9, #32
+; GISEL-NEXT: b.ne LBB4_1
+; GISEL-NEXT: LBB4_4: ; %e1
+; GISEL-NEXT: mov w0, #-1 ; =0xffffffff
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB4_5: ; %e2.loopexit
+; GISEL-NEXT: mov w0, wzr
+; GISEL-NEXT: ret
entry:
br label %loop
@@ -304,6 +447,34 @@ define i32 @switch_in_loop_with_matching_dests_0_and_pow2_4_cases(ptr %start) {
; CHECK-NEXT: LBB5_5: ; %e2.loopexit
; CHECK-NEXT: mov w0, wzr
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_in_loop_with_matching_dests_0_and_pow2_4_cases:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov x10, #32769 ; =0x8001
+; GISEL-NEXT: mov w8, #1 ; =0x1
+; GISEL-NEXT: add x9, x0, #1
+; GISEL-NEXT: movk x10, #1, lsl #32
+; GISEL-NEXT: b LBB5_2
+; GISEL-NEXT: LBB5_1: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB5_2 Depth=1
+; GISEL-NEXT: cmp w11, #124
+; GISEL-NEXT: b.eq LBB5_5
+; GISEL-NEXT: LBB5_2: ; %loop
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ldrb w11, [x9], #1
+; GISEL-NEXT: cmp w11, #32
+; GISEL-NEXT: b.hi LBB5_1
+; GISEL-NEXT: ; %bb.3: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB5_2 Depth=1
+; GISEL-NEXT: lsl x12, x8, x11
+; GISEL-NEXT: tst x12, x10
+; GISEL-NEXT: b.eq LBB5_1
+; GISEL-NEXT: ; %bb.4: ; %e1
+; GISEL-NEXT: mov w0, #-1 ; =0xffffffff
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB5_5: ; %e2.loopexit
+; GISEL-NEXT: mov w0, wzr
+; GISEL-NEXT: ret
entry:
br label %loop
@@ -348,6 +519,28 @@ define i32 @switch_in_loop_with_matching_dests_0_and_non_pow2(ptr %start) {
; CHECK-NEXT: LBB6_5: ; %e2
; CHECK-NEXT: mov w0, #10 ; =0xa
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: switch_in_loop_with_matching_dests_0_and_non_pow2:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: add x8, x0, #1
+; GISEL-NEXT: LBB6_1: ; %loop
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ldrb w9, [x8], #1
+; GISEL-NEXT: cmp w9, #35
+; GISEL-NEXT: b.eq LBB6_4
+; GISEL-NEXT: ; %bb.2: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB6_1 Depth=1
+; GISEL-NEXT: cmp w9, #33
+; GISEL-NEXT: b.eq LBB6_5
+; GISEL-NEXT: ; %bb.3: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB6_1 Depth=1
+; GISEL-NEXT: cbnz w9, LBB6_1
+; GISEL-NEXT: LBB6_4: ; %common.ret.loopexit
+; GISEL-NEXT: mov w0, #-1 ; =0xffffffff
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB6_5: ; %e2
+; GISEL-NEXT: mov w0, #10 ; =0xa
+; GISEL-NEXT: ret
entry:
br label %loop
@@ -381,6 +574,22 @@ define void @test_successor_with_loop_phi(ptr %A, ptr %B) {
; CHECK-NEXT: b.eq LBB7_1
; CHECK-NEXT: ; %bb.2: ; %exit
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: test_successor_with_loop_phi:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: LBB7_1: ; %loop
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: ldr w8, [x0]
+; GISEL-NEXT: str wzr, [x0]
+; GISEL-NEXT: mov x0, x1
+; GISEL-NEXT: cbz w8, LBB7_1
+; GISEL-NEXT: ; %bb.2: ; %loop
+; GISEL-NEXT: ; in Loop: Header=BB7_1 Depth=1
+; GISEL-NEXT: cmp w8, #4
+; GISEL-NEXT: mov x0, x1
+; GISEL-NEXT: b.eq LBB7_1
+; GISEL-NEXT: ; %bb.3: ; %exit
+; GISEL-NEXT: ret
entry:
br label %loop
@@ -423,6 +632,32 @@ define i64 @consecutive_match_both(ptr %p, i32 %param) {
; CHECK-NEXT: LBB8_5:
; CHECK-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: consecutive_match_both:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, #1 ; =0x1
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: mov w10, #249 ; =0xf9
+; GISEL-NEXT: lsl w8, w8, w1
+; GISEL-NEXT: b LBB8_2
+; GISEL-NEXT: LBB8_1: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB8_2 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.eq LBB8_5
+; GISEL-NEXT: LBB8_2: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: cmp w1, #7
+; GISEL-NEXT: b.hi LBB8_1
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB8_2 Depth=1
+; GISEL-NEXT: tst w8, w10
+; GISEL-NEXT: b.eq LBB8_1
+; GISEL-NEXT: ; %bb.4: ; %e0
+; GISEL-NEXT: mov x0, xzr
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB8_5:
+; GISEL-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -477,6 +712,32 @@ define i64 @consecutive_match_before(ptr %p, i32 %param) {
; CHECK-NEXT: LBB9_5:
; CHECK-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: consecutive_match_before:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, #1 ; =0x1
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: mov w10, #25 ; =0x19
+; GISEL-NEXT: lsl w8, w8, w1
+; GISEL-NEXT: b LBB9_2
+; GISEL-NEXT: LBB9_1: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB9_2 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.eq LBB9_5
+; GISEL-NEXT: LBB9_2: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: cmp w1, #4
+; GISEL-NEXT: b.hi LBB9_1
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB9_2 Depth=1
+; GISEL-NEXT: tst w8, w10
+; GISEL-NEXT: b.eq LBB9_1
+; GISEL-NEXT: ; %bb.4: ; %e0
+; GISEL-NEXT: mov x0, xzr
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB9_5:
+; GISEL-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -528,6 +789,32 @@ define i64 @consecutive_match_after(ptr %p, i32 %param) {
; CHECK-NEXT: LBB10_5:
; CHECK-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: consecutive_match_after:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: mov w8, #1 ; =0x1
+; GISEL-NEXT: mov w9, #100 ; =0x64
+; GISEL-NEXT: mov w10, #49 ; =0x31
+; GISEL-NEXT: lsl w8, w8, w1
+; GISEL-NEXT: b LBB10_2
+; GISEL-NEXT: LBB10_1: ; %loop.latch
+; GISEL-NEXT: ; in Loop: Header=BB10_2 Depth=1
+; GISEL-NEXT: subs w9, w9, #1
+; GISEL-NEXT: b.eq LBB10_5
+; GISEL-NEXT: LBB10_2: ; %loop.header
+; GISEL-NEXT: ; =>This Inner Loop Header: Depth=1
+; GISEL-NEXT: cmp w1, #5
+; GISEL-NEXT: b.hi LBB10_1
+; GISEL-NEXT: ; %bb.3: ; %loop.header
+; GISEL-NEXT: ; in Loop: Header=BB10_2 Depth=1
+; GISEL-NEXT: tst w8, w10
+; GISEL-NEXT: b.eq LBB10_1
+; GISEL-NEXT: ; %bb.4: ; %e0
+; GISEL-NEXT: mov x0, xzr
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB10_5:
+; GISEL-NEXT: mov x0, #-42 ; =0xffffffffffffffd6
+; GISEL-NEXT: ret
entry:
br label %loop.header
@@ -573,6 +860,26 @@ define void @merge_with_stores(ptr %A, i16 %v) {
; CHECK-NEXT: strh w8, [x0, #36]
; CHECK-NEXT: LBB11_5: ; %pow2.dst
; CHECK-NEXT: ret
+;
+; GISEL-LABEL: merge_with_stores:
+; GISEL: ; %bb.0: ; %entry
+; GISEL-NEXT: and w8, w1, #0xffff
+; GISEL-NEXT: sub w9, w8, #10
+; GISEL-NEXT: cmp w9, #1
+; GISEL-NEXT: b.ls LBB11_4
+; GISEL-NEXT: ; %bb.1: ; %entry
+; GISEL-NEXT: cbz w8, LBB11_5
+; GISEL-NEXT: ; %bb.2: ; %entry
+; GISEL-NEXT: cmp w8, #2
+; GISEL-NEXT: b.eq LBB11_5
+; GISEL-NEXT: ; %bb.3: ; %default.dst
+; GISEL-NEXT: strh wzr, [x0]
+; GISEL-NEXT: ret
+; GISEL-NEXT: LBB11_4: ; %other.dst
+; GISEL-NEXT: mov w8, #1 ; =0x1
+; GISEL-NEXT: strh w8, [x0, #36]
+; GISEL-NEXT: LBB11_5: ; %pow2.dst
+; GISEL-NEXT: ret
entry:
switch i16 %v, label %default.dst [
i16 10, label %other.dst
More information about the llvm-commits
mailing list