1 # RUN: llc -start-after branch-folder -stop-after branch-folder -o /dev/null %s | FileCheck %s
2 # This test ensures that the MIR parser parses the jump table info and jump
3 # table operands correctly.
7 define i32 @test_jumptable(i32 %in) {
9 switch i32 %in, label %def [
32 define i32 @test_jumptable2(i32 %in) {
34 switch i32 %in, label %def [
61 # CHECK-NEXT: kind: label-difference32
62 # CHECK-NEXT: entries:
64 # CHECK-NEXT: blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
67 kind: label-difference32
70 blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
74 successors: [ '%bb.2.def', '%bb.1.entry' ]
76 - '%eax = MOV32rr %edi, implicit-def %rax'
77 - 'CMP32ri8 %edi, 3, implicit-def %eflags'
78 - 'JA_1 %bb.2.def, implicit %eflags'
81 successors: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
83 # CHECK: %rcx = LEA64r %rip, 1, _, %jump-table.0, _
84 - '%rcx = LEA64r %rip, 1, _, %jump-table.0, _'
85 - '%rax = MOVSX64rm32 %rcx, 4, %rax, 0, _'
86 - '%rax = ADD64rr %rax, %rcx, implicit-def %eflags'
91 - '%eax = MOV32r0 implicit-def %eflags'
115 name: test_jumptable2
117 kind: label-difference32
120 blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
124 successors: [ '%bb.2.def', '%bb.1.entry' ]
126 - '%eax = MOV32rr %edi, implicit-def %rax'
127 - 'CMP32ri8 %edi, 3, implicit-def %eflags'
128 - 'JA_1 %bb.2.def, implicit %eflags'
131 successors: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
133 # Verify that the printer will use an id of 0 for this jump table:
134 # CHECK: %rcx = LEA64r %rip, 1, _, %jump-table.0, _
135 - '%rcx = LEA64r %rip, 1, _, %jump-table.1, _'
136 - '%rax = MOVSX64rm32 %rcx, 4, %rax, 0, _'
137 - '%rax = ADD64rr %rax, %rcx, implicit-def %eflags'
142 - '%eax = MOV32r0 implicit-def %eflags'