1 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_trunc_and_zext_s1() { ret void }
4 define void @test_trunc_and_sext_s1() { ret void }
5 define void @test_trunc_and_anyext_s1() { ret void }
7 define void @test_trunc_and_zext_s8() { ret void }
8 define void @test_trunc_and_sext_s8() { ret void }
9 define void @test_trunc_and_anyext_s8() { ret void }
11 define void @test_trunc_and_zext_s16() { ret void }
12 define void @test_trunc_and_sext_s16() { ret void }
13 define void @test_trunc_and_anyext_s16() { ret void }
16 name: test_trunc_and_zext_s1
17 # CHECK-LABEL: name: test_trunc_and_zext_s1
21 # CHECK: selected: true
22 tracksRegLiveness: true
24 - { id: 0, class: gprb }
25 - { id: 1, class: gprb }
26 - { id: 2, class: gprb }
32 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
34 %1(s1) = G_TRUNC %0(s32)
36 %2(s32) = G_ZEXT %1(s1)
37 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
38 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
41 ; CHECK: $r0 = COPY [[VREGEXT]]
43 BX_RET 14, $noreg, implicit $r0
44 ; CHECK: BX_RET 14, $noreg, implicit $r0
47 name: test_trunc_and_sext_s1
48 # CHECK-LABEL: name: test_trunc_and_sext_s1
52 # CHECK: selected: true
53 tracksRegLiveness: true
55 - { id: 0, class: gprb }
56 - { id: 1, class: gprb }
57 - { id: 2, class: gprb }
63 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
65 %1(s1) = G_TRUNC %0(s32)
67 %2(s32) = G_SEXT %1(s1)
68 ; CHECK: [[RVREG:%[0-9]+]]:rgpr = COPY [[VREG]]
69 ; CHECK: [[VREGAND:%[0-9]+]]:rgpr = t2ANDri [[RVREG]], 1, 14, $noreg, $noreg
70 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2RSBri [[VREGAND]], 0, 14, $noreg, $noreg
73 ; CHECK: $r0 = COPY [[VREGEXT]]
75 BX_RET 14, $noreg, implicit $r0
76 ; CHECK: BX_RET 14, $noreg, implicit $r0
79 name: test_trunc_and_anyext_s1
80 # CHECK-LABEL: name: test_trunc_and_anyext_s1
84 # CHECK: selected: true
85 tracksRegLiveness: true
87 - { id: 0, class: gprb }
88 - { id: 1, class: gprb }
89 - { id: 2, class: gprb }
95 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
97 %1(s1) = G_TRUNC %0(s32)
99 %2(s32) = G_ANYEXT %1(s1)
102 ; CHECK: $r0 = COPY [[VREG]]
104 BX_RET 14, $noreg, implicit $r0
105 ; CHECK: BX_RET 14, $noreg, implicit $r0
108 name: test_trunc_and_zext_s8
109 # CHECK-LABEL: name: test_trunc_and_zext_s8
111 regBankSelected: true
113 # CHECK: selected: true
114 tracksRegLiveness: true
116 - { id: 0, class: gprb }
117 - { id: 1, class: gprb }
118 - { id: 2, class: gprb }
124 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
126 %1(s8) = G_TRUNC %0(s32)
127 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
129 %2(s32) = G_ZEXT %1(s8)
130 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2UXTB [[VREGTRUNC]], 0, 14, $noreg
133 ; CHECK: $r0 = COPY [[VREGEXT]]
135 BX_RET 14, $noreg, implicit $r0
136 ; CHECK: BX_RET 14, $noreg, implicit $r0
139 name: test_trunc_and_sext_s8
140 # CHECK-LABEL: name: test_trunc_and_sext_s8
142 regBankSelected: true
144 # CHECK: selected: true
145 tracksRegLiveness: true
147 - { id: 0, class: gprb }
148 - { id: 1, class: gprb }
149 - { id: 2, class: gprb }
155 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
157 %1(s8) = G_TRUNC %0(s32)
158 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
160 %2(s32) = G_SEXT %1(s8)
161 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2SXTB [[VREGTRUNC]], 0, 14, $noreg
164 ; CHECK: $r0 = COPY [[VREGEXT]]
166 BX_RET 14, $noreg, implicit $r0
167 ; CHECK: BX_RET 14, $noreg, implicit $r0
170 name: test_trunc_and_anyext_s8
171 # CHECK-LABEL: name: test_trunc_and_anyext_s8
173 regBankSelected: true
175 # CHECK: selected: true
176 tracksRegLiveness: true
178 - { id: 0, class: gprb }
179 - { id: 1, class: gprb }
180 - { id: 2, class: gprb }
186 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
188 %1(s8) = G_TRUNC %0(s32)
190 %2(s32) = G_ANYEXT %1(s8)
193 ; CHECK: $r0 = COPY [[VREG]]
195 BX_RET 14, $noreg, implicit $r0
196 ; CHECK: BX_RET 14, $noreg, implicit $r0
199 name: test_trunc_and_zext_s16
200 # CHECK-LABEL: name: test_trunc_and_zext_s16
202 regBankSelected: true
204 # CHECK: selected: true
205 tracksRegLiveness: true
207 - { id: 0, class: gprb }
208 - { id: 1, class: gprb }
209 - { id: 2, class: gprb }
215 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
217 %1(s16) = G_TRUNC %0(s32)
218 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
220 %2(s32) = G_ZEXT %1(s16)
221 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2UXTH [[VREGTRUNC]], 0, 14, $noreg
224 ; CHECK: $r0 = COPY [[VREGEXT]]
226 BX_RET 14, $noreg, implicit $r0
227 ; CHECK: BX_RET 14, $noreg, implicit $r0
230 name: test_trunc_and_sext_s16
231 # CHECK-LABEL: name: test_trunc_and_sext_s16
233 regBankSelected: true
235 # CHECK: selected: true
236 tracksRegLiveness: true
238 - { id: 0, class: gprb }
239 - { id: 1, class: gprb }
240 - { id: 2, class: gprb }
246 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
248 %1(s16) = G_TRUNC %0(s32)
249 ; CHECK: [[VREGTRUNC:%[0-9]+]]:rgpr = COPY [[VREG]]
251 %2(s32) = G_SEXT %1(s16)
252 ; CHECK: [[VREGEXT:%[0-9]+]]:rgpr = t2SXTH [[VREGTRUNC]], 0, 14, $noreg
255 ; CHECK: $r0 = COPY [[VREGEXT]]
257 BX_RET 14, $noreg, implicit $r0
258 ; CHECK: BX_RET 14, $noreg, implicit $r0
261 name: test_trunc_and_anyext_s16
262 # CHECK-LABEL: name: test_trunc_and_anyext_s16
264 regBankSelected: true
266 # CHECK: selected: true
267 tracksRegLiveness: true
269 - { id: 0, class: gprb }
270 - { id: 1, class: gprb }
271 - { id: 2, class: gprb }
277 ; CHECK: [[VREG:%[0-9]+]]:gpr = COPY $r0
279 %1(s16) = G_TRUNC %0(s32)
281 %2(s32) = G_ANYEXT %1(s16)
284 ; CHECK: $r0 = COPY [[VREG]]
286 BX_RET 14, $noreg, implicit $r0
287 ; CHECK: BX_RET 14, $noreg, implicit $r0