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 = global i32 0, 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: [[LABEL2]]: 30;CHECK-MERGE: .long .L_MergedGlobals 31;CHECK-NO-MERGE: .long {{_?y}} 32;CHECK-WIN32: g1: 33;CHECK-WIN32: movw [[REG2:r[0-9]+]], :lower16:.L_MergedGlobals 34;CHECK-WIN32: movt [[REG2]], :upper16:.L_MergedGlobals 35 store i32 %a1, i32* @y, align 4 36 store i32 %a2, i32* @z, align 4 37 ret void 38} 39 40;CHECK-NO-MERGE-NOT: .globl .L_MergedGlobals 41 42;CHECK-MERGE: .type .L_MergedGlobals,%object 43;CHECK-MERGE: .local .L_MergedGlobals 44;CHECK-MERGE: .comm .L_MergedGlobals,12,4 45;CHECK-WIN32: .lcomm .L_MergedGlobals,12,4 46 47;CHECK-MERGE: .globl x 48;CHECK-MERGE: .set x, .L_MergedGlobals 49;CHECK-MERGE: .size x, 4 50;CHECK-MERGE: .globl y 51;CHECK-MERGE: .set y, .L_MergedGlobals+4 52;CHECK-MERGE: .size y, 4 53;CHECK-MERGE: .globl z 54;CHECK-MERGE: .set z, .L_MergedGlobals+8 55;CHECK-MERGE: .size z, 4 56 57;CHECK-WIN32: .globl x 58;CHECK-WIN32: .set x, .L_MergedGlobals 59;CHECK-WIN32: .globl y 60;CHECK-WIN32: .set y, .L_MergedGlobals+4 61;CHECK-WIN32: .globl z 62;CHECK-WIN32: .set z, .L_MergedGlobals+8 63