1 # RUN: llc -march=x86-64 -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' ]
73 successors: %bb.2.def, %bb.1.entry
75 %eax = MOV32rr %edi, implicit-def %rax
76 CMP32ri8 %edi, 3, implicit-def %eflags
77 JA_1 %bb.2.def, implicit %eflags
80 successors: %bb.3.lbl1, %bb.4.lbl2, %bb.5.lbl3, %bb.6.lbl4
81 ; CHECK: %rcx = LEA64r %rip, 1, _, %jump-table.0, _
82 %rcx = LEA64r %rip, 1, _, %jump-table.0, _
83 %rax = MOVSX64rm32 %rcx, 4, %rax, 0, _
84 %rax = ADD64rr %rax, %rcx, implicit-def %eflags
88 %eax = MOV32r0 implicit-def %eflags
108 name: test_jumptable2
110 kind: label-difference32
113 blocks: [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
116 successors: %bb.2.def, %bb.1.entry
118 %eax = MOV32rr %edi, implicit-def %rax
119 CMP32ri8 %edi, 3, implicit-def %eflags
120 JA_1 %bb.2.def, implicit %eflags
123 successors: %bb.3.lbl1, %bb.4.lbl2, %bb.5.lbl3, %bb.6.lbl4
124 ; Verify that the printer will use an id of 0 for this jump table:
125 ; CHECK: %rcx = LEA64r %rip, 1, _, %jump-table.0, _
126 %rcx = LEA64r %rip, 1, _, %jump-table.1, _
127 %rax = MOVSX64rm32 %rcx, 4, %rax, 0, _
128 %rax = ADD64rr %rax, %rcx, implicit-def %eflags
132 %eax = MOV32r0 implicit-def %eflags