1 ; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge | FileCheck %s --check-prefixes=CHECK,CHECK-MERGE
2 ; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -global-merge-on-external=true | FileCheck %s --check-prefixes=CHECK,CHECK-MERGE
3 ; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -global-merge-on-external=false | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
4 ; RUN: llc < %s -mtriple=arm-macho -arm-global-merge | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
5 ; RUN: llc < %s -mtriple=arm-eabi -arm-global-merge -relocation-model=pic | FileCheck %s --check-prefixes=CHECK,CHECK-NO-MERGE
6 ; RUN: llc < %s -mtriple=thumbv7-win32 -arm-global-merge | FileCheck %s --check-prefixes=CHECK-WIN32
8 @x = global i32 0, align 4
9 @y = global i32 0, align 4
10 @z = internal global i32 1, align 4
12 define void @f1(i32 %a1, i32 %a2) {
14 ;CHECK: ldr {{r[0-9]+}}, [[LABEL1:\.?LCPI[0-9]+_[0-9]]]
16 ;CHECK-MERGE: .long .L_MergedGlobals
17 ;CHECK-NO-MERGE: .long {{_?x}}
19 ;CHECK-WIN32: movw [[REG1:r[0-9]+]], :lower16:.L_MergedGlobals
20 ;CHECK-WIN32: movt [[REG1]], :upper16:.L_MergedGlobals
21 store i32 %a1, i32* @x, align 4
22 store i32 %a2, i32* @y, align 4
26 define void @g1(i32 %a1, i32 %a2) {
28 ;CHECK: ldr {{r[0-9]+}}, [[LABEL2:\.?LCPI[0-9]+_[0-9]]]
29 ;CHECK: ldr {{r[0-9]+}}, [[LABEL3:\.?LCPI[0-9]+_[0-9]]]
31 ;CHECK-MERGE: .long {{_?z}}
33 ;CHECK-MERGE: .long .L_MergedGlobals
34 ;CHECK-NO-MERGE: .long {{_?y}}
36 ;CHECK-WIN32: movw [[REG2:r[0-9]+]], :lower16:z
37 ;CHECK-WIN32: movt [[REG2]], :upper16:z
38 ;CHECK-WIN32: movw [[REG3:r[0-9]+]], :lower16:.L_MergedGlobals
39 ;CHECK-WIN32: movt [[REG3]], :upper16:.L_MergedGlobals
40 store i32 %a1, i32* @y, align 4
41 store i32 %a2, i32* @z, align 4
45 ;CHECK-NO-MERGE-NOT: .globl .L_MergedGlobals
47 ;CHECK-MERGE: .type .L_MergedGlobals,%object
48 ;CHECK-MERGE: .local .L_MergedGlobals
49 ;CHECK-MERGE: .comm .L_MergedGlobals,8,4
50 ;CHECK-WIN32: .lcomm .L_MergedGlobals,8,4
52 ;CHECK-MERGE: .globl x
53 ;CHECK-MERGE: .set x, .L_MergedGlobals
54 ;CHECK-MERGE: .size x, 4
55 ;CHECK-MERGE: .globl y
56 ;CHECK-MERGE: .set y, .L_MergedGlobals+4
57 ;CHECK-MERGE: .size y, 4
58 ;CHECK-MERGE-NOT: .set z, .L_MergedGlobals+8
61 ;CHECK-WIN32: .globl x
62 ;CHECK-WIN32: .set x, .L_MergedGlobals
63 ;CHECK-WIN32: .globl y
64 ;CHECK-WIN32: .set y, .L_MergedGlobals+4
65 ;CHECK-WIN32-NOT: .set z, .L_MergedGlobals+8