diff options
Diffstat (limited to 'llvm/test/CodeGen/AArch64/jump-table-compress.mir')
-rw-r--r-- | llvm/test/CodeGen/AArch64/jump-table-compress.mir | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/AArch64/jump-table-compress.mir b/llvm/test/CodeGen/AArch64/jump-table-compress.mir new file mode 100644 index 00000000000..b4217ea6168 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/jump-table-compress.mir @@ -0,0 +1,111 @@ +# RUN: llc -mtriple=aarch64-linux-gnu %s -run-pass=aarch64-jump-tables -o - | FileCheck %s +--- | + define i32 @test_jumptable(i32 %in) { + unreachable + } + +... +--- +name: test_jumptable +alignment: 2 +exposesReturnsTwice: false +legalized: false +regBankSelected: false +selected: false +tracksRegLiveness: true +liveins: + - { reg: '$w0' } +frameInfo: + isFrameAddressTaken: false + isReturnAddressTaken: false + hasStackMap: false + hasPatchPoint: false + stackSize: 0 + offsetAdjustment: 0 + maxAlignment: 0 + adjustsStack: false + hasCalls: false + maxCallFrameSize: 0 + hasOpaqueSPAdjustment: false + hasVAStart: false + hasMustTailInVarArgFunc: false +jumpTable: + kind: block-address + entries: + - id: 0 + blocks: [ '%bb.2', '%bb.3' ] + - id: 1 + blocks: [ '%bb.4', '%bb.5' ] + - id: 2 + blocks: [ '%bb.7' ] + - id: 3 + blocks: [ '%bb.9' ] + - id: 4 + blocks: [ '%bb.9' ] + - id: 5 + blocks: [ '%bb.11' ] +body: | + bb.0 (%ir-block.0): + + bb.1 (%ir-block.0): + ; CHECK-LABEL: body: + ; CHECK-LABEL: bb.1 + ; CHECK: JumpTableDest8 + liveins: $x8 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.0 + BR killed $x10 + + bb.2: + ; Last destination is 4 * 255 = 1020 bytes after first. Byte is OK. + dead $xzr = SPACE 1020, undef $xzr + + bb.3: + ; CHECK-LABEL: bb.3 + ; CHECK: JumpTableDest16 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.1 + BR killed $x10 + + bb.4: + ; Last destination is 4 * 256 = 1024 bytes after first. Half needed. + dead $xzr = SPACE 1024, undef $xzr + + bb.5: + ; CHECK-LABEL: bb.5 + ; CHECK: JumpTableDest8 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.2 + BR killed $x10 + + bb.6: + ; First destination is (2^20 - 4) after reference. Just reachable by ADR so can use compressed table. + dead $xzr = SPACE 1048556, undef $xzr + + bb.7: + ; CHECK-LABEL: bb.7 + ; CHECK: JumpTableDest32 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.3 + BR killed $x10 + + bb.8: + ; First destination is 2^20 after reference. Compressed table cannot reach it. + dead $xzr = SPACE 1048560, undef $xzr + + bb.9: + ; First destination is 2^20 before reference. Just within reach of ADR. + dead $xzr = SPACE 1048576, undef $xzr + + bb.10: + ; CHECK-LABEL: bb.10 + ; CHECK: JumpTableDest8 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.4 + BR killed $x10 + + bb.11: + ; First destination is 2^20 before reference. Just within reach of ADR. + dead $xzr = SPACE 1048580, undef $xzr + + bb.12: + ; CHECK-LABEL: bb.12 + ; CHECK: JumpTableDest32 + early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.5 + BR killed $x10 +... |