1 # RUN: llc -O0 -mtriple thumb-- -mattr=+v6t2 -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
3 define void @test_and_regs() { ret void }
4 define void @test_and_imm() { ret void }
6 define void @test_bfc() { ret void }
7 define void @test_no_bfc_bad_mask() { ret void }
9 define void @test_mvn() { ret void }
10 define void @test_bic() { ret void }
11 define void @test_orn() { ret void }
15 # CHECK-LABEL: name: test_and_regs
19 # CHECK: selected: true
21 - { id: 0, class: gprb }
22 - { id: 1, class: gprb }
23 - { id: 2, class: gprb }
29 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
32 ; CHECK: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
34 %2(s32) = G_AND %0, %1
35 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2ANDrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
38 ; CHECK: $r0 = COPY [[VREGRES]]
40 BX_RET 14, $noreg, implicit $r0
41 ; CHECK: BX_RET 14, $noreg, implicit $r0
45 # CHECK-LABEL: name: test_and_imm
49 # CHECK: selected: true
51 - { id: 0, class: gprb }
52 - { id: 1, class: gprb }
53 - { id: 2, class: gprb }
59 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
61 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
62 %2(s32) = G_AND %0, %1
63 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2ANDri [[VREGX]], 786444, 14, $noreg, $noreg
66 ; CHECK: $r0 = COPY [[VREGRES]]
68 BX_RET 14, $noreg, implicit $r0
69 ; CHECK: BX_RET 14, $noreg, implicit $r0
73 # CHECK-LABEL: name: test_bfc
77 # CHECK: selected: true
79 - { id: 0, class: gprb }
80 - { id: 1, class: gprb }
81 - { id: 2, class: gprb }
87 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
89 %1(s32) = G_CONSTANT i32 -65529 ; 0xFFFF0007
90 %2(s32) = G_AND %0, %1
91 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2BFC [[VREGX]], -65529, 14, $noreg
94 ; CHECK: $r0 = COPY [[VREGRES]]
96 BX_RET 14, $noreg, implicit $r0
97 ; CHECK: BX_RET 14, $noreg, implicit $r0
100 name: test_no_bfc_bad_mask
101 # CHECK-LABEL: name: test_no_bfc_bad_mask
103 regBankSelected: true
105 # CHECK: selected: true
107 - { id: 0, class: gprb }
108 - { id: 1, class: gprb }
109 - { id: 2, class: gprb }
116 %1(s32) = G_CONSTANT i32 786444 ; 0x000c000c
117 %2(s32) = G_AND %0, %1
122 BX_RET 14, $noreg, implicit $r0
126 # CHECK-LABEL: name: test_mvn
128 regBankSelected: true
130 # CHECK: selected: true
132 - { id: 0, class: gprb }
133 - { id: 1, class: gprb }
134 - { id: 2, class: gprb }
140 ; CHECK: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
142 %1(s32) = G_CONSTANT i32 -1
143 %2(s32) = G_XOR %0, %1
144 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2MVNr [[VREGX]], 14, $noreg, $noreg
147 ; CHECK: $r0 = COPY [[VREGRES]]
149 BX_RET 14, $noreg, implicit $r0
150 ; CHECK: BX_RET 14, $noreg, implicit $r0
154 # CHECK-LABEL: name: test_bic
156 regBankSelected: true
158 # CHECK: selected: true
160 - { id: 0, class: gprb }
161 - { id: 1, class: gprb }
162 - { id: 2, class: gprb }
163 - { id: 3, class: gprb }
164 - { id: 4, class: gprb }
171 ; CHECK-DAG: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
172 ; CHECK-DAG: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
174 %2(s32) = G_CONSTANT i32 -1
175 %3(s32) = G_XOR %1, %2
177 %4(s32) = G_AND %0, %3
178 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2BICrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
181 ; CHECK: $r0 = COPY [[VREGRES]]
183 BX_RET 14, $noreg, implicit $r0
184 ; CHECK: BX_RET 14, $noreg, implicit $r0
188 # CHECK-LABEL: name: test_orn
190 regBankSelected: true
192 # CHECK: selected: true
194 - { id: 0, class: gprb }
195 - { id: 1, class: gprb }
196 - { id: 2, class: gprb }
197 - { id: 3, class: gprb }
198 - { id: 4, class: gprb }
205 ; CHECK-DAG: [[VREGX:%[0-9]+]]:rgpr = COPY $r0
206 ; CHECK-DAG: [[VREGY:%[0-9]+]]:rgpr = COPY $r1
208 %2(s32) = G_CONSTANT i32 -1
209 %3(s32) = G_XOR %1, %2
211 %4(s32) = G_OR %0, %3
212 ; CHECK: [[VREGRES:%[0-9]+]]:rgpr = t2ORNrr [[VREGX]], [[VREGY]], 14, $noreg, $noreg
215 ; CHECK: $r0 = COPY [[VREGRES]]
217 BX_RET 14, $noreg, implicit $r0
218 ; CHECK: BX_RET 14, $noreg, implicit $r0