1 ; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-enable-global-merge -global-merge-on-external -o - | FileCheck %s
2 ; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-enable-global-merge -global-merge-on-external -o - | FileCheck %s
3 ; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-enable-global-merge -global-merge-on-external -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
5 @x = dso_local global i32 0, align 4
6 @y = dso_local global i32 0, align 4
7 @z = dso_local global i32 0, align 4
9 define dso_local void @f1(i32 %a1, i32 %a2) {
10 ;CHECK-APPLE-IOS-LABEL: _f1:
11 ;CHECK-APPLE-IOS-NOT: adrp
12 ;CHECK-APPLE-IOS: adrp x8, __MergedGlobals_x@PAGE
13 ;CHECK-APPLE-IOS: add x8, x8, __MergedGlobals_x@PAGEOFF
14 ;CHECK-APPLE-IOS-NOT: adrp
15 store i32 %a1, ptr @x, align 4
16 store i32 %a2, ptr @y, align 4
20 define dso_local void @g1(i32 %a1, i32 %a2) {
21 ;CHECK-APPLE-IOS-LABEL: _g1:
22 ;CHECK-APPLE-IOS: adrp x8, __MergedGlobals_x@PAGE
23 ;CHECK-APPLE-IOS: add x8, x8, __MergedGlobals_x@PAGEOFF
24 ;CHECK-APPLE-IOS-NOT: adrp
25 store i32 %a1, ptr @y, align 4
26 store i32 %a2, ptr @z, align 4
30 ;CHECK: .type .L_MergedGlobals,@object // @_MergedGlobals
31 ;CHECK: .local .L_MergedGlobals
32 ;CHECK: .comm .L_MergedGlobals,12,4
35 ;CHECK: .set x, .L_MergedGlobals
38 ;CHECK: .set y, .L_MergedGlobals+4
41 ;CHECK: .set z, .L_MergedGlobals+8
44 ;CHECK-APPLE-IOS: .zerofill __DATA,__common,__MergedGlobals_x,12,2
46 ;CHECK-APPLE-IOS: .globl _x
47 ;CHECK-APPLE-IOS: .set {{.*}}, __MergedGlobals_x
48 ;CHECK-APPLE-IOS: .globl _y
49 ;CHECK-APPLE-IOS: .set _y, __MergedGlobals_x+4
50 ;CHECK-APPLE-IOS: .globl _z
51 ;CHECK-APPLE-IOS: .set _z, __MergedGlobals_x+8
52 ;CHECK-APPLE-IOS: .subsections_via_symbols