1 ; RUN: llc -mtriple=i686-pc-gnu-linux < %s | FileCheck %s
2 ; RUN: llc -mtriple=i686-pc-gnu-linux -print-after=finalize-isel %s -o /dev/null 2>&1 | FileCheck %s -check-prefix=CHECK-JT-PROB
5 ; An unreachable default destination is ignored and no compare and branch
6 ; is generated for the default values.
8 define void @foo(i32 %x, i32* %to) {
10 ; CHECK: movl 4(%esp), [[REG:%e[a-z]{2}]]
11 ; CHECK-NEXT: jmpl *.LJTI0_0(,[[REG]],4)
16 switch i32 %x, label %default [
44 ; The jump table has four entries.
45 ; CHECK-LABEL: .LJTI0_0:
46 ; CHECK-NEXT: .long .LBB0_1
47 ; CHECK-NEXT: .long .LBB0_2
48 ; CHECK-NEXT: .long .LBB0_3
49 ; CHECK-NEXT: .long .LBB0_4
50 ; CHECK-NEXT: .long .LBB0_5
51 ; CHECK-NEXT: .long .LBB0_5
54 ; Check if branch probabilities are correctly assigned to the jump table.
56 define void @bar(i32 %x, i32* %to) {
57 ; CHECK-JT-PROB-LABEL: bar:
58 ; CHECK-JT-PROB: successors: %bb.6(0x12492492), %bb.8(0x6db6db6e)
59 ; CHECK-JT-PROB: successors: %bb.1(0x15555555), %bb.2(0x15555555), %bb.3(0x15555555), %bb.4(0x15555555), %bb.5(0x2aaaaaab)
62 switch i32 %x, label %default [
92 !1 = !{!"branch_weights", i32 16, i32 16, i32 16, i32 16, i32 16, i32 16, i32 16}