1 ; RUN: llc %s -mtriple=aarch64-none-linux-gnu -aarch64-enable-global-merge -global-merge-on-external -disable-post-ra -o - | FileCheck %s
2 ; RUN: llc %s -mtriple=aarch64-linux-gnuabi -aarch64-enable-global-merge -global-merge-on-external -disable-post-ra -o - | FileCheck %s
3 ; RUN: llc %s -mtriple=aarch64-apple-ios -aarch64-enable-global-merge -global-merge-on-external -disable-post-ra -o - | FileCheck %s --check-prefix=CHECK-APPLE-IOS
5 @x = global [100 x i32] zeroinitializer, align 1
6 @y = global [100 x i32] zeroinitializer, align 1
7 @z = internal global i32 1, align 4
9 define void @f1(i32 %a1, i32 %a2, i32 %a3) {
10 ;CHECK-APPLE-IOS: adrp x8, __MergedGlobals_x@PAGE+12
11 ;CHECK-APPLE-IOS-NOT: adrp
12 ;CHECK-APPLE-IOS: add x8, x8, __MergedGlobals_x@PAGEOFF+12
13 ;CHECK-APPLE-IOS: adrp x9, _z@PAGE
14 ;CHECK-APPLE-IOS: str w0, [x8]
15 ;CHECK-APPLE-IOS: str w1, [x8, #400]
16 ;CHECK-APPLE-IOS: str w2, [x9, _z@PAGEOFF]
17 ;CHECK: adrp x8, .L_MergedGlobals+12
18 ;CHECK: add x8, x8, :lo12:.L_MergedGlobals+12
21 ;CHECK: str w1, [x8, #400]
22 ;CHECK: str w2, [x9, :lo12:z]
23 %x3 = getelementptr inbounds [100 x i32], [100 x i32]* @x, i32 0, i64 3
24 %y3 = getelementptr inbounds [100 x i32], [100 x i32]* @y, i32 0, i64 3
25 store i32 %a1, i32* %x3, align 4
26 store i32 %a2, i32* %y3, align 4
27 store i32 %a3, i32* @z, align 4
31 ;CHECK-APPLE-IOS: .globl __MergedGlobals_x
32 ;CHECK-APPLE-IOS: .zerofill __DATA,__common,__MergedGlobals_x,800,2
33 ;CHECK-APPLE-IOS: .set _x, __MergedGlobals_x
34 ;CHECK-APPLE-IOS: .set _y, __MergedGlobals_x+400
36 ;CHECK: .type .L_MergedGlobals,@object // @_MergedGlobals
37 ;CHECK: .local .L_MergedGlobals
38 ;CHECK: .comm .L_MergedGlobals,800,4
40 ;CHECK: .set x, .L_MergedGlobals
42 ;CHECK: .set y, .L_MergedGlobals+400
43 ;CHECK-NOT: .set z, .L_MergedGlobals