1; RUN: llc -O0 -fast-isel -fast-isel-abort=1 -verify-machineinstrs -mtriple=arm64-apple-darwin < %s | FileCheck %s
2
3@fn.table = internal global [2 x i8*] [i8* blockaddress(@fn, %ZERO), i8* blockaddress(@fn, %ONE)], align 8
4
5define i32 @fn(i32 %target) nounwind {
6entry:
7; CHECK-LABEL: fn
8  %retval = alloca i32, align 4
9  %target.addr = alloca i32, align 4
10  store i32 %target, i32* %target.addr, align 4
11  %0 = load i32, i32* %target.addr, align 4
12  %idxprom = zext i32 %0 to i64
13  %arrayidx = getelementptr inbounds [2 x i8*], [2 x i8*]* @fn.table, i32 0, i64 %idxprom
14  %1 = load i8*, i8** %arrayidx, align 8
15  br label %indirectgoto
16
17ZERO:                                             ; preds = %indirectgoto
18; CHECK: LBB0_1
19  store i32 0, i32* %retval
20  br label %return
21
22ONE:                                              ; preds = %indirectgoto
23; CHECK: LBB0_2
24  store i32 1, i32* %retval
25  br label %return
26
27return:                                           ; preds = %ONE, %ZERO
28  %2 = load i32, i32* %retval
29  ret i32 %2
30
31indirectgoto:                                     ; preds = %entry
32; CHECK:      ldr [[REG:x[0-9]+]], [sp]
33; CHECK-NEXT: br [[REG]]
34  %indirect.goto.dest = phi i8* [ %1, %entry ]
35  indirectbr i8* %indirect.goto.dest, [label %ZERO, label %ONE]
36}
37