|
| 1 | +# RUN: llc -mtriple=aarch64-unknown -run-pass aarch64-branch-relax -aarch64-tbz-offset-bits=4 %s -o - | FileCheck %s |
| 2 | +--- | |
| 3 | + ; ModuleID = 'test.ll' |
| 4 | + source_filename = "test.ll" |
| 5 | + target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" |
| 6 | + target triple = "aarch64-unknown" |
| 7 | + |
| 8 | + @ThreadLocalGlobal = external thread_local local_unnamed_addr global i32, align 8 |
| 9 | + |
| 10 | + define i32 @test_tlsdesc_callseq_length(i32 %in) { |
| 11 | + %val = and i32 %in, 1 |
| 12 | + %tst = icmp eq i32 %val, 0 |
| 13 | + br i1 %tst, label %true, label %false |
| 14 | + |
| 15 | + true: ; preds = %0 |
| 16 | + %1 = load i32, i32* @ThreadLocalGlobal, align 8 |
| 17 | + ret i32 %1 |
| 18 | + |
| 19 | + false: ; preds = %0 |
| 20 | + ret i32 0 |
| 21 | + } |
| 22 | + |
| 23 | +... |
| 24 | +--- |
| 25 | +# CHECK-LABEL: name:{{.*}}test_tlsdesc_callseq_length |
| 26 | +# If the size of TLSDESC_CALLSEQ is computed correctly, that will push |
| 27 | +# the bb.2.false block too far away from the TBNZW, so the branch will |
| 28 | +# have to be relaxed (note that we're using -aarch64-tbz-offset-bits to |
| 29 | +# constrain the range that can be reached with the TBNZW to something smaller |
| 30 | +# than what TLSDESC_CALLSEQ is lowered to). |
| 31 | +# CHECK: TBZW killed %w0, 0, %bb.1.true |
| 32 | +# CHECK: B %bb.2.false |
| 33 | +name: test_tlsdesc_callseq_length |
| 34 | +alignment: 2 |
| 35 | +exposesReturnsTwice: false |
| 36 | +hasInlineAsm: false |
| 37 | +allVRegsAllocated: true |
| 38 | +isSSA: false |
| 39 | +tracksRegLiveness: false |
| 40 | +tracksSubRegLiveness: false |
| 41 | +liveins: |
| 42 | + - { reg: '%w0' } |
| 43 | +frameInfo: |
| 44 | + isFrameAddressTaken: false |
| 45 | + isReturnAddressTaken: false |
| 46 | + hasStackMap: false |
| 47 | + hasPatchPoint: false |
| 48 | + stackSize: 16 |
| 49 | + offsetAdjustment: 0 |
| 50 | + maxAlignment: 16 |
| 51 | + adjustsStack: false |
| 52 | + hasCalls: true |
| 53 | + maxCallFrameSize: 0 |
| 54 | + hasOpaqueSPAdjustment: false |
| 55 | + hasVAStart: false |
| 56 | + hasMustTailInVarArgFunc: false |
| 57 | +stack: |
| 58 | + - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '%lr' } |
| 59 | +body: | |
| 60 | + bb.0 (%ir-block.0): |
| 61 | + successors: %bb.1.true, %bb.2.false |
| 62 | + liveins: %w0, %lr |
| 63 | +
|
| 64 | + TBNZW killed %w0, 0, %bb.2.false |
| 65 | +
|
| 66 | + bb.1.true: |
| 67 | + liveins: %lr |
| 68 | +
|
| 69 | + early-clobber %sp = frame-setup STRXpre killed %lr, %sp, -16 :: (store 8 into %stack.0) |
| 70 | + frame-setup CFI_INSTRUCTION def_cfa_offset 16 |
| 71 | + frame-setup CFI_INSTRUCTION offset %w30, -16 |
| 72 | + TLSDESC_CALLSEQ target-flags(aarch64-tls) @ThreadLocalGlobal, implicit-def dead %lr, implicit-def %x0, implicit-def dead %x1 |
| 73 | + %x8 = MRS 56962 |
| 74 | + %w0 = LDRWroX killed %x8, killed %x0, 0, 0 :: (load 4 from @ThreadLocalGlobal, align 8) |
| 75 | + early-clobber %sp, %lr = LDRXpost %sp, 16 :: (load 8 from %stack.0) |
| 76 | + RET killed %lr, implicit killed %w0 |
| 77 | +
|
| 78 | + bb.2.false: |
| 79 | + liveins: %lr |
| 80 | +
|
| 81 | + %w0 = ORRWrs %wzr, %wzr, 0 |
| 82 | + RET killed %lr, implicit killed %w0 |
| 83 | +
|
| 84 | +... |
0 commit comments