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 = dso_local local_unnamed_addr global i8 0, align 1
11 define dso_local 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 dso_local 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 dso_local 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 dso_local 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 dso_local 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: xor r3, r3, r4
140 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
141 ; CHECK-BE-NEXT: cntlzw r3, r3
142 ; CHECK-BE-NEXT: srwi r3, r3, 5
143 ; CHECK-BE-NEXT: xori r3, r3, 1
144 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r5)
147 ; CHECK-LE-LABEL: test_inesc_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, ptr @glob, align 1
163 define dso_local void @test_inesc_sext_store(i8 signext %a, i8 signext %b) {
164 ; CHECK-LABEL: test_inesc_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_inesc_sext_store:
175 ; CHECK-BE: # %bb.0: # %entry
176 ; CHECK-BE-NEXT: xor r3, r3, r4
177 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
178 ; CHECK-BE-NEXT: cntlzw r3, r3
179 ; CHECK-BE-NEXT: srwi r3, r3, 5
180 ; CHECK-BE-NEXT: xori r3, r3, 1
181 ; CHECK-BE-NEXT: neg r3, r3
182 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r5)
185 ; CHECK-LE-LABEL: test_inesc_sext_store:
186 ; CHECK-LE: # %bb.0: # %entry
187 ; CHECK-LE-NEXT: xor r3, r3, r4
188 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
189 ; CHECK-LE-NEXT: cntlzw r3, r3
190 ; CHECK-LE-NEXT: srwi r3, r3, 5
191 ; CHECK-LE-NEXT: xori r3, r3, 1
192 ; CHECK-LE-NEXT: neg r3, r3
193 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r5)
196 %cmp = icmp ne i8 %a, %b
197 %conv3 = sext i1 %cmp to i8
198 store i8 %conv3, ptr @glob, align 1
202 define dso_local void @test_inesc_z_store(i8 signext %a) {
203 ; CHECK-LABEL: test_inesc_z_store:
204 ; CHECK: # %bb.0: # %entry
205 ; CHECK-NEXT: cntlzw r3, r3
206 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
207 ; CHECK-NEXT: srwi r3, r3, 5
208 ; CHECK-NEXT: xori r3, r3, 1
209 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
211 ; CHECK-BE-LABEL: test_inesc_z_store:
212 ; CHECK-BE: # %bb.0: # %entry
213 ; CHECK-BE-NEXT: cntlzw r3, r3
214 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
215 ; CHECK-BE-NEXT: srwi r3, r3, 5
216 ; CHECK-BE-NEXT: xori r3, r3, 1
217 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
220 ; CHECK-LE-LABEL: test_inesc_z_store:
221 ; CHECK-LE: # %bb.0: # %entry
222 ; CHECK-LE-NEXT: cntlzw r3, r3
223 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
224 ; CHECK-LE-NEXT: srwi r3, r3, 5
225 ; CHECK-LE-NEXT: xori r3, r3, 1
226 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
229 %cmp = icmp ne i8 %a, 0
230 %conv2 = zext i1 %cmp to i8
231 store i8 %conv2, ptr @glob, align 1
235 define dso_local void @test_inesc_sext_z_store(i8 signext %a) {
236 ; CHECK-LABEL: test_inesc_sext_z_store:
237 ; CHECK: # %bb.0: # %entry
238 ; CHECK-NEXT: cntlzw r3, r3
239 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
240 ; CHECK-NEXT: srwi r3, r3, 5
241 ; CHECK-NEXT: xori r3, r3, 1
242 ; CHECK-NEXT: neg r3, r3
243 ; CHECK-NEXT: stb r3, glob@toc@l(r4)
245 ; CHECK-BE-LABEL: test_inesc_sext_z_store:
246 ; CHECK-BE: # %bb.0: # %entry
247 ; CHECK-BE-NEXT: cntlzw r3, r3
248 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
249 ; CHECK-BE-NEXT: srwi r3, r3, 5
250 ; CHECK-BE-NEXT: xori r3, r3, 1
251 ; CHECK-BE-NEXT: neg r3, r3
252 ; CHECK-BE-NEXT: stb r3, glob@toc@l(r4)
255 ; CHECK-LE-LABEL: test_inesc_sext_z_store:
256 ; CHECK-LE: # %bb.0: # %entry
257 ; CHECK-LE-NEXT: cntlzw r3, r3
258 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
259 ; CHECK-LE-NEXT: srwi r3, r3, 5
260 ; CHECK-LE-NEXT: xori r3, r3, 1
261 ; CHECK-LE-NEXT: neg r3, r3
262 ; CHECK-LE-NEXT: stb r3, glob@toc@l(r4)
265 %cmp = icmp ne i8 %a, 0
266 %conv2 = sext i1 %cmp to i8
267 store i8 %conv2, ptr @glob, align 1