• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -mtriple=aarch64-apple-ios -asm-verbose=false -aarch64-collect-loh=false \
2; RUN:   -aarch64-global-merge -global-merge-group-by-use -global-merge-ignore-single-use \
3; RUN:   %s -o - | FileCheck %s
4
5; We assume that globals of the same size aren't reordered inside a set.
6
7@m1 = internal global i32 0, align 4
8@n1 = internal global i32 0, align 4
9@o1 = internal global i32 0, align 4
10
11; CHECK-LABEL: f1:
12define void @f1(i32 %a1, i32 %a2) #0 {
13; CHECK-NEXT: adrp x8, [[SET:l__MergedGlobals]]@PAGE
14; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
15; CHECK-NEXT: stp w0, w1, [x8]
16; CHECK-NEXT: ret
17  store i32 %a1, i32* @m1, align 4
18  store i32 %a2, i32* @n1, align 4
19  ret void
20}
21
22@m2 = internal global i32 0, align 4
23@n2 = internal global i32 0, align 4
24
25; CHECK-LABEL: f2:
26define void @f2(i32 %a1, i32 %a2, i32 %a3) #0 {
27; CHECK-NEXT: adrp x8, [[SET]]@PAGE
28; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
29; CHECK-NEXT: stp w0, w1, [x8]
30; CHECK-NEXT: str w2, [x8, #8]
31; CHECK-NEXT: ret
32  store i32 %a1, i32* @m1, align 4
33  store i32 %a2, i32* @n1, align 4
34  store i32 %a3, i32* @o1, align 4
35  ret void
36}
37
38; CHECK-LABEL: f3:
39define void @f3(i32 %a1, i32 %a2) #0 {
40; CHECK-NEXT: adrp x8, [[SET]]@PAGE
41; CHECK-NEXT: add x8, x8, [[SET]]@PAGEOFF
42; CHECK-NEXT: stp w0, w1, [x8, #12]
43; CHECK-NEXT: ret
44  store i32 %a1, i32* @m2, align 4
45  store i32 %a2, i32* @n2, align 4
46  ret void
47}
48
49@o2 = internal global i32 0, align 4
50
51; CHECK-LABEL: f4:
52define void @f4(i32 %a1) #0 {
53; CHECK-NEXT: adrp x8, _o2@PAGE
54; CHECK-NEXT: str w0, [x8, _o2@PAGEOFF]
55; CHECK-NEXT: ret
56  store i32 %a1, i32* @o2, align 4
57  ret void
58}
59
60; CHECK-DAG: .zerofill __DATA,__bss,[[SET]],20,4
61; CHECK-DAG: .zerofill __DATA,__bss,_o2,4,2
62
63attributes #0 = { nounwind }
64