1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \
3 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-BE \
4 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
5 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \
6 ; RUN: -ppc-gpr-icmps=all -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-LE \
7 ; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl
8 @glob = common local_unnamed_addr global i8 0, align 1
10 define signext i32 @test_ineuc(i8 zeroext %a, i8 zeroext %b) {
11 ; CHECK-LABEL: test_ineuc:
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: xor r3, r3, r4
14 ; CHECK-NEXT: cntlzw r3, r3
15 ; CHECK-NEXT: srwi r3, r3, 5
16 ; CHECK-NEXT: xori r3, r3, 1
18 ; CHECK-BE-LABEL: test_ineuc:
19 ; CHECK-BE: # %bb.0: # %entry
20 ; CHECK-BE-NEXT: xor r3, r3, r4
21 ; CHECK-BE-NEXT: cntlzw r3, r3
22 ; CHECK-BE-NEXT: srwi r3, r3, 5
23 ; CHECK-BE-NEXT: xori r3, r3, 1
26 ; CHECK-LE-LABEL: test_ineuc:
27 ; CHECK-LE: # %bb.0: # %entry
28 ; CHECK-LE-NEXT: xor r3, r3, r4
29 ; CHECK-LE-NEXT: cntlzw r3, r3
30 ; CHECK-LE-NEXT: srwi r3, r3, 5
31 ; CHECK-LE-NEXT: xori r3, r3, 1
34 %cmp = icmp ne i8 %a, %b
35 %conv2 = zext i1 %cmp to i32
39 define signext i32 @test_ineuc_sext(i8 zeroext %a, i8 zeroext %b) {
40 ; CHECK-LABEL: test_ineuc_sext:
41 ; CHECK: # %bb.0: # %entry
42 ; CHECK-NEXT: xor r3, r3, r4
43 ; CHECK-NEXT: cntlzw r3, r3
44 ; CHECK-NEXT: srwi r3, r3, 5
45 ; CHECK-NEXT: xori r3, r3, 1
46 ; CHECK-NEXT: neg r3, r3
48 ; CHECK-BE-LABEL: test_ineuc_sext:
49 ; CHECK-BE: # %bb.0: # %entry
50 ; CHECK-BE-NEXT: xor r3, r3, r4
51 ; CHECK-BE-NEXT: cntlzw r3, r3
52 ; CHECK-BE-NEXT: srwi r3, r3, 5
53 ; CHECK-BE-NEXT: xori r3, r3, 1
54 ; CHECK-BE-NEXT: neg r3, r3
57 ; CHECK-LE-LABEL: test_ineuc_sext:
58 ; CHECK-LE: # %bb.0: # %entry
59 ; CHECK-LE-NEXT: xor r3, r3, r4
60 ; CHECK-LE-NEXT: cntlzw r3, r3
61 ; CHECK-LE-NEXT: srwi r3, r3, 5
62 ; CHECK-LE-NEXT: xori r3, r3, 1
63 ; CHECK-LE-NEXT: neg r3, r3
66 %cmp = icmp ne i8 %a, %b
67 %sub = sext i1 %cmp to i32
71 define signext i32 @test_ineuc_z(i8 zeroext %a) {
72 ; CHECK-LABEL: test_ineuc_z:
73 ; CHECK: # %bb.0: # %entry
74 ; CHECK-NEXT: cntlzw r3, r3
75 ; CHECK-NEXT: srwi r3, r3, 5
76 ; CHECK-NEXT: xori r3, r3, 1
78 ; CHECK-BE-LABEL: test_ineuc_z:
79 ; CHECK-BE: # %bb.0: # %entry
80 ; CHECK-BE-NEXT: cntlzw r3, r3
81 ; CHECK-BE-NEXT: srwi r3, r3, 5
82 ; CHECK-BE-NEXT: xori r3, r3, 1
85 ; CHECK-LE-LABEL: test_ineuc_z:
86 ; CHECK-LE: # %bb.0: # %entry
87 ; CHECK-LE-NEXT: cntlzw r3, r3
88 ; CHECK-LE-NEXT: srwi r3, r3, 5
89 ; CHECK-LE-NEXT: xori r3, r3, 1
92 %cmp = icmp ne i8 %a, 0
93 %conv1 = zext i1 %cmp to i32
97 define signext i32 @test_ineuc_sext_z(i8 zeroext %a) {
98 ; CHECK-LABEL: test_ineuc_sext_z:
99 ; CHECK: # %bb.0: # %entry
100 ; CHECK-NEXT: cntlzw r3, r3
101 ; CHECK-NEXT: srwi r3, r3, 5
102 ; CHECK-NEXT: xori r3, r3, 1
103 ; CHECK-NEXT: neg r3, r3
105 ; CHECK-BE-LABEL: test_ineuc_sext_z:
106 ; CHECK-BE: # %bb.0: # %entry
107 ; CHECK-BE-NEXT: cntlzw r3, r3
108 ; CHECK-BE-NEXT: srwi r3, r3, 5
109 ; CHECK-BE-NEXT: xori r3, r3, 1
110 ; CHECK-BE-NEXT: neg r3, r3
113 ; CHECK-LE-LABEL: test_ineuc_sext_z:
114 ; CHECK-LE: # %bb.0: # %entry
115 ; CHECK-LE-NEXT: cntlzw r3, r3
116 ; CHECK-LE-NEXT: srwi r3, r3, 5
117 ; CHECK-LE-NEXT: xori r3, r3, 1
118 ; CHECK-LE-NEXT: neg r3, r3
121 %cmp = icmp ne i8 %a, 0
122 %sub = sext i1 %cmp to i32
126 define void @test_ineuc_store(i8 zeroext %a, i8 zeroext %b) {
127 ; CHECK-LABEL: test_ineuc_store:
128 ; CHECK: # %bb.0: # %entry
129 ; CHECK-NEXT: xor r3, r3, r4
130 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
131 ; CHECK-NEXT: cntlzw r3, r3
132 ; CHECK-NEXT: srwi r3, r3, 5
133 ; CHECK-NEXT: xori r3, r3, 1
134 ; CHECK-NEXT: stb r3, glob@toc@l(r5)
136 ; CHECK-BE-LABEL: test_ineuc_store:
137 ; CHECK-BE: # %bb.0: # %entry
138 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
139 ; CHECK-BE-NEXT: xor r3, r3, r4
140 ; CHECK-BE-NEXT: cntlzw r3, r3
141 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
142 ; CHECK-BE-NEXT: srwi r3, r3, 5
143 ; CHECK-BE-NEXT: xori r3, r3, 1
144 ; CHECK-BE-NEXT: stb r3, 0(r4)
147 ; CHECK-LE-LABEL: test_ineuc_store:
148 ; CHECK-LE: # %bb.0: # %entry
149 ; CHECK-LE-NEXT: xor r3, r3, r4
150 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
151 ; CHECK-LE-NEXT: cntlzw r3, r3
152 ; CHECK-LE-NEXT: srwi r3, r3, 5
153 ; CHECK-LE-NEXT: xori r3, r3, 1
154 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r5)
157 %cmp = icmp ne i8 %a, %b
158 %conv3 = zext i1 %cmp to i8
159 store i8 %conv3, i8* @glob, align 1
163 define void @test_ineuc_sext_store(i8 zeroext %a, i8 zeroext %b) {
164 ; CHECK-LABEL: test_ineuc_sext_store:
165 ; CHECK: # %bb.0: # %entry
166 ; CHECK-NEXT: xor r3, r3, r4
167 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
168 ; CHECK-NEXT: cntlzw r3, r3
169 ; CHECK-NEXT: srwi r3, r3, 5
170 ; CHECK-NEXT: xori r3, r3, 1
171 ; CHECK-NEXT: neg r3, r3
172 ; CHECK-NEXT: stb r3, glob@toc@l(r5)
174 ; CHECK-BE-LABEL: test_ineuc_sext_store:
175 ; CHECK-BE: # %bb.0: # %entry
176 ; CHECK-BE-NEXT: xor r3, r3, r4
177 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
178 ; CHECK-BE-NEXT: cntlzw r3, r3
179 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
180 ; CHECK-BE-NEXT: srwi r3, r3, 5
181 ; CHECK-BE-NEXT: xori r3, r3, 1
182 ; CHECK-BE-NEXT: neg r3, r3
183 ; CHECK-BE-NEXT: stb r3, 0(r4)
186 ; CHECK-LE-LABEL: test_ineuc_sext_store:
187 ; CHECK-LE: # %bb.0: # %entry
188 ; CHECK-LE-NEXT: xor r3, r3, r4
189 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
190 ; CHECK-LE-NEXT: cntlzw r3, r3
191 ; CHECK-LE-NEXT: srwi r3, r3, 5
192 ; CHECK-LE-NEXT: xori r3, r3, 1
193 ; CHECK-LE-NEXT: neg r3, r3
194 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r5)
197 %cmp = icmp ne i8 %a, %b
198 %conv3 = sext i1 %cmp to i8
199 store i8 %conv3, i8* @glob, align 1
203 define void @test_ineuc_z_store(i8 zeroext %a) {
204 ; CHECK-LABEL: test_ineuc_z_store:
205 ; CHECK: # %bb.0: # %entry
206 ; CHECK-NEXT: cntlzw r3, r3
207 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
208 ; CHECK-NEXT: srwi r3, r3, 5
209 ; CHECK-NEXT: xori r3, r3, 1
210 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
212 ; CHECK-BE-LABEL: test_ineuc_z_store:
213 ; CHECK-BE: # %bb.0: # %entry
214 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
215 ; CHECK-BE-NEXT: cntlzw r3, r3
216 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
217 ; CHECK-BE-NEXT: srwi r3, r3, 5
218 ; CHECK-BE-NEXT: xori r3, r3, 1
219 ; CHECK-BE-NEXT: stb r3, 0(r4)
222 ; CHECK-LE-LABEL: test_ineuc_z_store:
223 ; CHECK-LE: # %bb.0: # %entry
224 ; CHECK-LE-NEXT: cntlzw r3, r3
225 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
226 ; CHECK-LE-NEXT: srwi r3, r3, 5
227 ; CHECK-LE-NEXT: xori r3, r3, 1
228 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
231 %cmp = icmp ne i8 %a, 0
232 %conv2 = zext i1 %cmp to i8
233 store i8 %conv2, i8* @glob, align 1
237 define void @test_ineuc_sext_z_store(i8 zeroext %a) {
238 ; CHECK-LABEL: test_ineuc_sext_z_store:
239 ; CHECK: # %bb.0: # %entry
240 ; CHECK-NEXT: cntlzw r3, r3
241 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
242 ; CHECK-NEXT: srwi r3, r3, 5
243 ; CHECK-NEXT: xori r3, r3, 1
244 ; CHECK-NEXT: neg r3, r3
245 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
247 ; CHECK-BE-LABEL: test_ineuc_sext_z_store:
248 ; CHECK-BE: # %bb.0: # %entry
249 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
250 ; CHECK-BE-NEXT: cntlzw r3, r3
251 ; CHECK-BE-NEXT: srwi r3, r3, 5
252 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
253 ; CHECK-BE-NEXT: xori r3, r3, 1
254 ; CHECK-BE-NEXT: neg r3, r3
255 ; CHECK-BE-NEXT: stb r3, 0(r4)
258 ; CHECK-LE-LABEL: test_ineuc_sext_z_store:
259 ; CHECK-LE: # %bb.0: # %entry
260 ; CHECK-LE-NEXT: cntlzw r3, r3
261 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
262 ; CHECK-LE-NEXT: srwi r3, r3, 5
263 ; CHECK-LE-NEXT: xori r3, r3, 1
264 ; CHECK-LE-NEXT: neg r3, r3
265 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
268 %cmp = icmp ne i8 %a, 0
269 %conv2 = sext i1 %cmp to i8
270 store i8 %conv2, i8* @glob, align 1