• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: not llc -march=x86-64 -start-after branch-folder -stop-after branch-folder -o /dev/null %s 2>&1 | FileCheck %s
2
3--- |
4
5  define i32 @test_jumptable(i32 %in) {
6  entry:
7    switch i32 %in, label %def [
8      i32 0, label %lbl1
9      i32 1, label %lbl2
10      i32 2, label %lbl3
11      i32 3, label %lbl4
12    ]
13
14  def:
15    ret i32 0
16
17  lbl1:
18    ret i32 1
19
20  lbl2:
21    ret i32 2
22
23  lbl3:
24    ret i32 4
25
26  lbl4:
27    ret i32 8
28  }
29
30...
31---
32name:            test_jumptable
33jumpTable:
34  kind:          label-difference32
35  entries:
36    - id:        0
37      blocks:    [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
38# CHECK: [[@LINE+1]]:18: redefinition of jump table entry '%jump-table.0'
39    - id:        0
40      blocks:    [ '%bb.3.lbl1', '%bb.4.lbl2', '%bb.5.lbl3', '%bb.6.lbl4' ]
41body: |
42  bb.0.entry:
43    successors: %bb.2.def, %bb.1.entry
44
45    %eax = MOV32rr %edi, implicit-def %rax
46    CMP32ri8 %edi, 3, implicit-def %eflags
47    JA_1 %bb.2.def, implicit %eflags
48
49  bb.1.entry:
50    successors: %bb.3.lbl1, %bb.4.lbl2, %bb.5.lbl3, %bb.6.lbl4
51
52    %rcx = LEA64r %rip, 1, _, %jump-table.0, _
53    %rax = MOVSX64rm32 %rcx, 4, %rax, 0, _
54    %rax = ADD64rr %rax, %rcx, implicit-def %eflags
55    JMP64r %rax
56
57  bb.2.def:
58    %eax = MOV32r0 implicit-def %eflags
59    RETQ %eax
60
61  bb.3.lbl1:
62    %eax = MOV32ri 1
63    RETQ %eax
64
65  bb.4.lbl2:
66    %eax = MOV32ri 2
67    RETQ %eax
68
69  bb.5.lbl3:
70    %eax = MOV32ri 4
71    RETQ %eax
72
73  bb.6.lbl4:
74    %eax = MOV32ri 8
75    RETQ %eax
76...
77