1 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_s1() { ret void }
4 define void @test_s8() { ret void }
5 define void @test_s16() { ret void }
6 define void @test_s32() { ret void }
8 define void @test_gep() { ret void }
10 define void @test_load_from_stack() { ret void }
14 # CHECK-LABEL: name: test_s1
18 # CHECK: selected: true
20 - { id: 0, class: gprb }
21 - { id: 1, class: gprb }
27 ; CHECK: %[[P:[0-9]+]]:gpr = COPY $r0
29 %1(s1) = G_LOAD %0(p0) :: (load 1)
30 ; CHECK: %[[V8:[0-9]+]]:rgpr = t2LDRBi12 %[[P]], 0, 14, $noreg :: (load 1)
32 G_STORE %1(s1), %0(p0) :: (store 1)
33 ; CHECK: %[[V1:[0-9]+]]:rgpr = t2ANDri %[[V8]], 1, 14, $noreg
34 ; CHECK: t2STRBi12 %[[V1]], %[[P]], 0, 14, $noreg :: (store 1)
37 ; CHECK: BX_RET 14, $noreg
41 # CHECK-LABEL: name: test_s8
45 # CHECK: selected: true
47 - { id: 0, class: gprb }
48 - { id: 1, class: gprb }
54 ; CHECK: %[[P:[0-9]+]]:gpr = COPY $r0
56 %1(s8) = G_LOAD %0(p0) :: (load 1)
57 ; CHECK: %[[V:[0-9]+]]:rgpr = t2LDRBi12 %[[P]], 0, 14, $noreg :: (load 1)
59 G_STORE %1(s8), %0(p0) :: (store 1)
60 ; CHECK: t2STRBi12 %[[V]], %[[P]], 0, 14, $noreg :: (store 1)
63 ; CHECK: BX_RET 14, $noreg
67 # CHECK-LABEL: name: test_s16
71 # CHECK: selected: true
73 - { id: 0, class: gprb }
74 - { id: 1, class: gprb }
80 ; CHECK: %[[P:[0-9]+]]:gpr = COPY $r0
82 %1(s16) = G_LOAD %0(p0) :: (load 2)
83 ; CHECK: %[[V:[0-9]+]]:rgpr = t2LDRHi12 %[[P]], 0, 14, $noreg :: (load 2)
85 G_STORE %1(s16), %0(p0) :: (store 2)
86 ; CHECK: t2STRHi12 %[[V]], %[[P]], 0, 14, $noreg :: (store 2)
89 ; CHECK: BX_RET 14, $noreg
93 # CHECK-LABEL: name: test_s32
97 # CHECK: selected: true
99 - { id: 0, class: gprb }
100 - { id: 1, class: gprb }
106 ; CHECK: %[[P:[0-9]+]]:gpr = COPY $r0
108 %1(s32) = G_LOAD %0(p0) :: (load 4)
109 ; CHECK: %[[V:[0-9]+]]:gpr = t2LDRi12 %[[P]], 0, 14, $noreg :: (load 4)
111 G_STORE %1(s32), %0(p0) :: (store 4)
112 ; CHECK: t2STRi12 %[[V]], %[[P]], 0, 14, $noreg :: (store 4)
115 ; CHECK: BX_RET 14, $noreg
119 # CHECK-LABEL: name: test_gep
121 regBankSelected: true
123 # CHECK: selected: true
125 - { id: 0, class: gprb }
126 - { id: 1, class: gprb }
127 - { id: 2, class: gprb }
133 ; CHECK: [[PTR:%[0-9]+]]:gprnopc = COPY $r0
136 ; CHECK: [[OFF:%[0-9]+]]:rgpr = COPY $r1
138 %2(p0) = G_GEP %0, %1(s32)
139 ; CHECK: [[GEP:%[0-9]+]]:gprnopc = t2ADDrr [[PTR]], [[OFF]], 14, $noreg, $noreg
142 ; CHECK: $r0 = COPY [[GEP]]
144 BX_RET 14, $noreg, implicit $r0
145 ; CHECK: BX_RET 14, $noreg, implicit $r0
148 name: test_load_from_stack
149 # CHECK-LABEL: name: test_load_from_stack
151 regBankSelected: true
153 # CHECK: selected: true
155 - { id: 0, class: gprb }
156 - { id: 1, class: gprb }
157 - { id: 2, class: gprb }
158 - { id: 3, class: gprb }
159 - { id: 4, class: gprb }
161 - { id: 0, offset: 0, size: 1, alignment: 4, isImmutable: true, isAliased: false }
162 - { id: 1, offset: 4, size: 4, alignment: 4, isImmutable: true, isAliased: false }
163 - { id: 2, offset: 8, size: 4, alignment: 4, isImmutable: true, isAliased: false }
164 # CHECK-DAG: id: [[FI1:[0-9]+]], type: default, offset: 0, size: 1
165 # CHECK-DAG: id: [[FI32:[0-9]+]], type: default, offset: 8
168 liveins: $r0, $r1, $r2, $r3
170 %0(p0) = G_FRAME_INDEX %fixed-stack.2
171 ; CHECK: [[FI32VREG:%[0-9]+]]:gprnopc = t2ADDri %fixed-stack.[[FI32]], 0, 14, $noreg, $noreg
173 %1(s32) = G_LOAD %0(p0) :: (load 4)
174 ; CHECK: [[LD32VREG:%[0-9]+]]:gpr = t2LDRi12 [[FI32VREG]], 0, 14, $noreg
177 ; CHECK: $r0 = COPY [[LD32VREG]]
179 %2(p0) = G_FRAME_INDEX %fixed-stack.0
180 ; CHECK: [[FI1VREG:%[0-9]+]]:gprnopc = t2ADDri %fixed-stack.[[FI1]], 0, 14, $noreg, $noreg
182 %3(s1) = G_LOAD %2(p0) :: (load 1)
183 ; CHECK: [[LD1VREG:%[0-9]+]]:gprnopc = t2LDRBi12 [[FI1VREG]], 0, 14, $noreg
185 %4(s32) = G_ANYEXT %3(s1)
186 ; CHECK: [[RES:%[0-9]+]]:gpr = COPY [[LD1VREG]]
189 ; CHECK: $r0 = COPY [[RES]]
192 ; CHECK: BX_RET 14, $noreg