[ARM] Adjust how NEON shifts are lowered
[llvm-core.git] / test / CodeGen / ARM / GlobalISel / thumb-isel-globals-pic.ll
blob85058506824c95bae8fa6c2cb81ce9d7d35804b6
1 ; RUN: llc -mtriple thumbv7-linux -relocation-model=pic -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,ELF
2 ; RUN: llc -mtriple thumbv7-linux -relocation-model=pic -mattr=+no-movt -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,ELF
3 ; RUN: llc -mtriple thumbv7-darwin -relocation-model=pic -global-isel %s -o - | FileCheck %s -check-prefixes=CHECK,DARWIN,DARWIN-MOVT
4 ; RUN: llc -mtriple thumbv7-darwin -relocation-model=pic -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: ldr r[[ADDR:[0-9]+]], [[LABEL:.L[[:alnum:]_]+]]
10 ; ELF: [[ANCHOR:.L[[:alnum:]_]+]]:
11 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
12 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:(_internal_global-([[ANCHOR:L[[:alnum:]_]+]]+4))
13 ; DARWIN-MOVT-NEXT: movt r[[ADDR]], :upper16:(_internal_global-([[ANCHOR]]+4))
14 ; DARWIN: [[ANCHOR:L[[:alnum:]_]+]]:
15 ; CHECK-NEXT: add r[[ADDR:[0-9]+]], pc
16 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
17 ; CHECK-NEXT: bx lr
18 ; ELF: [[LABEL]]:
19 ; ELF-NEXT: .long internal_global-([[ANCHOR]]+4)
20 ; DARWIN-NOMOVT: [[LABEL]]:
21 ; DARWIN-NOMOVT-NEXT: .long _internal_global-([[ANCHOR]]+4)
22 ; DARWIN-MOVT-NOT: .long _internal_global
24 entry:
25   %v = load i32, i32* @internal_global
26   ret i32 %v
29 @external_global = external global i32
30 define i32 @test_external_global() {
31 ; CHECK-LABEL: test_external_global:
32 ; ELF: ldr r[[ADDR:[0-9]+]], [[LABEL:.L[[:alnum:]_]+]]
33 ; ELF: [[ANCHOR:.L[[:alnum:]_]+]]:
34 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
35 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:(L_external_global$non_lazy_ptr-([[ANCHOR:L[[:alnum:]_]+]]+4))
36 ; DARWIN-MOVT: movt r[[ADDR]], :upper16:(L_external_global$non_lazy_ptr-([[ANCHOR]]+4))
37 ; DARWIN: [[ANCHOR:L[[:alnum:]_]+]]:
38 ; CHECK-NEXT: add r[[ADDR:[0-9]+]], pc
39 ; CHECK-NEXT: ldr r[[ADDR:[0-9]+]], [r[[ADDR]]]
40 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
41 ; CHECK-NEXT: bx lr
42 ; ELF: [[LABEL]]:
43 ; ELF: [[TMPLABEL:.L[[:alnum:]_]+]]:
44 ; ELF: .long external_global(GOT_PREL)-(([[ANCHOR]]+4)-[[TMPLABEL]])
45 ; DARWIN-NOMOVT: [[LABEL]]:
46 ; DARWIN-NOMOVT: .long L_external_global$non_lazy_ptr-([[ANCHOR]]+4)
47 ; DARWIN-NOMOVT-NOT: .long L_external_global
48 entry:
49   %v = load i32, i32* @external_global
50   ret i32 %v
53 @internal_constant = internal constant i32 42
54 define i32 @test_internal_constant() {
55 ; CHECK-LABEL: test_internal_constant:
56 ; ELF: ldr r[[ADDR:[0-9]+]], [[LABEL:.L[[:alnum:]_]+]]
57 ; ELF: [[ANCHOR:.L[[:alnum:]_]+]]:
58 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
59 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:(_internal_constant-([[ANCHOR:L[[:alnum:]_]+]]+4))
60 ; DARWIN-MOVT-NEXT: movt r[[ADDR]], :upper16:(_internal_constant-([[ANCHOR]]+4))
61 ; DARWIN: [[ANCHOR:L[[:alnum:]_]+]]:
62 ; CHECK-NEXT: add r[[ADDR:[0-9]+]], pc
63 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
64 ; CHECK-NEXT: bx lr
65 ; ELF: [[LABEL]]:
66 ; ELF-NEXT: .long internal_constant-([[ANCHOR]]+4)
67 ; DARWIN-NOMOVT: [[LABEL]]:
68 ; DARWIN-NOMOVT-NEXT: .long _internal_constant-([[ANCHOR]]+4)
69 ; DARWIN-MOVT-NOT: .long _internal_constant
71 entry:
72   %v = load i32, i32* @internal_constant
73   ret i32 %v
76 @external_constant = external constant i32
77 define i32 @test_external_constant() {
78 ; CHECK-LABEL: test_external_constant:
79 ; ELF: ldr r[[ADDR:[0-9]+]], [[LABEL:.L[[:alnum:]_]+]]
80 ; ELF: [[ANCHOR:.L[[:alnum:]_]+]]:
81 ; DARWIN-NOMOVT: ldr r[[ADDR:[0-9]+]], [[LABEL:L[[:alnum:]_]+]]
82 ; DARWIN-MOVT: movw r[[ADDR:[0-9]+]], :lower16:(L_external_constant$non_lazy_ptr-([[ANCHOR:L[[:alnum:]_]+]]+4))
83 ; DARWIN-MOVT: movt r[[ADDR]], :upper16:(L_external_constant$non_lazy_ptr-([[ANCHOR]]+4))
84 ; DARWIN: [[ANCHOR:L[[:alnum:]_]+]]:
85 ; CHECK-NEXT: add r[[ADDR:[0-9]+]], pc
86 ; CHECK-NEXT: ldr r[[ADDR:[0-9]+]], [r[[ADDR]]]
87 ; CHECK-NEXT: ldr r0, [r[[ADDR]]]
88 ; CHECK-NEXT: bx lr
89 ; ELF: [[LABEL]]:
90 ; ELF: [[TMPLABEL:.L[[:alnum:]_]+]]:
91 ; ELF: .long external_constant(GOT_PREL)-(([[ANCHOR]]+4)-[[TMPLABEL]])
92 ; DARWIN-NOMOVT: [[LABEL]]:
93 ; DARWIN-NOMOVT: .long L_external_constant$non_lazy_ptr-([[ANCHOR]]+4)
94 ; DARWIN-NOMOVT-NOT: .long L_external_constant
95 entry:
96   %v = load i32, i32* @external_constant
97   ret i32 %v
100 ; ELF: internal_global:
101 ; DARWIN: _internal_global:
102 ; CHECK: .long 42
103 ; ELF: .size internal_global, 4
105 ; ELF: internal_constant:
106 ; DARWIN: _internal_constant:
107 ; CHECK: .long 42
108 ; ELF: .size internal_constant, 4
110 ; DARWIN-DAG: L_external_global$non_lazy_ptr:
111 ; DARWIN-DAG: .indirect_symbol _external_global
113 ; DARWIN-DAG: L_external_constant$non_lazy_ptr:
114 ; DARWIN-DAG: .indirect_symbol _external_constant