1 # RUN: llc -march=x86-64 -run-pass none -o - %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', '%bb.4', '%bb.5', '%bb.6' ]
67 kind: label-difference32
70 blocks: [ '%bb.3', '%bb.4', '%bb.5', '%bb.6' ]
73 successors: %bb.2, %bb.1
75 $eax = MOV32rr $edi, implicit-def $rax
76 CMP32ri8 $edi, 3, implicit-def $eflags
77 JCC_1 %bb.2, 7, implicit $eflags
80 successors: %bb.3, %bb.4, %bb.5, %bb.6
81 ; CHECK: $rcx = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg
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', '%bb.4', '%bb.5', '%bb.6' ]
116 successors: %bb.2, %bb.1
118 $eax = MOV32rr $edi, implicit-def $rax
119 CMP32ri8 $edi, 3, implicit-def $eflags
120 JCC_1 %bb.2, 7, implicit $eflags
123 successors: %bb.3, %bb.4, %bb.5, %bb.6
124 ; Verify that the printer will use an id of 0 for this jump table:
125 ; CHECK: $rcx = LEA64r $rip, 1, $noreg, %jump-table.0, $noreg
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