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 = dso_local local_unnamed_addr global i8 0, align 1
10 define dso_local 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 dso_local 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 dso_local 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 dso_local 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 dso_local 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: xor r3, r3, r4
139 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
140 ; CHECK-BE-NEXT: cntlzw r3, r3
141 ; CHECK-BE-NEXT: srwi r3, r3, 5
142 ; CHECK-BE-NEXT: xori r3, r3, 1
143 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
146 ; CHECK-LE-LABEL: test_ineuc_store:
147 ; CHECK-LE: # %bb.0: # %entry
148 ; CHECK-LE-NEXT: xor r3, r3, r4
149 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
150 ; CHECK-LE-NEXT: cntlzw r3, r3
151 ; CHECK-LE-NEXT: srwi r3, r3, 5
152 ; CHECK-LE-NEXT: xori r3, r3, 1
153 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
156 %cmp = icmp ne i8 %a, %b
157 %conv3 = zext i1 %cmp to i8
158 store i8 %conv3, ptr @glob, align 1
162 define dso_local void @test_ineuc_sext_store(i8 zeroext %a, i8 zeroext %b) {
163 ; CHECK-LABEL: test_ineuc_sext_store:
164 ; CHECK: # %bb.0: # %entry
165 ; CHECK-NEXT: xor r3, r3, r4
166 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
167 ; CHECK-NEXT: cntlzw r3, r3
168 ; CHECK-NEXT: srwi r3, r3, 5
169 ; CHECK-NEXT: xori r3, r3, 1
170 ; CHECK-NEXT: neg r3, r3
171 ; CHECK-NEXT: stb r3, glob@toc@l(r5)
173 ; CHECK-BE-LABEL: test_ineuc_sext_store:
174 ; CHECK-BE: # %bb.0: # %entry
175 ; CHECK-BE-NEXT: xor r3, r3, r4
176 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
177 ; CHECK-BE-NEXT: cntlzw r3, r3
178 ; CHECK-BE-NEXT: srwi r3, r3, 5
179 ; CHECK-BE-NEXT: xori r3, r3, 1
180 ; CHECK-BE-NEXT: neg r3, r3
181 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
184 ; CHECK-LE-LABEL: test_ineuc_sext_store:
185 ; CHECK-LE: # %bb.0: # %entry
186 ; CHECK-LE-NEXT: xor r3, r3, r4
187 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
188 ; CHECK-LE-NEXT: cntlzw r3, r3
189 ; CHECK-LE-NEXT: srwi r3, r3, 5
190 ; CHECK-LE-NEXT: xori r3, r3, 1
191 ; CHECK-LE-NEXT: neg r3, r3
192 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
195 %cmp = icmp ne i8 %a, %b
196 %conv3 = sext i1 %cmp to i8
197 store i8 %conv3, ptr @glob, align 1
201 define dso_local void @test_ineuc_z_store(i8 zeroext %a) {
202 ; CHECK-LABEL: test_ineuc_z_store:
203 ; CHECK: # %bb.0: # %entry
204 ; CHECK-NEXT: cntlzw r3, r3
205 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
206 ; CHECK-NEXT: srwi r3, r3, 5
207 ; CHECK-NEXT: xori r3, r3, 1
208 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
210 ; CHECK-BE-LABEL: test_ineuc_z_store:
211 ; CHECK-BE: # %bb.0: # %entry
212 ; CHECK-BE-NEXT: cntlzw r3, r3
213 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
214 ; CHECK-BE-NEXT: srwi r3, r3, 5
215 ; CHECK-BE-NEXT: xori r3, r3, 1
216 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
219 ; CHECK-LE-LABEL: test_ineuc_z_store:
220 ; CHECK-LE: # %bb.0: # %entry
221 ; CHECK-LE-NEXT: cntlzw r3, r3
222 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
223 ; CHECK-LE-NEXT: srwi r3, r3, 5
224 ; CHECK-LE-NEXT: xori r3, r3, 1
225 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
228 %cmp = icmp ne i8 %a, 0
229 %conv2 = zext i1 %cmp to i8
230 store i8 %conv2, ptr @glob, align 1
234 define dso_local void @test_ineuc_sext_z_store(i8 zeroext %a) {
235 ; CHECK-LABEL: test_ineuc_sext_z_store:
236 ; CHECK: # %bb.0: # %entry
237 ; CHECK-NEXT: cntlzw r3, r3
238 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
239 ; CHECK-NEXT: srwi r3, r3, 5
240 ; CHECK-NEXT: xori r3, r3, 1
241 ; CHECK-NEXT: neg r3, r3
242 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
244 ; CHECK-BE-LABEL: test_ineuc_sext_z_store:
245 ; CHECK-BE: # %bb.0: # %entry
246 ; CHECK-BE-NEXT: cntlzw r3, r3
247 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
248 ; CHECK-BE-NEXT: srwi r3, r3, 5
249 ; CHECK-BE-NEXT: xori r3, r3, 1
250 ; CHECK-BE-NEXT: neg r3, r3
251 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
254 ; CHECK-LE-LABEL: test_ineuc_sext_z_store:
255 ; CHECK-LE: # %bb.0: # %entry
256 ; CHECK-LE-NEXT: cntlzw r3, r3
257 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
258 ; CHECK-LE-NEXT: srwi r3, r3, 5
259 ; CHECK-LE-NEXT: xori r3, r3, 1
260 ; CHECK-LE-NEXT: neg r3, r3
261 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
264 %cmp = icmp ne i8 %a, 0
265 %conv2 = sext i1 %cmp to i8
266 store i8 %conv2, ptr @glob, align 1