llvm/llvm/test/CodeGen/X86/2009-08-12-badswitch.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s | FileCheck %s
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-apple-darwin10"

declare void @f1() nounwind readnone
declare void @f2() nounwind readnone
declare void @f3() nounwind readnone
declare void @f4() nounwind readnone
declare void @f5() nounwind readnone
declare void @f6() nounwind readnone
declare void @f7() nounwind readnone
declare void @f8() nounwind readnone
declare void @f9() nounwind readnone
declare void @f10() nounwind readnone
declare void @f11() nounwind readnone
declare void @f12() nounwind readnone
declare void @f13() nounwind readnone
declare void @f14() nounwind readnone
declare void @f15() nounwind readnone
declare void @f16() nounwind readnone
declare void @f17() nounwind readnone
declare void @f18() nounwind readnone
declare void @f19() nounwind readnone
declare void @f20() nounwind readnone
declare void @f21() nounwind readnone
declare void @f22() nounwind readnone
declare void @f23() nounwind readnone
declare void @f24() nounwind readnone
declare void @f25() nounwind readnone
declare void @f26() nounwind readnone

define internal fastcc i32 @foo(i64 %bar) nounwind ssp {
; CHECK-LABEL: foo:
; CHECK:       ## %bb.0: ## %entry
; CHECK-NEXT:    pushq %rax
; CHECK-NEXT:    addq $-2, %rdi
; CHECK-NEXT:    cmpq $25, %rdi
; CHECK-NEXT:    ja LBB0_2
; CHECK-NEXT:  ## %bb.1: ## %bb49
; CHECK-NEXT:    leaq LJTI0_0(%rip), %rax
; CHECK-NEXT:    movslq (%rax,%rdi,4), %rcx
; CHECK-NEXT:    addq %rax, %rcx
; CHECK-NEXT:    jmpq *%rcx
; CHECK-NEXT:  LBB0_3: ## %RRETURN_6
; CHECK-NEXT:    callq _f2
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_18: ## %RRETURN_29
; CHECK-NEXT:    callq _f17
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_16: ## %RRETURN_27
; CHECK-NEXT:    callq _f15
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_13: ## %RRETURN_22
; CHECK-NEXT:    callq _f12
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_6: ## %RRETURN_15
; CHECK-NEXT:    callq _f5
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_14: ## %RRETURN_24
; CHECK-NEXT:    callq _f13
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_11: ## %RRETURN_20
; CHECK-NEXT:    callq _f10
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_27: ## %RRETURN_1
; CHECK-NEXT:    callq _f26
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_26: ## %RRETURN_52
; CHECK-NEXT:    callq _f25
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_4: ## %RRETURN_7
; CHECK-NEXT:    callq _f3
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_17: ## %RRETURN_28
; CHECK-NEXT:    callq _f16
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_5: ## %RRETURN_14
; CHECK-NEXT:    callq _f4
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_9: ## %RRETURN_18
; CHECK-NEXT:    callq _f8
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_19: ## %RRETURN_30
; CHECK-NEXT:    callq _f18
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_22: ## %RRETURN_40
; CHECK-NEXT:    callq _f21
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_7: ## %RRETURN_16
; CHECK-NEXT:    callq _f6
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_23: ## %RRETURN_42
; CHECK-NEXT:    callq _f22
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_15: ## %RRETURN_26
; CHECK-NEXT:    callq _f14
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_8: ## %RRETURN_17
; CHECK-NEXT:    callq _f7
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_20: ## %RRETURN_31
; CHECK-NEXT:    callq _f19
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_12: ## %RRETURN_21
; CHECK-NEXT:    callq _f11
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_10: ## %RRETURN_19
; CHECK-NEXT:    callq _f9
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_24: ## %RRETURN_44
; CHECK-NEXT:    callq _f23
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_21: ## %RRETURN_38
; CHECK-NEXT:    callq _f20
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_25: ## %RRETURN_48
; CHECK-NEXT:    callq _f24
; CHECK-NEXT:    jmp LBB0_28
; CHECK-NEXT:  LBB0_2: ## %RETURN
; CHECK-NEXT:    callq _f1
; CHECK-NEXT:  LBB0_28: ## %EXIT
; CHECK-NEXT:    xorl %eax, %eax
; CHECK-NEXT:    popq %rcx
; CHECK-NEXT:    retq
; CHECK-NEXT:    .p2align 2
; CHECK-NEXT:    .data_region jt32
; CHECK-NEXT:  .set L0_0_set_3, LBB0_3-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_4, LBB0_4-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_5, LBB0_5-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_6, LBB0_6-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_7, LBB0_7-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_8, LBB0_8-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_9, LBB0_9-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_10, LBB0_10-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_11, LBB0_11-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_12, LBB0_12-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_13, LBB0_13-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_14, LBB0_14-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_15, LBB0_15-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_16, LBB0_16-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_17, LBB0_17-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_18, LBB0_18-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_19, LBB0_19-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_20, LBB0_20-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_21, LBB0_21-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_22, LBB0_22-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_23, LBB0_23-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_24, LBB0_24-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_25, LBB0_25-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_26, LBB0_26-LJTI0_0
; CHECK-NEXT:  .set L0_0_set_27, LBB0_27-LJTI0_0
; CHECK-NEXT:  LJTI0_0:
; CHECK-NEXT:    .long L0_0_set_3
; CHECK-NEXT:    .long L0_0_set_3
; CHECK-NEXT:    .long L0_0_set_4
; CHECK-NEXT:    .long L0_0_set_5
; CHECK-NEXT:    .long L0_0_set_6
; CHECK-NEXT:    .long L0_0_set_7
; CHECK-NEXT:    .long L0_0_set_8
; CHECK-NEXT:    .long L0_0_set_9
; CHECK-NEXT:    .long L0_0_set_10
; CHECK-NEXT:    .long L0_0_set_11
; CHECK-NEXT:    .long L0_0_set_12
; CHECK-NEXT:    .long L0_0_set_13
; CHECK-NEXT:    .long L0_0_set_14
; CHECK-NEXT:    .long L0_0_set_15
; CHECK-NEXT:    .long L0_0_set_16
; CHECK-NEXT:    .long L0_0_set_17
; CHECK-NEXT:    .long L0_0_set_18
; CHECK-NEXT:    .long L0_0_set_19
; CHECK-NEXT:    .long L0_0_set_20
; CHECK-NEXT:    .long L0_0_set_21
; CHECK-NEXT:    .long L0_0_set_22
; CHECK-NEXT:    .long L0_0_set_23
; CHECK-NEXT:    .long L0_0_set_24
; CHECK-NEXT:    .long L0_0_set_25
; CHECK-NEXT:    .long L0_0_set_26
; CHECK-NEXT:    .long L0_0_set_27
; CHECK-NEXT:    .end_data_region
entry:
        br label %bb49

bb49:
	switch i64 %bar, label %RETURN [
		i64 2, label %RRETURN_2
		i64 3, label %RRETURN_6
		i64 4, label %RRETURN_7
		i64 5, label %RRETURN_14
		i64 6, label %RRETURN_15
		i64 7, label %RRETURN_16
		i64 8, label %RRETURN_17
		i64 9, label %RRETURN_18
		i64 10, label %RRETURN_19
		i64 11, label %RRETURN_20
		i64 12, label %RRETURN_21
		i64 13, label %RRETURN_22
		i64 14, label %RRETURN_24
		i64 15, label %RRETURN_26
		i64 16, label %RRETURN_27
		i64 17, label %RRETURN_28
		i64 18, label %RRETURN_29
		i64 19, label %RRETURN_30
		i64 20, label %RRETURN_31
		i64 21, label %RRETURN_38
		i64 22, label %RRETURN_40
		i64 23, label %RRETURN_42
		i64 24, label %RRETURN_44
		i64 25, label %RRETURN_48
		i64 26, label %RRETURN_52
		i64 27, label %RRETURN_1
	]

RETURN:
        call void @f1()
        br label %EXIT

RRETURN_2:		; preds = %bb49
        call void @f2()
        br label %EXIT

RRETURN_6:		; preds = %bb49
        call void @f2()
        br label %EXIT

RRETURN_7:		; preds = %bb49
        call void @f3()
        br label %EXIT

RRETURN_14:		; preds = %bb49
        call void @f4()
        br label %EXIT

RRETURN_15:		; preds = %bb49
        call void @f5()
        br label %EXIT

RRETURN_16:		; preds = %bb49
        call void @f6()
        br label %EXIT

RRETURN_17:		; preds = %bb49
        call void @f7()
        br label %EXIT

RRETURN_18:		; preds = %bb49
        call void @f8()
        br label %EXIT

RRETURN_19:		; preds = %bb49
        call void @f9()
        br label %EXIT

RRETURN_20:		; preds = %bb49
        call void @f10()
        br label %EXIT

RRETURN_21:		; preds = %bb49
        call void @f11()
        br label %EXIT

RRETURN_22:		; preds = %bb49
        call void @f12()
        br label %EXIT

RRETURN_24:		; preds = %bb49
        call void @f13()
        br label %EXIT

RRETURN_26:		; preds = %bb49
        call void @f14()
        br label %EXIT

RRETURN_27:		; preds = %bb49
        call void @f15()
        br label %EXIT

RRETURN_28:		; preds = %bb49
        call void @f16()
        br label %EXIT

RRETURN_29:		; preds = %bb49
        call void @f17()
        br label %EXIT

RRETURN_30:		; preds = %bb49
        call void @f18()
        br label %EXIT

RRETURN_31:		; preds = %bb49
        call void @f19()
        br label %EXIT

RRETURN_38:		; preds = %bb49
        call void @f20()
        br label %EXIT

RRETURN_40:		; preds = %bb49
        call void @f21()
        br label %EXIT

RRETURN_42:		; preds = %bb49
        call void @f22()
        br label %EXIT

RRETURN_44:		; preds = %bb49
        call void @f23()
        br label %EXIT

RRETURN_48:		; preds = %bb49
        call void @f24()
        br label %EXIT

RRETURN_52:		; preds = %bb49
        call void @f25()
        br label %EXIT

RRETURN_1:		; preds = %bb49
        call void @f26()
        br label %EXIT

EXIT:
        ret i32 0
}