1; RUN: llc -mtriple=aarch64-none-linux-gnu -aarch64-enable-atomic-cfg-tidy=0 -verify-machineinstrs < %s | FileCheck %s
2; RUN: llc -code-model=large -mtriple=aarch64-none-linux-gnu -aarch64-enable-atomic-cfg-tidy=0 -verify-machineinstrs < %s | FileCheck --check-prefix=CHECK-LARGE %s
3
4@addr = global i8* null
5
6define void @test_blockaddress() {
7; CHECK-LABEL: test_blockaddress:
8  store volatile i8* blockaddress(@test_blockaddress, %block), i8** @addr
9  %val = load volatile i8*, i8** @addr
10  indirectbr i8* %val, [label %block]
11; CHECK: adrp [[DEST_HI:x[0-9]+]], [[DEST_LBL:.Ltmp[0-9]+]]
12; CHECK: add [[DEST:x[0-9]+]], [[DEST_HI]], {{#?}}:lo12:[[DEST_LBL]]
13; CHECK: str [[DEST]],
14; CHECK: ldr [[NEWDEST:x[0-9]+]]
15; CHECK: br [[NEWDEST]]
16
17; CHECK-LARGE: movz [[ADDR_REG:x[0-9]+]], #:abs_g0_nc:[[DEST_LBL:.Ltmp[0-9]+]]
18; CHECK-LARGE: movk [[ADDR_REG]], #:abs_g1_nc:[[DEST_LBL]]
19; CHECK-LARGE: movk [[ADDR_REG]], #:abs_g2_nc:[[DEST_LBL]]
20; CHECK-LARGE: movk [[ADDR_REG]], #:abs_g3:[[DEST_LBL]]
21; CHECK-LARGE: str [[ADDR_REG]],
22; CHECK-LARGE: ldr [[NEWDEST:x[0-9]+]]
23; CHECK-LARGE: br [[NEWDEST]]
24
25block:
26  ret void
27}
28