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
9 @glob = common local_unnamed_addr global i8 0, align 1
11 define signext i32 @test_inesc(i8 signext %a, i8 signext %b) {
12 ; CHECK-LABEL: test_inesc:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: xor r3, r3, r4
15 ; CHECK-NEXT: cntlzw r3, r3
16 ; CHECK-NEXT: srwi r3, r3, 5
17 ; CHECK-NEXT: xori r3, r3, 1
19 ; CHECK-BE-LABEL: test_inesc:
20 ; CHECK-BE: # %bb.0: # %entry
21 ; CHECK-BE-NEXT: xor r3, r3, r4
22 ; CHECK-BE-NEXT: cntlzw r3, r3
23 ; CHECK-BE-NEXT: srwi r3, r3, 5
24 ; CHECK-BE-NEXT: xori r3, r3, 1
27 ; CHECK-LE-LABEL: test_inesc:
28 ; CHECK-LE: # %bb.0: # %entry
29 ; CHECK-LE-NEXT: xor r3, r3, r4
30 ; CHECK-LE-NEXT: cntlzw r3, r3
31 ; CHECK-LE-NEXT: srwi r3, r3, 5
32 ; CHECK-LE-NEXT: xori r3, r3, 1
35 %cmp = icmp ne i8 %a, %b
36 %conv2 = zext i1 %cmp to i32
40 define signext i32 @test_inesc_sext(i8 signext %a, i8 signext %b) {
41 ; CHECK-LABEL: test_inesc_sext:
42 ; CHECK: # %bb.0: # %entry
43 ; CHECK-NEXT: xor r3, r3, r4
44 ; CHECK-NEXT: cntlzw r3, r3
45 ; CHECK-NEXT: srwi r3, r3, 5
46 ; CHECK-NEXT: xori r3, r3, 1
47 ; CHECK-NEXT: neg r3, r3
49 ; CHECK-BE-LABEL: test_inesc_sext:
50 ; CHECK-BE: # %bb.0: # %entry
51 ; CHECK-BE-NEXT: xor r3, r3, r4
52 ; CHECK-BE-NEXT: cntlzw r3, r3
53 ; CHECK-BE-NEXT: srwi r3, r3, 5
54 ; CHECK-BE-NEXT: xori r3, r3, 1
55 ; CHECK-BE-NEXT: neg r3, r3
58 ; CHECK-LE-LABEL: test_inesc_sext:
59 ; CHECK-LE: # %bb.0: # %entry
60 ; CHECK-LE-NEXT: xor r3, r3, r4
61 ; CHECK-LE-NEXT: cntlzw r3, r3
62 ; CHECK-LE-NEXT: srwi r3, r3, 5
63 ; CHECK-LE-NEXT: xori r3, r3, 1
64 ; CHECK-LE-NEXT: neg r3, r3
67 %cmp = icmp ne i8 %a, %b
68 %sub = sext i1 %cmp to i32
72 define signext i32 @test_inesc_z(i8 signext %a) {
73 ; CHECK-LABEL: test_inesc_z:
74 ; CHECK: # %bb.0: # %entry
75 ; CHECK-NEXT: cntlzw r3, r3
76 ; CHECK-NEXT: srwi r3, r3, 5
77 ; CHECK-NEXT: xori r3, r3, 1
79 ; CHECK-BE-LABEL: test_inesc_z:
80 ; CHECK-BE: # %bb.0: # %entry
81 ; CHECK-BE-NEXT: cntlzw r3, r3
82 ; CHECK-BE-NEXT: srwi r3, r3, 5
83 ; CHECK-BE-NEXT: xori r3, r3, 1
86 ; CHECK-LE-LABEL: test_inesc_z:
87 ; CHECK-LE: # %bb.0: # %entry
88 ; CHECK-LE-NEXT: cntlzw r3, r3
89 ; CHECK-LE-NEXT: srwi r3, r3, 5
90 ; CHECK-LE-NEXT: xori r3, r3, 1
93 %cmp = icmp ne i8 %a, 0
94 %conv1 = zext i1 %cmp to i32
98 define signext i32 @test_inesc_sext_z(i8 signext %a) {
99 ; CHECK-LABEL: test_inesc_sext_z:
100 ; CHECK: # %bb.0: # %entry
101 ; CHECK-NEXT: cntlzw r3, r3
102 ; CHECK-NEXT: srwi r3, r3, 5
103 ; CHECK-NEXT: xori r3, r3, 1
104 ; CHECK-NEXT: neg r3, r3
106 ; CHECK-BE-LABEL: test_inesc_sext_z:
107 ; CHECK-BE: # %bb.0: # %entry
108 ; CHECK-BE-NEXT: cntlzw r3, r3
109 ; CHECK-BE-NEXT: srwi r3, r3, 5
110 ; CHECK-BE-NEXT: xori r3, r3, 1
111 ; CHECK-BE-NEXT: neg r3, r3
114 ; CHECK-LE-LABEL: test_inesc_sext_z:
115 ; CHECK-LE: # %bb.0: # %entry
116 ; CHECK-LE-NEXT: cntlzw r3, r3
117 ; CHECK-LE-NEXT: srwi r3, r3, 5
118 ; CHECK-LE-NEXT: xori r3, r3, 1
119 ; CHECK-LE-NEXT: neg r3, r3
122 %cmp = icmp ne i8 %a, 0
123 %sub = sext i1 %cmp to i32
127 define void @test_inesc_store(i8 signext %a, i8 signext %b) {
128 ; CHECK-LABEL: test_inesc_store:
129 ; CHECK: # %bb.0: # %entry
130 ; CHECK-NEXT: xor r3, r3, r4
131 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
132 ; CHECK-NEXT: cntlzw r3, r3
133 ; CHECK-NEXT: srwi r3, r3, 5
134 ; CHECK-NEXT: xori r3, r3, 1
135 ; CHECK-NEXT: stb r3, glob@toc@l(r5)
137 ; CHECK-BE-LABEL: test_inesc_store:
138 ; CHECK-BE: # %bb.0: # %entry
139 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
140 ; CHECK-BE-NEXT: xor r3, r3, r4
141 ; CHECK-BE-NEXT: cntlzw r3, r3
142 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
143 ; CHECK-BE-NEXT: srwi r3, r3, 5
144 ; CHECK-BE-NEXT: xori r3, r3, 1
145 ; CHECK-BE-NEXT: stb r3, 0(r4)
148 ; CHECK-LE-LABEL: test_inesc_store:
149 ; CHECK-LE: # %bb.0: # %entry
150 ; CHECK-LE-NEXT: xor r3, r3, r4
151 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
152 ; CHECK-LE-NEXT: cntlzw r3, r3
153 ; CHECK-LE-NEXT: srwi r3, r3, 5
154 ; CHECK-LE-NEXT: xori r3, r3, 1
155 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r5)
158 %cmp = icmp ne i8 %a, %b
159 %conv3 = zext i1 %cmp to i8
160 store i8 %conv3, i8* @glob, align 1
164 define void @test_inesc_sext_store(i8 signext %a, i8 signext %b) {
165 ; CHECK-LABEL: test_inesc_sext_store:
166 ; CHECK: # %bb.0: # %entry
167 ; CHECK-NEXT: xor r3, r3, r4
168 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
169 ; CHECK-NEXT: cntlzw r3, r3
170 ; CHECK-NEXT: srwi r3, r3, 5
171 ; CHECK-NEXT: xori r3, r3, 1
172 ; CHECK-NEXT: neg r3, r3
173 ; CHECK-NEXT: stb r3, glob@toc@l(r5)
175 ; CHECK-BE-LABEL: test_inesc_sext_store:
176 ; CHECK-BE: # %bb.0: # %entry
177 ; CHECK-BE-NEXT: xor r3, r3, r4
178 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
179 ; CHECK-BE-NEXT: cntlzw r3, r3
180 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
181 ; CHECK-BE-NEXT: srwi r3, r3, 5
182 ; CHECK-BE-NEXT: xori r3, r3, 1
183 ; CHECK-BE-NEXT: neg r3, r3
184 ; CHECK-BE-NEXT: stb r3, 0(r4)
187 ; CHECK-LE-LABEL: test_inesc_sext_store:
188 ; CHECK-LE: # %bb.0: # %entry
189 ; CHECK-LE-NEXT: xor r3, r3, r4
190 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
191 ; CHECK-LE-NEXT: cntlzw r3, r3
192 ; CHECK-LE-NEXT: srwi r3, r3, 5
193 ; CHECK-LE-NEXT: xori r3, r3, 1
194 ; CHECK-LE-NEXT: neg r3, r3
195 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r5)
198 %cmp = icmp ne i8 %a, %b
199 %conv3 = sext i1 %cmp to i8
200 store i8 %conv3, i8* @glob, align 1
204 define void @test_inesc_z_store(i8 signext %a) {
205 ; CHECK-LABEL: test_inesc_z_store:
206 ; CHECK: # %bb.0: # %entry
207 ; CHECK-NEXT: cntlzw r3, r3
208 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
209 ; CHECK-NEXT: srwi r3, r3, 5
210 ; CHECK-NEXT: xori r3, r3, 1
211 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
213 ; CHECK-BE-LABEL: test_inesc_z_store:
214 ; CHECK-BE: # %bb.0: # %entry
215 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
216 ; CHECK-BE-NEXT: cntlzw r3, r3
217 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
218 ; CHECK-BE-NEXT: srwi r3, r3, 5
219 ; CHECK-BE-NEXT: xori r3, r3, 1
220 ; CHECK-BE-NEXT: stb r3, 0(r4)
223 ; CHECK-LE-LABEL: test_inesc_z_store:
224 ; CHECK-LE: # %bb.0: # %entry
225 ; CHECK-LE-NEXT: cntlzw r3, r3
226 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
227 ; CHECK-LE-NEXT: srwi r3, r3, 5
228 ; CHECK-LE-NEXT: xori r3, r3, 1
229 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
232 %cmp = icmp ne i8 %a, 0
233 %conv2 = zext i1 %cmp to i8
234 store i8 %conv2, i8* @glob, align 1
238 define void @test_inesc_sext_z_store(i8 signext %a) {
239 ; CHECK-LABEL: test_inesc_sext_z_store:
240 ; CHECK: # %bb.0: # %entry
241 ; CHECK-NEXT: cntlzw r3, r3
242 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
243 ; CHECK-NEXT: srwi r3, r3, 5
244 ; CHECK-NEXT: xori r3, r3, 1
245 ; CHECK-NEXT: neg r3, r3
246 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
248 ; CHECK-BE-LABEL: test_inesc_sext_z_store:
249 ; CHECK-BE: # %bb.0: # %entry
250 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
251 ; CHECK-BE-NEXT: cntlzw r3, r3
252 ; CHECK-BE-NEXT: srwi r3, r3, 5
253 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
254 ; CHECK-BE-NEXT: xori r3, r3, 1
255 ; CHECK-BE-NEXT: neg r3, r3
256 ; CHECK-BE-NEXT: stb r3, 0(r4)
259 ; CHECK-LE-LABEL: test_inesc_sext_z_store:
260 ; CHECK-LE: # %bb.0: # %entry
261 ; CHECK-LE-NEXT: cntlzw r3, r3
262 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
263 ; CHECK-LE-NEXT: srwi r3, r3, 5
264 ; CHECK-LE-NEXT: xori r3, r3, 1
265 ; CHECK-LE-NEXT: neg r3, r3
266 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
269 %cmp = icmp ne i8 %a, 0
270 %conv2 = sext i1 %cmp to i8
271 store i8 %conv2, i8* @glob, align 1