brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.8 KiB · aad6caa Raw
151 lines · plain
1# RUN: llc -mtriple=x86_64 -run-pass none -o - %s | FileCheck %s2# This test ensures that the MIR parser parses the jump table info and jump3# table operands correctly.4 5--- |6 7  define i32 @test_jumptable(i32 %in) {8  entry:9    switch i32 %in, label %def [10      i32 0, label %lbl111      i32 1, label %lbl212      i32 2, label %lbl313      i32 3, label %lbl414    ]15 16  def:17    ret i32 018 19  lbl1:20    ret i32 121 22  lbl2:23    ret i32 224 25  lbl3:26    ret i32 427 28  lbl4:29    ret i32 830  }31 32  define i32 @test_jumptable2(i32 %in) {33  entry:34    switch i32 %in, label %def [35      i32 0, label %lbl136      i32 1, label %lbl237      i32 2, label %lbl338      i32 3, label %lbl439    ]40 41  def:42    ret i32 043 44  lbl1:45    ret i32 146 47  lbl2:48    ret i32 249 50  lbl3:51    ret i32 452 53  lbl4:54    ret i32 855  }56 57...58---59name:            test_jumptable60# CHECK:      jumpTable:61# CHECK-NEXT: kind: label-difference3262# CHECK-NEXT: entries:63# CHECK-NEXT: - id: 064# CHECK-NEXT: blocks: [ '%bb.3', '%bb.4', '%bb.5', '%bb.6' ]65# CHECK-NEXT: body:66jumpTable:67  kind:          label-difference3268  entries:69    - id:        070      blocks:    [ '%bb.3', '%bb.4', '%bb.5', '%bb.6' ]71body: |72  bb.0.entry:73    successors: %bb.2, %bb.174 75    $eax = MOV32rr $edi, implicit-def $rax76    CMP32ri8 $edi, 3, implicit-def $eflags77    JCC_1 %bb.2, 7, implicit $eflags78 79  bb.1.entry:80    successors: %bb.3, %bb.4, %bb.5, %bb.681    ; CHECK: $rcx = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg82    $rcx = LEA64r $rip, 1, _, %jump-table.0, _83    $rax = MOVSX64rm32 $rcx, 4, $rax, 0, _84    $rax = ADD64rr $rax, $rcx, implicit-def $eflags85    JMP64r $rax86 87  bb.2.def:88    $eax = MOV32r0 implicit-def $eflags89    RET64 $eax90 91  bb.3.lbl1:92    $eax = MOV32ri 193    RET64 $eax94 95  bb.4.lbl2:96    $eax = MOV32ri 297    RET64 $eax98 99  bb.5.lbl3:100    $eax = MOV32ri 4101    RET64 $eax102 103  bb.6.lbl4:104    $eax = MOV32ri 8105    RET64 $eax106...107---108name:            test_jumptable2109jumpTable:110  kind:          label-difference32111  entries:112    - id:        1113      blocks:    [ '%bb.3', '%bb.4', '%bb.5', '%bb.6' ]114body: |115  bb.0.entry:116    successors: %bb.2, %bb.1117 118    $eax = MOV32rr $edi, implicit-def $rax119    CMP32ri8 $edi, 3, implicit-def $eflags120    JCC_1 %bb.2, 7, implicit $eflags121 122  bb.1.entry:123    successors: %bb.3, %bb.4, %bb.5, %bb.6124    ; Verify that the printer will use an id of 0 for this jump table:125    ; CHECK: $rcx = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg126    $rcx = LEA64r $rip, 1, _, %jump-table.1, _127    $rax = MOVSX64rm32 $rcx, 4, $rax, 0, _128    $rax = ADD64rr $rax, $rcx, implicit-def $eflags129    JMP64r $rax130 131  bb.2.def:132    $eax = MOV32r0 implicit-def $eflags133    RET64 $eax134 135  bb.3.lbl1:136    $eax = MOV32ri 1137    RET64 $eax138 139  bb.4.lbl2:140    $eax = MOV32ri 2141    RET64 $eax142 143  bb.5.lbl3:144    $eax = MOV32ri 4145    RET64 $eax146 147  bb.6.lbl4:148    $eax = MOV32ri 8149    RET64 $eax150...151