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