brintos

brintos / llvm-project-archived public Read only

0
0
Text · 14.6 KiB · 375357f Raw
285 lines · plain
1# RUN: llc -mtriple=aarch64-linux-gnu %s -run-pass=aarch64-jump-tables -o - | FileCheck %s2--- |3  define i32 @test_jumptable(i32 %in) {4    unreachable5  }6 7  define void @test_inline_asm_no_compress() { ret void }8  define void @test_bb_alignment_not_byte_compressable() { ret void }9 10...11---12name:            test_jumptable13alignment:       414exposesReturnsTwice: false15legalized:       false16regBankSelected: false17selected:        false18tracksRegLiveness: true19liveins:20  - { reg: '$w0' }21frameInfo:22  isFrameAddressTaken: false23  isReturnAddressTaken: false24  hasStackMap:     false25  hasPatchPoint:   false26  stackSize:       027  offsetAdjustment: 028  maxAlignment:    029  adjustsStack:    false30  hasCalls:        false31  maxCallFrameSize: 032  hasOpaqueSPAdjustment: false33  hasVAStart:      false34  hasMustTailInVarArgFunc: false35jumpTable:36  kind:            block-address37  entries:38    - id:              039      blocks:          [ '%bb.2', '%bb.3' ]40    - id:              141      blocks:          [ '%bb.4', '%bb.5' ]42    - id:              243      blocks:          [ '%bb.7' ]44    - id:              345      blocks:          [ '%bb.9' ]46    - id:              447      blocks:          [ '%bb.9' ]48    - id:              549      blocks:          [ '%bb.11' ]50body:             |51  bb.0 (%ir-block.0):52    liveins: $x853 54  bb.1 (%ir-block.0):55    ; CHECK-LABEL: body:56    ; CHECK-LABEL: bb.157    ; CHECK: JumpTableDest858    liveins: $x859    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.060    BR killed $x1061 62  bb.2:63    ; Last destination is 4 * 255 = 1020 bytes after first. Byte is OK.64    dead $xzr = SPACE 1020, undef $xzr65 66  bb.3:67    ; CHECK-LABEL: bb.368    ; CHECK: JumpTableDest1669    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.170    BR killed $x1071 72  bb.4:73    ; Last destination is 4 * 256 = 1024 bytes after first. Half needed.74    dead $xzr = SPACE 1024, undef $xzr75 76  bb.5:77    ; CHECK-LABEL: bb.578    ; CHECK: JumpTableDest879    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.280    BR killed $x1081 82  bb.6:83    ; First destination is (2^20 - 4) after reference. Just reachable by ADR so can use compressed table.84    dead $xzr = SPACE 1048556, undef $xzr85 86  bb.7:87    ; CHECK-LABEL: bb.788    ; CHECK: JumpTableDest3289    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.390    BR killed $x1091 92  bb.8:93    ; First destination is 2^20 after reference. Compressed table cannot reach it.94    dead $xzr = SPACE 1048560, undef $xzr95 96  bb.9:97    ; First destination is 2^20 before reference. Just within reach of ADR.98    dead $xzr = SPACE 1048576, undef $xzr99 100  bb.10:101    ; CHECK-LABEL: bb.10102    ; CHECK: JumpTableDest8103    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.4104    BR killed $x10105 106  bb.11:107    ; First destination is 2^20 before reference. Just within reach of ADR.108    dead $xzr = SPACE 1048580, undef $xzr109 110  bb.12:111    ; CHECK-LABEL: bb.12112    ; CHECK: JumpTableDest32113    early-clobber $x10, dead early-clobber $x11 = JumpTableDest32 undef killed $x9, undef killed $x8, %jump-table.5114    BR killed $x10115...116---117name:            test_inline_asm_no_compress118alignment:       4119tracksRegLiveness: true120liveins:121  - { reg: '$w0' }122  - { reg: '$w1' }123  - { reg: '$w2' }124frameInfo:125  maxAlignment:    1126  maxCallFrameSize: 0127machineFunctionInfo:128  hasRedZone:      false129jumpTable:130  kind:            label-difference32131  entries:132    - id:              0133      blocks:          [ '%bb.2', '%bb.4', '%bb.5', '%bb.6', '%bb.7', '%bb.8' ]134body:             |135  bb.0:136    successors: %bb.3(0x12492492), %bb.1(0x6db6db6e)137    liveins: $w0, $w1, $w2138  139    dead $wzr = SUBSWri renamable $w0, 5, 0, implicit-def $nzcv140    Bcc 8, %bb.3, implicit $nzcv141  142  bb.1:143    successors: %bb.2, %bb.4, %bb.5, %bb.6, %bb.7, %bb.8144    liveins: $w0, $w1, $w2145    ; We check that if there's an inline asm instruction in the jump table,146    ; that we skip compression. This is due to not being able to rely on147    ; finding the instruction size in some cases.148    ; CHECK-LABEL: test_inline_asm_no_compress149    ; CHECK-LABEL: bb.1150    ; CHECK: JumpTableDest32151    renamable $w8 = ORRWrs $wzr, killed renamable $w0, 0, implicit-def $x8152    $x9 = ADRP target-flags(aarch64-page) %jump-table.0153    renamable $x9 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-nc) %jump-table.0, 0154    early-clobber renamable $x10, dead early-clobber renamable $x11 = JumpTableDest32 killed renamable $x9, killed renamable $x8, %jump-table.0155    BR killed renamable $x10156  157  bb.2:158    liveins: $w1, $w2159  160    INLINEASM &".byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09", 1 /* sideeffect attdialect */161    INLINEASM &".byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09.byte 0x1f,0x20,0x03,0xd5,0x1f,0x20,0x03,0xd5\0A\09", 1 /* sideeffect attdialect */162    $w0 = ADDWrs killed renamable $w2, killed renamable $w1, 0163    RET undef $lr, implicit $w0164  165  bb.3:166    $w0 = MOVZWi 0, 0167    RET undef $lr, implicit $w0168  169  bb.4:170    liveins: $w1, $w2171  172    renamable $w0 = nsw MADDWrrr killed renamable $w2, killed renamable $w1, $wzr173    RET undef $lr, implicit $w0174  175  bb.5:176    liveins: $w1, $w2177  178    $w0 = SUBWrs killed renamable $w1, killed renamable $w2, 0179    RET undef $lr, implicit $w0180  181  bb.6:182    liveins: $w1, $w2183  184    $w0 = SUBWrs killed renamable $w2, killed renamable $w1, 0185    RET undef $lr, implicit $w0186  187  bb.7:188    liveins: $w1, $w2189  190    renamable $w0 = MADDWrrr killed renamable $w1, renamable $w1, killed renamable $w2191    RET undef $lr, implicit $w0192  193  bb.8:194    liveins: $w1, $w2195  196    renamable $w8 = nsw MADDWrrr renamable $w2, renamable $w2, $wzr197    renamable $w0 = MADDWrrr killed renamable $w8, killed renamable $w2, killed renamable $w1198    RET undef $lr, implicit $w0199 200...201---202name:            test_bb_alignment_not_byte_compressable203alignment:       4204tracksRegLiveness: true205liveins:206  - { reg: '$w0' }207  - { reg: '$w1' }208  - { reg: '$w2' }209frameInfo:210  maxAlignment:    1211  maxCallFrameSize: 0212machineFunctionInfo:213  hasRedZone:      false214jumpTable:215  kind:            label-difference32216  entries:217    - id:              0218      blocks:          [ '%bb.2', '%bb.4', '%bb.5', '%bb.6', '%bb.7', '%bb.8' ]219body:             |220  bb.0:221    successors: %bb.3(0x12492492), %bb.1(0x6db6db6e)222    liveins: $w0, $w1, $w2223 224    dead $wzr = SUBSWri renamable $w0, 5, 0, implicit-def $nzcv225    Bcc 8, %bb.3, implicit $nzcv226 227  bb.1:228    successors: %bb.2, %bb.4, %bb.5, %bb.6, %bb.7, %bb.8229    liveins: $w0, $w1, $w2230    ; Ensure there's no jump table compression when block alignments are bigger231    ; than the function alignment because we don't known the padding length at232    ; the point where compression is done.233    ; CHECK-LABEL: test_bb_alignment_not_byte_compressable234    ; CHECK-LABEL: bb.1235    ; CHECK: JumpTableDest16236    renamable $w8 = ORRWrs $wzr, killed renamable $w0, 0, implicit-def $x8237    $x9 = ADRP target-flags(aarch64-page) %jump-table.0238    renamable $x9 = ADDXri $x9, target-flags(aarch64-pageoff, aarch64-nc) %jump-table.0, 0239    early-clobber renamable $x10, dead early-clobber renamable $x11 = JumpTableDest32 killed renamable $x9, killed renamable $x8, %jump-table.0240    BR killed renamable $x10241 242  bb.2:243    liveins: $w1, $w2244    $w0 = ADDWrs killed renamable $w2, killed renamable $w1, 0245    RET undef $lr, implicit $w0246 247  bb.3:248    $w0 = MOVZWi 0, 0249    RET undef $lr, implicit $w0250 251  bb.4:252    liveins: $w1, $w2253 254    renamable $w0 = nsw MADDWrrr killed renamable $w2, killed renamable $w1, $wzr255    RET undef $lr, implicit $w0256 257  ; bb.5 is aligned to make it more that 256 instructions away from bb.1, which258  ; means we can no longer assume the jump table will be byte indexable.259  bb.5 (align 1024):260    liveins: $w1, $w2261 262    $w0 = SUBWrs killed renamable $w1, killed renamable $w2, 0263    RET undef $lr, implicit $w0264 265  bb.6:266    liveins: $w1, $w2267 268    $w0 = SUBWrs killed renamable $w2, killed renamable $w1, 0269    RET undef $lr, implicit $w0270 271  bb.7:272    liveins: $w1, $w2273 274    renamable $w0 = MADDWrrr killed renamable $w1, renamable $w1, killed renamable $w2275    RET undef $lr, implicit $w0276 277  bb.8:278    liveins: $w1, $w2279 280    renamable $w8 = nsw MADDWrrr renamable $w2, renamable $w2, $wzr281    renamable $w0 = MADDWrrr killed renamable $w8, killed renamable $w2, killed renamable $w1282    RET undef $lr, implicit $w0283 284...285