1 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=ropi -mattr=-no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RW-DEFAULT-MOVT,ROPI-MOVT
2 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=ropi -mattr=+no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RW-DEFAULT-NOMOVT,ROPI-NOMOVT
3 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=rwpi -mattr=-no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RWPI-MOVT,RWPI,RO-DEFAULT-MOVT
4 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=rwpi -mattr=+no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RWPI-NOMOVT,RWPI,RO-DEFAULT-NOMOVT
5 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=ropi-rwpi -mattr=-no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RWPI-MOVT,RWPI,ROPI-MOVT
6 # RUN: llc -O0 -mtriple thumb-linux -relocation-model=ropi-rwpi -mattr=+no-movt,+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s -check-prefixes=CHECK,RWPI-NOMOVT,RWPI,ROPI-NOMOVT
8 @internal_global = internal global i32 42
9 define void @test_internal_global() { ret void }
11 @external_global = external global i32
12 define void @test_external_global() { ret void }
14 @internal_constant = internal constant i32 42
15 define void @test_internal_constant() { ret void }
17 @external_constant = external constant i32
18 define void @test_external_constant() { ret void }
21 name: test_internal_global
22 # CHECK-LABEL: name: test_internal_global
26 # CHECK: selected: true
28 - { id: 0, class: gprb }
29 - { id: 1, class: gprb }
30 # RW-DEFAULT-NOMOVT: constants:
31 # RW-DEFAULT-NOMOVT: id: 0
32 # RW-DEFAULT-NOMOVT: value: 'i32* @internal_global'
33 # RWPI-NOMOVT: constants:
35 # RWPI-NOMOVT: value: 'internal_global(SBREL)'
38 %0(p0) = G_GLOBAL_VALUE @internal_global
39 ; RW-DEFAULT-MOVT: [[G:%[0-9]+]]:rgpr = t2MOVi32imm @internal_global
40 ; RW-DEFAULT-NOMOVT: [[G:%[0-9]+]]:gpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
41 ; RWPI-MOVT: [[OFF:%[0-9]+]]:rgpr = t2MOVi32imm target-flags(arm-sbrel) @internal_global
42 ; RWPI-NOMOVT: [[OFF:%[0-9]+]]:rgpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
43 ; RWPI: [[G:%[0-9]+]]:gprnopc = t2ADDrr $r9, [[OFF]], 14, $noreg, $noreg
45 %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_global)
46 ; CHECK: [[V:%[0-9]+]]:gpr = t2LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_global)
49 ; CHECK: $r0 = COPY [[V]]
51 tBX_RET 14, $noreg, implicit $r0
52 ; CHECK: tBX_RET 14, $noreg, implicit $r0
55 name: test_external_global
56 # CHECK-LABEL: name: test_external_global
60 # CHECK: selected: true
62 - { id: 0, class: gprb }
63 - { id: 1, class: gprb }
64 # RW-DEFAULT-NOMOVT: constants:
65 # RW-DEFAULT-NOMOVT: id: 0
66 # RW-DEFAULT-NOMOVT: value: 'i32* @external_global'
67 # RWPI-NOMOVT: constants:
69 # RWPI-NOMOVT: value: 'external_global(SBREL)'
72 %0(p0) = G_GLOBAL_VALUE @external_global
73 ; RW-DEFAULT-MOVT: [[G:%[0-9]+]]:rgpr = t2MOVi32imm @external_global
74 ; RW-DEFAULT-NOMOVT: [[G:%[0-9]+]]:gpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
75 ; RWPI-MOVT: [[OFF:%[0-9]+]]:rgpr = t2MOVi32imm target-flags(arm-sbrel) @external_global
76 ; RWPI-NOMOVT: [[OFF:%[0-9]+]]:rgpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
77 ; RWPI: [[G:%[0-9]+]]:gprnopc = t2ADDrr $r9, [[OFF]], 14, $noreg, $noreg
79 %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_global)
80 ; CHECK: [[V:%[0-9]+]]:gpr = t2LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_global)
83 ; CHECK: $r0 = COPY [[V]]
85 tBX_RET 14, $noreg, implicit $r0
86 ; CHECK: tBX_RET 14, $noreg, implicit $r0
89 name: test_internal_constant
90 # CHECK-LABEL: name: test_internal_constant
94 # CHECK: selected: true
96 - { id: 0, class: gprb }
97 - { id: 1, class: gprb }
98 # RO-DEFAULT-NOMOVT: constants:
99 # RO-DEFAULT-NOMOVT: id: 0
100 # RO-DEFAULT-NOMOVT: value: 'i32* @internal_constant'
103 %0(p0) = G_GLOBAL_VALUE @internal_constant
104 ; ROPI-MOVT: [[G:%[0-9]+]]:rgpr = t2MOV_ga_pcrel @internal_constant
105 ; ROPI-NOMOVT: [[G:%[0-9]+]]:tgpr = tLDRLIT_ga_pcrel @internal_constant
106 ; RO-DEFAULT-MOVT: [[G:%[0-9]+]]:rgpr = t2MOVi32imm @internal_constant
107 ; RO-DEFAULT-NOMOVT: [[G:%[0-9]+]]:gpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
109 %1(s32) = G_LOAD %0(p0) :: (load 4 from @internal_constant)
110 ; CHECK: [[V:%[0-9]+]]:gpr = t2LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @internal_constant)
113 ; CHECK: $r0 = COPY [[V]]
115 tBX_RET 14, $noreg, implicit $r0
116 ; CHECK: tBX_RET 14, $noreg, implicit $r0
119 name: test_external_constant
120 # CHECK-LABEL: name: test_external_constant
122 regBankSelected: true
124 # CHECK: selected: true
126 - { id: 0, class: gprb }
127 - { id: 1, class: gprb }
128 # RO-DEFAULT-NOMOVT: constants:
129 # RO-DEFAULT-NOMOVT: id: 0
130 # RO-DEFAULT-NOMOVT: value: 'i32* @external_constant'
133 %0(p0) = G_GLOBAL_VALUE @external_constant
134 ; ROPI-MOVT: [[G:%[0-9]+]]:rgpr = t2MOV_ga_pcrel @external_constant
135 ; ROPI-NOMOVT: [[G:%[0-9]+]]:tgpr = tLDRLIT_ga_pcrel @external_constant
136 ; RO-DEFAULT-MOVT: [[G:%[0-9]+]]:rgpr = t2MOVi32imm @external_constant
137 ; RO-DEFAULT-NOMOVT: [[G:%[0-9]+]]:gpr = t2LDRpci %const.0, 14, $noreg :: (load 4 from constant-pool)
139 %1(s32) = G_LOAD %0(p0) :: (load 4 from @external_constant)
140 ; CHECK: [[V:%[0-9]+]]:gpr = t2LDRi12 [[G]], 0, 14, $noreg :: (load 4 from @external_constant)
143 ; CHECK: $r0 = COPY [[V]]
145 tBX_RET 14, $noreg, implicit $r0
146 ; CHECK: tBX_RET 14, $noreg, implicit $r0