[llvm] b72fa04 - [AArch64][GlobalISel] Add test coverage for more adc / ands instructions. NFC

David Green via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 30 23:35:19 PDT 2025


Author: David Green
Date: 2025-07-31T07:35:13+01:00
New Revision: b72fa04105709fe6cc630c09639acdc72ad31d6b

URL: https://github.com/llvm/llvm-project/commit/b72fa04105709fe6cc630c09639acdc72ad31d6b
DIFF: https://github.com/llvm/llvm-project/commit/b72fa04105709fe6cc630c09639acdc72ad31d6b.diff

LOG: [AArch64][GlobalISel] Add test coverage for more adc / ands instructions. NFC

Added: 
    

Modified: 
    llvm/test/CodeGen/AArch64/adc.ll
    llvm/test/CodeGen/AArch64/addcarry-crash.ll
    llvm/test/CodeGen/AArch64/arm64-vabs.ll
    llvm/test/CodeGen/AArch64/peephole-and-tst.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/AArch64/adc.ll b/llvm/test/CodeGen/AArch64/adc.ll
index 4b1393ffc624a..12e8bf26c9eac 100644
--- a/llvm/test/CodeGen/AArch64/adc.ll
+++ b/llvm/test/CodeGen/AArch64/adc.ll
@@ -1,6 +1,7 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 | FileCheck --check-prefix=CHECK-LE %s
-; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64_be-none-linux-gnu | FileCheck --check-prefix=CHECK-BE %s
+; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 | FileCheck --check-prefixes=CHECK-LE %s
+; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64_be-none-linux-gnu | FileCheck --check-prefixes=CHECK-BE %s
+; RUN: llc -verify-machineinstrs < %s -mtriple=arm64-apple-ios7.0 -global-isel | FileCheck --check-prefixes=CHECK-GI %s
 
 define i128 @test_simple(i128 %a, i128 %b, i128 %c) {
 ; CHECK-LE-LABEL: test_simple:
@@ -18,11 +19,16 @@ define i128 @test_simple(i128 %a, i128 %b, i128 %c) {
 ; CHECK-BE-NEXT:    subs x1, x8, x5
 ; CHECK-BE-NEXT:    sbc x0, x9, x4
 ; CHECK-BE-NEXT:    ret
-
+;
+; CHECK-GI-LABEL: test_simple:
+; CHECK-GI:       ; %bb.0:
+; CHECK-GI-NEXT:    adds x8, x0, x2
+; CHECK-GI-NEXT:    adc x9, x1, x3
+; CHECK-GI-NEXT:    subs x0, x8, x4
+; CHECK-GI-NEXT:    sbc x1, x9, x5
+; CHECK-GI-NEXT:    ret
   %valadd = add i128 %a, %b
-
   %valsub = sub i128 %valadd, %c
-
   ret i128 %valsub
 }
 
@@ -38,9 +44,13 @@ define i128 @test_imm(i128 %a) {
 ; CHECK-BE-NEXT:    adds x1, x1, #12
 ; CHECK-BE-NEXT:    cinc x0, x0, hs
 ; CHECK-BE-NEXT:    ret
-
+;
+; CHECK-GI-LABEL: test_imm:
+; CHECK-GI:       ; %bb.0:
+; CHECK-GI-NEXT:    adds x0, x0, #12
+; CHECK-GI-NEXT:    adc x1, x1, xzr
+; CHECK-GI-NEXT:    ret
   %val = add i128 %a, 12
-
   ret i128 %val
 }
 
@@ -58,11 +68,16 @@ define i128 @test_shifted(i128 %a, i128 %b) {
 ; CHECK-BE-NEXT:    adds x1, x1, x3, lsl #45
 ; CHECK-BE-NEXT:    adc x0, x0, x8
 ; CHECK-BE-NEXT:    ret
-
+;
+; CHECK-GI-LABEL: test_shifted:
+; CHECK-GI:       ; %bb.0:
+; CHECK-GI-NEXT:    lsr x8, x2, #19
+; CHECK-GI-NEXT:    adds x0, x0, x2, lsl #45
+; CHECK-GI-NEXT:    orr x8, x8, x3, lsl #45
+; CHECK-GI-NEXT:    adc x1, x1, x8
+; CHECK-GI-NEXT:    ret
   %rhs = shl i128 %b, 45
-
   %val = add i128 %a, %rhs
-
   ret i128 %val
 }
 
@@ -86,11 +101,19 @@ define i128 @test_extended(i128 %a, i16 %b) {
 ; CHECK-BE-NEXT:    extr x8, x9, x8, #61
 ; CHECK-BE-NEXT:    adc x0, x0, x8
 ; CHECK-BE-NEXT:    ret
-
+;
+; CHECK-GI-LABEL: test_extended:
+; CHECK-GI:       ; %bb.0:
+; CHECK-GI-NEXT:    ; kill: def $w2 killed $w2 def $x2
+; CHECK-GI-NEXT:    sxth x8, w2
+; CHECK-GI-NEXT:    adds x0, x0, w2, sxth #3
+; CHECK-GI-NEXT:    asr x9, x8, #63
+; CHECK-GI-NEXT:    lsr x8, x8, #61
+; CHECK-GI-NEXT:    orr x8, x8, x9, lsl #3
+; CHECK-GI-NEXT:    adc x1, x1, x8
+; CHECK-GI-NEXT:    ret
   %ext = sext i16 %b to i128
   %rhs = shl i128 %ext, 3
-
   %val = add i128 %a, %rhs
-
   ret i128 %val
 }

diff  --git a/llvm/test/CodeGen/AArch64/addcarry-crash.ll b/llvm/test/CodeGen/AArch64/addcarry-crash.ll
index be75ab101c858..b4556c79865b5 100644
--- a/llvm/test/CodeGen/AArch64/addcarry-crash.ll
+++ b/llvm/test/CodeGen/AArch64/addcarry-crash.ll
@@ -1,16 +1,29 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s | FileCheck %s
+; RUN: llc < %s | FileCheck %s --check-prefixes=CHECK,CHECK-SD
+; RUN: llc < %s -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
+
 target triple = "arm64-apple-ios7.0"
 
 define i64 @foo(ptr nocapture readonly %ptr, i64 %a, i64 %b, i64 %c) local_unnamed_addr #0 {
-; CHECK-LABEL: foo:
-; CHECK:       ; %bb.0: ; %entry
-; CHECK-NEXT:    lsr x8, x1, #32
-; CHECK-NEXT:    ldr w9, [x0, #4]
-; CHECK-NEXT:    cmn x3, x2
-; CHECK-NEXT:    umull x8, w9, w8
-; CHECK-NEXT:    cinc x0, x8, hs
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: foo:
+; CHECK-SD:       ; %bb.0: ; %entry
+; CHECK-SD-NEXT:    lsr x8, x1, #32
+; CHECK-SD-NEXT:    ldr w9, [x0, #4]
+; CHECK-SD-NEXT:    cmn x3, x2
+; CHECK-SD-NEXT:    umull x8, w9, w8
+; CHECK-SD-NEXT:    cinc x0, x8, hs
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: foo:
+; CHECK-GI:       ; %bb.0: ; %entry
+; CHECK-GI-NEXT:    ldr x8, [x0]
+; CHECK-GI-NEXT:    lsr x9, x1, #32
+; CHECK-GI-NEXT:    cmn x3, x2
+; CHECK-GI-NEXT:    cset w10, hs
+; CHECK-GI-NEXT:    lsr x8, x8, #32
+; CHECK-GI-NEXT:    and x10, x10, #0x1
+; CHECK-GI-NEXT:    umaddl x0, w8, w9, x10
+; CHECK-GI-NEXT:    ret
 entry:
   %0 = lshr i64 %a, 32
   %1 = load i64, ptr %ptr, align 8
@@ -24,3 +37,6 @@ entry:
 }
 
 attributes #0 = { norecurse nounwind readonly }
+
+;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
+; CHECK: {{.*}}

diff  --git a/llvm/test/CodeGen/AArch64/arm64-vabs.ll b/llvm/test/CodeGen/AArch64/arm64-vabs.ll
index b3258514aaa26..78881c80ccc10 100644
--- a/llvm/test/CodeGen/AArch64/arm64-vabs.ll
+++ b/llvm/test/CodeGen/AArch64/arm64-vabs.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck -check-prefixes=CHECK,CHECK-SD %s
+; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple | FileCheck %s -check-prefixes=CHECK,CHECK-SD
 ; RUN: llc < %s -mtriple=arm64-eabi -aarch64-neon-syntax=apple -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
 
 define <8 x i16> @sabdl8h(ptr %A, ptr %B) nounwind {

diff  --git a/llvm/test/CodeGen/AArch64/peephole-and-tst.ll b/llvm/test/CodeGen/AArch64/peephole-and-tst.ll
index 17ad2983abe90..3caac1d13495d 100644
--- a/llvm/test/CodeGen/AArch64/peephole-and-tst.ll
+++ b/llvm/test/CodeGen/AArch64/peephole-and-tst.ll
@@ -1,40 +1,72 @@
 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s
+; RUN: llc < %s -mtriple=aarch64-- | FileCheck %s --check-prefixes=CHECK,CHECK-SD
+; RUN: llc < %s -mtriple=aarch64-- -global-isel | FileCheck %s --check-prefixes=CHECK,CHECK-GI
 
 %struct.anon = type { ptr, ptr }
 
 @ptr_wrapper = common global ptr null, align 8
 
 define i32 @test_func_i32_two_uses(i32 %in, i32 %bit, i32 %mask) {
-; CHECK-LABEL: test_func_i32_two_uses:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    adrp x8, :got:ptr_wrapper
-; CHECK-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
-; CHECK-NEXT:    ldr x9, [x8]
-; CHECK-NEXT:    mov w8, wzr
-; CHECK-NEXT:    b .LBB0_3
-; CHECK-NEXT:  .LBB0_1: // in Loop: Header=BB0_3 Depth=1
-; CHECK-NEXT:    str xzr, [x9, #8]
-; CHECK-NEXT:  .LBB0_2: // in Loop: Header=BB0_3 Depth=1
-; CHECK-NEXT:    lsl w1, w1, #1
-; CHECK-NEXT:    cbz w1, .LBB0_6
-; CHECK-NEXT:  .LBB0_3: // %do.body
-; CHECK-NEXT:    // =>This Inner Loop Header: Depth=1
-; CHECK-NEXT:    ands w10, w1, w0
-; CHECK-NEXT:    and w11, w2, w0
-; CHECK-NEXT:    cinc w8, w8, ne
-; CHECK-NEXT:    cmp w10, w11
-; CHECK-NEXT:    b.eq .LBB0_1
-; CHECK-NEXT:  // %bb.4: // %do.body
-; CHECK-NEXT:    // in Loop: Header=BB0_3 Depth=1
-; CHECK-NEXT:    cbnz w2, .LBB0_1
-; CHECK-NEXT:  // %bb.5: // %do.body
-; CHECK-NEXT:    // in Loop: Header=BB0_3 Depth=1
-; CHECK-NEXT:    cbz w10, .LBB0_2
-; CHECK-NEXT:    b .LBB0_1
-; CHECK-NEXT:  .LBB0_6: // %do.end
-; CHECK-NEXT:    mov w0, w8
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: test_func_i32_two_uses:
+; CHECK-SD:       // %bb.0: // %entry
+; CHECK-SD-NEXT:    adrp x8, :got:ptr_wrapper
+; CHECK-SD-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
+; CHECK-SD-NEXT:    ldr x9, [x8]
+; CHECK-SD-NEXT:    mov w8, wzr
+; CHECK-SD-NEXT:    b .LBB0_3
+; CHECK-SD-NEXT:  .LBB0_1: // in Loop: Header=BB0_3 Depth=1
+; CHECK-SD-NEXT:    str xzr, [x9, #8]
+; CHECK-SD-NEXT:  .LBB0_2: // in Loop: Header=BB0_3 Depth=1
+; CHECK-SD-NEXT:    lsl w1, w1, #1
+; CHECK-SD-NEXT:    cbz w1, .LBB0_6
+; CHECK-SD-NEXT:  .LBB0_3: // %do.body
+; CHECK-SD-NEXT:    // =>This Inner Loop Header: Depth=1
+; CHECK-SD-NEXT:    ands w10, w1, w0
+; CHECK-SD-NEXT:    and w11, w2, w0
+; CHECK-SD-NEXT:    cinc w8, w8, ne
+; CHECK-SD-NEXT:    cmp w10, w11
+; CHECK-SD-NEXT:    b.eq .LBB0_1
+; CHECK-SD-NEXT:  // %bb.4: // %do.body
+; CHECK-SD-NEXT:    // in Loop: Header=BB0_3 Depth=1
+; CHECK-SD-NEXT:    cbnz w2, .LBB0_1
+; CHECK-SD-NEXT:  // %bb.5: // %do.body
+; CHECK-SD-NEXT:    // in Loop: Header=BB0_3 Depth=1
+; CHECK-SD-NEXT:    cbz w10, .LBB0_2
+; CHECK-SD-NEXT:    b .LBB0_1
+; CHECK-SD-NEXT:  .LBB0_6: // %do.end
+; CHECK-SD-NEXT:    mov w0, w8
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: test_func_i32_two_uses:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    adrp x8, :got:ptr_wrapper
+; CHECK-GI-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
+; CHECK-GI-NEXT:    ldr x9, [x8]
+; CHECK-GI-NEXT:    mov w8, wzr
+; CHECK-GI-NEXT:    b .LBB0_3
+; CHECK-GI-NEXT:  .LBB0_1: // in Loop: Header=BB0_3 Depth=1
+; CHECK-GI-NEXT:    str xzr, [x9, #8]
+; CHECK-GI-NEXT:  .LBB0_2: // in Loop: Header=BB0_3 Depth=1
+; CHECK-GI-NEXT:    lsl w1, w1, #1
+; CHECK-GI-NEXT:    cbz w1, .LBB0_6
+; CHECK-GI-NEXT:  .LBB0_3: // %do.body
+; CHECK-GI-NEXT:    // =>This Inner Loop Header: Depth=1
+; CHECK-GI-NEXT:    and w10, w1, w0
+; CHECK-GI-NEXT:    tst w1, w0
+; CHECK-GI-NEXT:    and w11, w2, w0
+; CHECK-GI-NEXT:    cinc w8, w8, ne
+; CHECK-GI-NEXT:    cmp w10, w11
+; CHECK-GI-NEXT:    b.eq .LBB0_1
+; CHECK-GI-NEXT:  // %bb.4: // %do.body
+; CHECK-GI-NEXT:    // in Loop: Header=BB0_3 Depth=1
+; CHECK-GI-NEXT:    cbnz w2, .LBB0_1
+; CHECK-GI-NEXT:  // %bb.5: // %do.body
+; CHECK-GI-NEXT:    // in Loop: Header=BB0_3 Depth=1
+; CHECK-GI-NEXT:    cbz w10, .LBB0_2
+; CHECK-GI-NEXT:    b .LBB0_1
+; CHECK-GI-NEXT:  .LBB0_6: // %do.end
+; CHECK-GI-NEXT:    mov w0, w8
+; CHECK-GI-NEXT:    ret
 entry:
   %0 = load ptr, ptr @ptr_wrapper, align 8
   %result = getelementptr inbounds %struct.anon, ptr %0, i64 0, i32 1
@@ -70,28 +102,52 @@ do.end:                                           ; preds = %4
 }
 
 define i32 @test_func_i64_one_use(i64 %in, i64 %bit, i64 %mask) {
-; CHECK-LABEL: test_func_i64_one_use:
-; CHECK:       // %bb.0: // %entry
-; CHECK-NEXT:    adrp x8, :got:ptr_wrapper
-; CHECK-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
-; CHECK-NEXT:    ldr x9, [x8]
-; CHECK-NEXT:    mov w8, wzr
-; CHECK-NEXT:    b .LBB1_2
-; CHECK-NEXT:  .LBB1_1: // in Loop: Header=BB1_2 Depth=1
-; CHECK-NEXT:    lsl x1, x1, #1
-; CHECK-NEXT:    cbz x1, .LBB1_4
-; CHECK-NEXT:  .LBB1_2: // %do.body
-; CHECK-NEXT:    // =>This Inner Loop Header: Depth=1
-; CHECK-NEXT:    ands x10, x1, x0
-; CHECK-NEXT:    orr x10, x2, x10
-; CHECK-NEXT:    cinc w8, w8, ne
-; CHECK-NEXT:    cbz x10, .LBB1_1
-; CHECK-NEXT:  // %bb.3: // in Loop: Header=BB1_2 Depth=1
-; CHECK-NEXT:    str xzr, [x9, #8]
-; CHECK-NEXT:    b .LBB1_1
-; CHECK-NEXT:  .LBB1_4: // %do.end
-; CHECK-NEXT:    mov w0, w8
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: test_func_i64_one_use:
+; CHECK-SD:       // %bb.0: // %entry
+; CHECK-SD-NEXT:    adrp x8, :got:ptr_wrapper
+; CHECK-SD-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
+; CHECK-SD-NEXT:    ldr x9, [x8]
+; CHECK-SD-NEXT:    mov w8, wzr
+; CHECK-SD-NEXT:    b .LBB1_2
+; CHECK-SD-NEXT:  .LBB1_1: // in Loop: Header=BB1_2 Depth=1
+; CHECK-SD-NEXT:    lsl x1, x1, #1
+; CHECK-SD-NEXT:    cbz x1, .LBB1_4
+; CHECK-SD-NEXT:  .LBB1_2: // %do.body
+; CHECK-SD-NEXT:    // =>This Inner Loop Header: Depth=1
+; CHECK-SD-NEXT:    ands x10, x1, x0
+; CHECK-SD-NEXT:    orr x10, x2, x10
+; CHECK-SD-NEXT:    cinc w8, w8, ne
+; CHECK-SD-NEXT:    cbz x10, .LBB1_1
+; CHECK-SD-NEXT:  // %bb.3: // in Loop: Header=BB1_2 Depth=1
+; CHECK-SD-NEXT:    str xzr, [x9, #8]
+; CHECK-SD-NEXT:    b .LBB1_1
+; CHECK-SD-NEXT:  .LBB1_4: // %do.end
+; CHECK-SD-NEXT:    mov w0, w8
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: test_func_i64_one_use:
+; CHECK-GI:       // %bb.0: // %entry
+; CHECK-GI-NEXT:    adrp x8, :got:ptr_wrapper
+; CHECK-GI-NEXT:    ldr x8, [x8, :got_lo12:ptr_wrapper]
+; CHECK-GI-NEXT:    ldr x9, [x8]
+; CHECK-GI-NEXT:    mov w8, wzr
+; CHECK-GI-NEXT:    b .LBB1_2
+; CHECK-GI-NEXT:  .LBB1_1: // in Loop: Header=BB1_2 Depth=1
+; CHECK-GI-NEXT:    lsl x1, x1, #1
+; CHECK-GI-NEXT:    cbz x1, .LBB1_4
+; CHECK-GI-NEXT:  .LBB1_2: // %do.body
+; CHECK-GI-NEXT:    // =>This Inner Loop Header: Depth=1
+; CHECK-GI-NEXT:    and x10, x1, x0
+; CHECK-GI-NEXT:    tst x1, x0
+; CHECK-GI-NEXT:    orr x10, x2, x10
+; CHECK-GI-NEXT:    cinc w8, w8, ne
+; CHECK-GI-NEXT:    cbz x10, .LBB1_1
+; CHECK-GI-NEXT:  // %bb.3: // in Loop: Header=BB1_2 Depth=1
+; CHECK-GI-NEXT:    str xzr, [x9, #8]
+; CHECK-GI-NEXT:    b .LBB1_1
+; CHECK-GI-NEXT:  .LBB1_4: // %do.end
+; CHECK-GI-NEXT:    mov w0, w8
+; CHECK-GI-NEXT:    ret
 entry:
   %0 = load ptr, ptr @ptr_wrapper, align 8
   %result = getelementptr inbounds %struct.anon, ptr %0, i64 0, i32 1
@@ -124,11 +180,18 @@ do.end:                                           ; preds = %4
 }
 
 define i64 @test_and1(i64 %x, i64 %y) {
-; CHECK-LABEL: test_and1:
-; CHECK:       // %bb.0:
-; CHECK-NEXT:    ands x8, x0, #0x3
-; CHECK-NEXT:    csel x0, x8, x1, eq
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: test_and1:
+; CHECK-SD:       // %bb.0:
+; CHECK-SD-NEXT:    ands x8, x0, #0x3
+; CHECK-SD-NEXT:    csel x0, x8, x1, eq
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: test_and1:
+; CHECK-GI:       // %bb.0:
+; CHECK-GI-NEXT:    and x8, x0, #0x3
+; CHECK-GI-NEXT:    tst x0, #0x3
+; CHECK-GI-NEXT:    csel x0, x8, x1, eq
+; CHECK-GI-NEXT:    ret
   %a = and i64 %x, 3
   %c = icmp eq i64 %a, 0
   %s = select i1 %c, i64 %a, i64 %y
@@ -148,23 +211,43 @@ define i64 @test_and2(i64 %x, i64 %y) {
 }
 
 define i64 @test_and3(i64 %x, i64 %y) {
-; CHECK-LABEL: test_and3:
-; CHECK:       // %bb.0:
-; CHECK-NEXT:    str x30, [sp, #-32]! // 8-byte Folded Spill
-; CHECK-NEXT:    stp x20, x19, [sp, #16] // 16-byte Folded Spill
-; CHECK-NEXT:    .cfi_def_cfa_offset 32
-; CHECK-NEXT:    .cfi_offset w19, -8
-; CHECK-NEXT:    .cfi_offset w20, -16
-; CHECK-NEXT:    .cfi_offset w30, -32
-; CHECK-NEXT:    mov x20, x0
-; CHECK-NEXT:    mov x0, xzr
-; CHECK-NEXT:    mov x19, x1
-; CHECK-NEXT:    bl callee
-; CHECK-NEXT:    ands x8, x20, #0x3
-; CHECK-NEXT:    csel x0, x8, x19, eq
-; CHECK-NEXT:    ldp x20, x19, [sp, #16] // 16-byte Folded Reload
-; CHECK-NEXT:    ldr x30, [sp], #32 // 8-byte Folded Reload
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: test_and3:
+; CHECK-SD:       // %bb.0:
+; CHECK-SD-NEXT:    str x30, [sp, #-32]! // 8-byte Folded Spill
+; CHECK-SD-NEXT:    stp x20, x19, [sp, #16] // 16-byte Folded Spill
+; CHECK-SD-NEXT:    .cfi_def_cfa_offset 32
+; CHECK-SD-NEXT:    .cfi_offset w19, -8
+; CHECK-SD-NEXT:    .cfi_offset w20, -16
+; CHECK-SD-NEXT:    .cfi_offset w30, -32
+; CHECK-SD-NEXT:    mov x20, x0
+; CHECK-SD-NEXT:    mov x0, xzr
+; CHECK-SD-NEXT:    mov x19, x1
+; CHECK-SD-NEXT:    bl callee
+; CHECK-SD-NEXT:    ands x8, x20, #0x3
+; CHECK-SD-NEXT:    csel x0, x8, x19, eq
+; CHECK-SD-NEXT:    ldp x20, x19, [sp, #16] // 16-byte Folded Reload
+; CHECK-SD-NEXT:    ldr x30, [sp], #32 // 8-byte Folded Reload
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: test_and3:
+; CHECK-GI:       // %bb.0:
+; CHECK-GI-NEXT:    stp x30, x21, [sp, #-32]! // 16-byte Folded Spill
+; CHECK-GI-NEXT:    stp x20, x19, [sp, #16] // 16-byte Folded Spill
+; CHECK-GI-NEXT:    .cfi_def_cfa_offset 32
+; CHECK-GI-NEXT:    .cfi_offset w19, -8
+; CHECK-GI-NEXT:    .cfi_offset w20, -16
+; CHECK-GI-NEXT:    .cfi_offset w21, -24
+; CHECK-GI-NEXT:    .cfi_offset w30, -32
+; CHECK-GI-NEXT:    mov x19, x0
+; CHECK-GI-NEXT:    and x21, x0, #0x3
+; CHECK-GI-NEXT:    mov x0, xzr
+; CHECK-GI-NEXT:    mov x20, x1
+; CHECK-GI-NEXT:    bl callee
+; CHECK-GI-NEXT:    tst x19, #0x3
+; CHECK-GI-NEXT:    csel x0, x21, x20, eq
+; CHECK-GI-NEXT:    ldp x20, x19, [sp, #16] // 16-byte Folded Reload
+; CHECK-GI-NEXT:    ldp x30, x21, [sp], #32 // 16-byte Folded Reload
+; CHECK-GI-NEXT:    ret
   %a = and i64 %x, 3
   %b = call i64 @callee(i64 0)
   %c = icmp eq i64 %a, 0
@@ -173,19 +256,37 @@ define i64 @test_and3(i64 %x, i64 %y) {
 }
 
 define i64 @test_and_4(i64 %x, i64 %y) {
-; CHECK-LABEL: test_and_4:
-; CHECK:       // %bb.0:
-; CHECK-NEXT:    stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
-; CHECK-NEXT:    .cfi_def_cfa_offset 16
-; CHECK-NEXT:    .cfi_offset w19, -8
-; CHECK-NEXT:    .cfi_offset w30, -16
-; CHECK-NEXT:    mov x19, x0
-; CHECK-NEXT:    ands x0, x0, #0x3
-; CHECK-NEXT:    bl callee
-; CHECK-NEXT:    ands x8, x19, #0x3
-; CHECK-NEXT:    csel x0, x8, x0, eq
-; CHECK-NEXT:    ldp x30, x19, [sp], #16 // 16-byte Folded Reload
-; CHECK-NEXT:    ret
+; CHECK-SD-LABEL: test_and_4:
+; CHECK-SD:       // %bb.0:
+; CHECK-SD-NEXT:    stp x30, x19, [sp, #-16]! // 16-byte Folded Spill
+; CHECK-SD-NEXT:    .cfi_def_cfa_offset 16
+; CHECK-SD-NEXT:    .cfi_offset w19, -8
+; CHECK-SD-NEXT:    .cfi_offset w30, -16
+; CHECK-SD-NEXT:    mov x19, x0
+; CHECK-SD-NEXT:    ands x0, x0, #0x3
+; CHECK-SD-NEXT:    bl callee
+; CHECK-SD-NEXT:    ands x8, x19, #0x3
+; CHECK-SD-NEXT:    csel x0, x8, x0, eq
+; CHECK-SD-NEXT:    ldp x30, x19, [sp], #16 // 16-byte Folded Reload
+; CHECK-SD-NEXT:    ret
+;
+; CHECK-GI-LABEL: test_and_4:
+; CHECK-GI:       // %bb.0:
+; CHECK-GI-NEXT:    str x30, [sp, #-32]! // 8-byte Folded Spill
+; CHECK-GI-NEXT:    stp x20, x19, [sp, #16] // 16-byte Folded Spill
+; CHECK-GI-NEXT:    .cfi_def_cfa_offset 32
+; CHECK-GI-NEXT:    .cfi_offset w19, -8
+; CHECK-GI-NEXT:    .cfi_offset w20, -16
+; CHECK-GI-NEXT:    .cfi_offset w30, -32
+; CHECK-GI-NEXT:    and x20, x0, #0x3
+; CHECK-GI-NEXT:    mov x19, x0
+; CHECK-GI-NEXT:    mov x0, x20
+; CHECK-GI-NEXT:    bl callee
+; CHECK-GI-NEXT:    tst x19, #0x3
+; CHECK-GI-NEXT:    csel x0, x20, x0, eq
+; CHECK-GI-NEXT:    ldp x20, x19, [sp, #16] // 16-byte Folded Reload
+; CHECK-GI-NEXT:    ldr x30, [sp], #32 // 8-byte Folded Reload
+; CHECK-GI-NEXT:    ret
   %a = and i64 %x, 3
   %b = call i64 @callee(i64 %a)
   %c = icmp eq i64 %a, 0


        


More information about the llvm-commits mailing list