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 7 8@x = global i32 0, align 4 9@y = global i32 0, align 4 10@z = internal global i32 1, align 4 11 12define void @f1(i32 %a1, i32 %a2) { 13;CHECK: f1: 14;CHECK: ldr {{r[0-9]+}}, [[LABEL1:\.?LCPI[0-9]+_[0-9]]] 15;CHECK: [[LABEL1]]: 16;CHECK-MERGE: .long .L_MergedGlobals 17;CHECK-NO-MERGE: .long {{_?x}} 18;CHECK-WIN32: f1: 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 23 ret void 24} 25 26define void @g1(i32 %a1, i32 %a2) { 27;CHECK: g1: 28;CHECK: ldr {{r[0-9]+}}, [[LABEL2:\.?LCPI[0-9]+_[0-9]]] 29;CHECK: ldr {{r[0-9]+}}, [[LABEL3:\.?LCPI[0-9]+_[0-9]]] 30;CHECK: [[LABEL2]]: 31;CHECK-MERGE: .long {{_?z}} 32;CHECK: [[LABEL3]]: 33;CHECK-MERGE: .long .L_MergedGlobals 34;CHECK-NO-MERGE: .long {{_?y}} 35;CHECK-WIN32: g1: 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 42 ret void 43} 44 45;CHECK-NO-MERGE-NOT: .globl .L_MergedGlobals 46 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 51 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 59 60 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 66