244 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -verify-machineinstrs -mtriple=aarch64-unknown-linux < %s | FileCheck %s3; RUN: llc -verify-machineinstrs -mtriple=arm64-apple-ios < %s | FileCheck %s --check-prefix=CHECK-APPLE4 5; Check CSR split can work properly for tests below.6 7@a = common dso_local local_unnamed_addr global i32 0, align 48 9define dso_local signext i32 @test1(ptr %b) local_unnamed_addr uwtable {10; CHECK-LABEL: test1:11; CHECK: // %bb.0: // %entry12; CHECK-NEXT: adrp x8, a13; CHECK-NEXT: ldrsw x8, [x8, :lo12:a]14; CHECK-NEXT: cmp x8, x015; CHECK-NEXT: b.eq .LBB0_216; CHECK-NEXT: // %bb.1: // %if.end17; CHECK-NEXT: ret18; CHECK-NEXT: .LBB0_2: // %if.then19; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill20; CHECK-NEXT: .cfi_def_cfa_offset 1621; CHECK-NEXT: .cfi_offset w19, -822; CHECK-NEXT: .cfi_offset w30, -1623; CHECK-NEXT: mov x19, x024; CHECK-NEXT: bl callVoid25; CHECK-NEXT: mov x0, x1926; CHECK-NEXT: ldp x30, x19, [sp], #16 // 16-byte Folded Reload27; CHECK-NEXT: .cfi_def_cfa_offset 028; CHECK-NEXT: .cfi_restore w1929; CHECK-NEXT: .cfi_restore w3030; CHECK-NEXT: b callNonVoid31;32; CHECK-APPLE-LABEL: test1:33; CHECK-APPLE: ; %bb.0: ; %entry34; CHECK-APPLE-NEXT: Lloh0:35; CHECK-APPLE-NEXT: adrp x8, _a@PAGE36; CHECK-APPLE-NEXT: Lloh1:37; CHECK-APPLE-NEXT: ldrsw x8, [x8, _a@PAGEOFF]38; CHECK-APPLE-NEXT: cmp x8, x039; CHECK-APPLE-NEXT: b.eq LBB0_240; CHECK-APPLE-NEXT: ; %bb.1: ; %if.end41; CHECK-APPLE-NEXT: ret42; CHECK-APPLE-NEXT: LBB0_2: ; %if.then43; CHECK-APPLE-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill44; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 3245; CHECK-APPLE-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill46; CHECK-APPLE-NEXT: .cfi_offset w30, -847; CHECK-APPLE-NEXT: .cfi_offset w29, -1648; CHECK-APPLE-NEXT: .cfi_offset w19, -2449; CHECK-APPLE-NEXT: .cfi_offset w20, -3250; CHECK-APPLE-NEXT: mov x19, x051; CHECK-APPLE-NEXT: bl _callVoid52; CHECK-APPLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload53; CHECK-APPLE-NEXT: mov x0, x1954; CHECK-APPLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload55; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 056; CHECK-APPLE-NEXT: .cfi_restore w3057; CHECK-APPLE-NEXT: .cfi_restore w2958; CHECK-APPLE-NEXT: .cfi_restore w1959; CHECK-APPLE-NEXT: .cfi_restore w2060; CHECK-APPLE-NEXT: b _callNonVoid61; CHECK-APPLE-NEXT: .loh AdrpLdr Lloh0, Lloh162entry:63 %0 = load i32, ptr @a, align 4, !tbaa !264 %conv = sext i32 %0 to i6465 %1 = inttoptr i64 %conv to ptr66 %cmp = icmp eq ptr %1, %b67 br i1 %cmp, label %if.then, label %if.end68 69if.then: ; preds = %entry70 %call = tail call signext i32 @callVoid()71 %call2 = tail call signext i32 @callNonVoid(ptr %b)72 br label %if.end73 74if.end: ; preds = %if.then, %entry75 %retval.0 = phi i32 [ %call2, %if.then ], [ undef, %entry ]76 ret i32 %retval.077}78 79declare signext i32 @callVoid(...) local_unnamed_addr80 81declare signext i32 @callNonVoid(ptr) local_unnamed_addr82 83define dso_local signext i32 @test2(ptr %p1) local_unnamed_addr uwtable {84; CHECK-LABEL: test2:85; CHECK: // %bb.0: // %entry86; CHECK-NEXT: cbz x0, .LBB1_387; CHECK-NEXT: // %bb.1: // %entry88; CHECK-NEXT: adrp x8, a89; CHECK-NEXT: ldrsw x8, [x8, :lo12:a]90; CHECK-NEXT: cmp x8, x091; CHECK-NEXT: b.ne .LBB1_392; CHECK-NEXT: // %bb.2: // %if.then293; CHECK-NEXT: stp x30, x19, [sp, #-16]! // 16-byte Folded Spill94; CHECK-NEXT: .cfi_def_cfa_offset 1695; CHECK-NEXT: .cfi_offset w19, -896; CHECK-NEXT: .cfi_offset w30, -1697; CHECK-NEXT: mov x19, x098; CHECK-NEXT: bl callVoid99; CHECK-NEXT: mov x0, x19100; CHECK-NEXT: ldp x30, x19, [sp], #16 // 16-byte Folded Reload101; CHECK-NEXT: .cfi_def_cfa_offset 0102; CHECK-NEXT: .cfi_restore w19103; CHECK-NEXT: .cfi_restore w30104; CHECK-NEXT: b callNonVoid105; CHECK-NEXT: .LBB1_3: // %return106; CHECK-NEXT: mov w0, wzr107; CHECK-NEXT: ret108;109; CHECK-APPLE-LABEL: test2:110; CHECK-APPLE: ; %bb.0: ; %entry111; CHECK-APPLE-NEXT: cbz x0, LBB1_3112; CHECK-APPLE-NEXT: ; %bb.1: ; %entry113; CHECK-APPLE-NEXT: Lloh2:114; CHECK-APPLE-NEXT: adrp x8, _a@PAGE115; CHECK-APPLE-NEXT: Lloh3:116; CHECK-APPLE-NEXT: ldrsw x8, [x8, _a@PAGEOFF]117; CHECK-APPLE-NEXT: cmp x8, x0118; CHECK-APPLE-NEXT: b.ne LBB1_3119; CHECK-APPLE-NEXT: ; %bb.2: ; %if.then2120; CHECK-APPLE-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill121; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 32122; CHECK-APPLE-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill123; CHECK-APPLE-NEXT: .cfi_offset w30, -8124; CHECK-APPLE-NEXT: .cfi_offset w29, -16125; CHECK-APPLE-NEXT: .cfi_offset w19, -24126; CHECK-APPLE-NEXT: .cfi_offset w20, -32127; CHECK-APPLE-NEXT: mov x19, x0128; CHECK-APPLE-NEXT: bl _callVoid129; CHECK-APPLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload130; CHECK-APPLE-NEXT: mov x0, x19131; CHECK-APPLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload132; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 0133; CHECK-APPLE-NEXT: .cfi_restore w30134; CHECK-APPLE-NEXT: .cfi_restore w29135; CHECK-APPLE-NEXT: .cfi_restore w19136; CHECK-APPLE-NEXT: .cfi_restore w20137; CHECK-APPLE-NEXT: b _callNonVoid138; CHECK-APPLE-NEXT: LBB1_3: ; %return139; CHECK-APPLE-NEXT: mov w0, wzr140; CHECK-APPLE-NEXT: ret141; CHECK-APPLE-NEXT: .loh AdrpLdr Lloh2, Lloh3142entry:143 %tobool = icmp eq ptr %p1, null144 br i1 %tobool, label %return, label %if.end145 146if.end: ; preds = %entry147 %0 = load i32, ptr @a, align 4, !tbaa !2148 %conv = sext i32 %0 to i64149 %1 = inttoptr i64 %conv to ptr150 %cmp = icmp eq ptr %1, %p1151 br i1 %cmp, label %if.then2, label %return152 153if.then2: ; preds = %if.end154 %call = tail call signext i32 @callVoid()155 %call3 = tail call signext i32 @callNonVoid(ptr nonnull %p1)156 br label %return157 158return: ; preds = %if.end, %entry, %if.then2159 %retval.0 = phi i32 [ %call3, %if.then2 ], [ 0, %entry ], [ 0, %if.end ]160 ret i32 %retval.0161}162 163 164define dso_local ptr @test3(ptr nocapture %p1, i8 zeroext %p2) local_unnamed_addr uwtable {165; CHECK-LABEL: test3:166; CHECK: // %bb.0: // %entry167; CHECK-NEXT: str x30, [sp, #-32]! // 8-byte Folded Spill168; CHECK-NEXT: .cfi_def_cfa_offset 32169; CHECK-NEXT: stp x20, x19, [sp, #16] // 16-byte Folded Spill170; CHECK-NEXT: .cfi_offset w19, -8171; CHECK-NEXT: .cfi_offset w20, -16172; CHECK-NEXT: .cfi_offset w30, -32173; CHECK-NEXT: ldr x19, [x0]174; CHECK-NEXT: cbz x19, .LBB2_2175; CHECK-NEXT: // %bb.1: // %land.rhs176; CHECK-NEXT: mov x20, x0177; CHECK-NEXT: mov x0, x19178; CHECK-NEXT: bl bar179; CHECK-NEXT: str x0, [x20]180; CHECK-NEXT: .LBB2_2: // %land.end181; CHECK-NEXT: mov x0, x19182; CHECK-NEXT: ldp x20, x19, [sp, #16] // 16-byte Folded Reload183; CHECK-NEXT: ldr x30, [sp], #32 // 8-byte Folded Reload184; CHECK-NEXT: .cfi_def_cfa_offset 0185; CHECK-NEXT: .cfi_restore w19186; CHECK-NEXT: .cfi_restore w20187; CHECK-NEXT: .cfi_restore w30188; CHECK-NEXT: ret189;190; CHECK-APPLE-LABEL: test3:191; CHECK-APPLE: ; %bb.0: ; %entry192; CHECK-APPLE-NEXT: stp x20, x19, [sp, #-32]! ; 16-byte Folded Spill193; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 32194; CHECK-APPLE-NEXT: stp x29, x30, [sp, #16] ; 16-byte Folded Spill195; CHECK-APPLE-NEXT: .cfi_offset w30, -8196; CHECK-APPLE-NEXT: .cfi_offset w29, -16197; CHECK-APPLE-NEXT: .cfi_offset w19, -24198; CHECK-APPLE-NEXT: .cfi_offset w20, -32199; CHECK-APPLE-NEXT: ldr x19, [x0]200; CHECK-APPLE-NEXT: cbz x19, LBB2_2201; CHECK-APPLE-NEXT: ; %bb.1: ; %land.rhs202; CHECK-APPLE-NEXT: mov x20, x0203; CHECK-APPLE-NEXT: mov x0, x19204; CHECK-APPLE-NEXT: bl _bar205; CHECK-APPLE-NEXT: str x0, [x20]206; CHECK-APPLE-NEXT: LBB2_2: ; %land.end207; CHECK-APPLE-NEXT: ldp x29, x30, [sp, #16] ; 16-byte Folded Reload208; CHECK-APPLE-NEXT: mov x0, x19209; CHECK-APPLE-NEXT: ldp x20, x19, [sp], #32 ; 16-byte Folded Reload210; CHECK-APPLE-NEXT: .cfi_def_cfa_offset 0211; CHECK-APPLE-NEXT: .cfi_restore w30212; CHECK-APPLE-NEXT: .cfi_restore w29213; CHECK-APPLE-NEXT: .cfi_restore w19214; CHECK-APPLE-NEXT: .cfi_restore w20215; CHECK-APPLE-NEXT: ret216entry:217 %0 = load ptr, ptr %p1, align 8, !tbaa !6218 %tobool = icmp eq ptr %0, null219 br i1 %tobool, label %land.end, label %land.rhs220 221land.rhs: ; preds = %entry222 %call = tail call ptr @bar(ptr nonnull %0, i8 zeroext %p2)223 store ptr %call, ptr %p1, align 8, !tbaa !6224 br label %land.end225 226land.end: ; preds = %entry, %land.rhs227 ret ptr %0228}229 230declare ptr @bar(ptr, i8 zeroext) local_unnamed_addr231 232 233!llvm.module.flags = !{!0}234!llvm.ident = !{!1}235 236!0 = !{i32 1, !"wchar_size", i32 4}237!1 = !{!"clang version 10.0.0 (trunk 367381) (llvm/trunk 367388)"}238!2 = !{!3, !3, i64 0}239!3 = !{!"int", !4, i64 0}240!4 = !{!"omnipotent char", !5, i64 0}241!5 = !{!"Simple C/C++ TBAA"}242!6 = !{!7, !7, i64 0}243!7 = !{!"any pointer", !4, i64 0}244