65 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc -mtriple=aarch64-linux-gnu -verify-machineinstrs -o - %s | FileCheck %s3; LSR used to pick a sub-optimal solution due to the target responding4; conservatively to isLegalAddImmediate for negative values.5 6declare void @foo(i32)7 8define void @test(i32 %px) {9; CHECK-LABEL: test:10; CHECK: // %bb.0: // %entry11; CHECK-NEXT: str x30, [sp, #-32]! // 8-byte Folded Spill12; CHECK-NEXT: stp x20, x19, [sp, #16] // 16-byte Folded Spill13; CHECK-NEXT: .cfi_def_cfa_offset 3214; CHECK-NEXT: .cfi_offset w19, -815; CHECK-NEXT: .cfi_offset w20, -1616; CHECK-NEXT: .cfi_offset w30, -3217; CHECK-NEXT: subs w8, w0, #118; CHECK-NEXT: mov w19, w019; CHECK-NEXT: csel w20, wzr, w8, lt20; CHECK-NEXT: b .LBB0_221; CHECK-NEXT: .LBB0_1: // %for.inc22; CHECK-NEXT: // in Loop: Header=BB0_2 Depth=123; CHECK-NEXT: cmp w20, w1924; CHECK-NEXT: add w20, w20, #125; CHECK-NEXT: b.gt .LBB0_426; CHECK-NEXT: .LBB0_2: // %for.body27; CHECK-NEXT: // =>This Inner Loop Header: Depth=128; CHECK-NEXT: cmp w19, w2029; CHECK-NEXT: b.eq .LBB0_130; CHECK-NEXT: // %bb.3: // %if.then331; CHECK-NEXT: // in Loop: Header=BB0_2 Depth=132; CHECK-NEXT: mov w0, w2033; CHECK-NEXT: bl foo34; CHECK-NEXT: b .LBB0_135; CHECK-NEXT: .LBB0_4: // %for.cond.cleanup36; CHECK-NEXT: ldp x20, x19, [sp, #16] // 16-byte Folded Reload37; CHECK-NEXT: ldr x30, [sp], #32 // 8-byte Folded Reload38; CHECK-NEXT: ret39entry:40 %sub = add nsw i32 %px, -141 %cmp = icmp slt i32 %px, 142 %.sub = select i1 %cmp, i32 0, i32 %sub43 br label %for.body44 45for.body:46 %x.015 = phi i32 [ %inc, %for.inc ], [ %.sub, %entry ]47 %cmp2 = icmp eq i32 %x.015, %px48 br i1 %cmp2, label %for.inc, label %if.then349 50if.then3:51 tail call void @foo(i32 %x.015)52 br label %for.inc53 54for.inc:55 %inc = add nsw i32 %x.015, 156 %cmp1 = icmp sgt i32 %x.015, %px57 br i1 %cmp1, label %for.cond.cleanup.loopexit, label %for.body58 59for.cond.cleanup.loopexit:60 br label %for.cond.cleanup61 62for.cond.cleanup:63 ret void64}65