1 ; RUN: llc -mtriple armv7-linux -relocation-model=static -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,ELF,ELF-MOVT
2 ; RUN: llc -mtriple armv7-linux -relocation-model=static -mattr=+no-movt -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,ELF,ELF-NOMOVT
3 ; RUN: llc -mtriple armv7-darwin -relocation-model=static -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN,DARWIN-MOVT
4 ; RUN: llc -mtriple armv7-darwin -relocation-model=static -mattr=+no-movt -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN,DARWIN-NOMOVT
6 @internal_global = internal global i32 42
7 define i32 @test_internal_global() {
8 ; CHECK-LABEL: test_internal_global:
9 ; ELF-MOVT: movw r[[ADDR:[0-9]+]], :lower16:internal_global
10 ; ELF-MOVT-NEXT: movt r[[ADDR]], :upper16:internal_global
11 ; ELF-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:.L[[:alnum:]_]+]]
12 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:_internal_global
13 ; DARWIN-MOVT-NEXT: movt r[[ADDR]], :upper16:_internal_global
14 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
15 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
17 ; ELF-NOMOVT: [[LABEL]]:
18 ; ELF-NOMOVT-NEXT: .long internal_global
19 ; DARWIN-NOMOVT: [[LABEL]]:
20 ; DARWIN-NOMOVT-NEXT: .long _internal_global
23 %v = load i32, ptr @internal_global
27 @external_global = external global i32
28 define i32 @test_external_global() {
29 ; CHECK-LABEL: test_external_global:
30 ; ELF-MOVT: movw r[[ADDR:[0-9]+]], :lower16:external_global
31 ; ELF-MOVT-NEXT: movt r[[ADDR]], :upper16:external_global
32 ; ELF-NOMOVT: ldr r[[ADDR:[0-9]+]], [[CONST_POOL:.L[[:alnum:]_]+]]
33 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:_external_global
34 ; DARWIN-MOVT: movt r[[ADDR]], :upper16:_external_global
35 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
36 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
38 ; ELF-NOMOVT: [[CONST_POOL]]:
39 ; ELF-NOMOVT: .long external_global
40 ; DARWIN-NOMOVT: [[LABEL]]:
41 ; DARWIN-NOMOVT: .long _external_global
43 %v = load i32, ptr @external_global
47 ; ELF: internal_global:
48 ; DARWIN: _internal_global:
50 ; ELF: .size internal_global, 4