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 = local_unnamed_addr global i32 0, align 4
11 ; Function Attrs: norecurse nounwind readnone
12 define i64 @test_lleqsi(i32 signext %a, i32 signext %b) {
13 ; CHECK-LABEL: test_lleqsi:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: xor r3, r3, r4
16 ; CHECK-NEXT: cntlzw r3, r3
17 ; CHECK-NEXT: srwi r3, r3, 5
19 ; CHECK-BE-LABEL: test_lleqsi:
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
26 ; CHECK-LE-LABEL: test_lleqsi:
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
33 %cmp = icmp eq i32 %a, %b
34 %conv1 = zext i1 %cmp to i64
38 ; Function Attrs: norecurse nounwind readnone
39 define i64 @test_lleqsi_sext(i32 signext %a, i32 signext %b) {
40 ; CHECK-LABEL: test_lleqsi_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: neg r3, r3
47 ; CHECK-BE-LABEL: test_lleqsi_sext:
48 ; CHECK-BE: # %bb.0: # %entry
49 ; CHECK-BE-NEXT: xor r3, r3, r4
50 ; CHECK-BE-NEXT: cntlzw r3, r3
51 ; CHECK-BE-NEXT: srwi r3, r3, 5
52 ; CHECK-BE-NEXT: neg r3, r3
55 ; CHECK-LE-LABEL: test_lleqsi_sext:
56 ; CHECK-LE: # %bb.0: # %entry
57 ; CHECK-LE-NEXT: xor r3, r3, r4
58 ; CHECK-LE-NEXT: cntlzw r3, r3
59 ; CHECK-LE-NEXT: srwi r3, r3, 5
60 ; CHECK-LE-NEXT: neg r3, r3
63 %cmp = icmp eq i32 %a, %b
64 %conv1 = sext i1 %cmp to i64
68 ; Function Attrs: norecurse nounwind readnone
69 define i64 @test_lleqsi_z(i32 signext %a) {
70 ; CHECK-LABEL: test_lleqsi_z:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: cntlzw r3, r3
73 ; CHECK-NEXT: srwi r3, r3, 5
75 ; CHECK-BE-LABEL: test_lleqsi_z:
76 ; CHECK-BE: # %bb.0: # %entry
77 ; CHECK-BE-NEXT: cntlzw r3, r3
78 ; CHECK-BE-NEXT: srwi r3, r3, 5
81 ; CHECK-LE-LABEL: test_lleqsi_z:
82 ; CHECK-LE: # %bb.0: # %entry
83 ; CHECK-LE-NEXT: cntlzw r3, r3
84 ; CHECK-LE-NEXT: srwi r3, r3, 5
87 %cmp = icmp eq i32 %a, 0
88 %conv1 = zext i1 %cmp to i64
92 ; Function Attrs: norecurse nounwind readnone
93 define i64 @test_lleqsi_sext_z(i32 signext %a) {
94 ; CHECK-LABEL: test_lleqsi_sext_z:
95 ; CHECK: # %bb.0: # %entry
96 ; CHECK-NEXT: cntlzw r3, r3
97 ; CHECK-NEXT: srwi r3, r3, 5
98 ; CHECK-NEXT: neg r3, r3
100 ; CHECK-BE-LABEL: test_lleqsi_sext_z:
101 ; CHECK-BE: # %bb.0: # %entry
102 ; CHECK-BE-NEXT: cntlzw r3, r3
103 ; CHECK-BE-NEXT: srwi r3, r3, 5
104 ; CHECK-BE-NEXT: neg r3, r3
107 ; CHECK-LE-LABEL: test_lleqsi_sext_z:
108 ; CHECK-LE: # %bb.0: # %entry
109 ; CHECK-LE-NEXT: cntlzw r3, r3
110 ; CHECK-LE-NEXT: srwi r3, r3, 5
111 ; CHECK-LE-NEXT: neg r3, r3
114 %cmp = icmp eq i32 %a, 0
115 %conv1 = sext i1 %cmp to i64
119 ; Function Attrs: norecurse nounwind
120 define void @test_lleqsi_store(i32 signext %a, i32 signext %b) {
121 ; CHECK-LABEL: test_lleqsi_store:
122 ; CHECK: # %bb.0: # %entry
123 ; CHECK-NEXT: xor r3, r3, r4
124 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
125 ; CHECK-NEXT: cntlzw r3, r3
126 ; CHECK-NEXT: srwi r3, r3, 5
127 ; CHECK-NEXT: stw r3, glob@toc@l(r5)
129 ; CHECK-BE-LABEL: test_lleqsi_store:
130 ; CHECK-BE: # %bb.0: # %entry
131 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
132 ; CHECK-BE-NEXT: xor r3, r3, r4
133 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
134 ; CHECK-BE-NEXT: cntlzw r3, r3
135 ; CHECK-BE-NEXT: srwi r3, r3, 5
136 ; CHECK-BE-NEXT: stw r3, 0(r4)
139 ; CHECK-LE-LABEL: test_lleqsi_store:
140 ; CHECK-LE: # %bb.0: # %entry
141 ; CHECK-LE-NEXT: xor r3, r3, r4
142 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
143 ; CHECK-LE-NEXT: cntlzw r3, r3
144 ; CHECK-LE-NEXT: srwi r3, r3, 5
145 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r5)
148 %cmp = icmp eq i32 %a, %b
149 %conv = zext i1 %cmp to i32
150 store i32 %conv, i32* @glob, align 4
154 ; Function Attrs: norecurse nounwind
155 define void @test_lleqsi_sext_store(i32 signext %a, i32 signext %b) {
156 ; CHECK-LABEL: test_lleqsi_sext_store:
157 ; CHECK: # %bb.0: # %entry
158 ; CHECK-NEXT: xor r3, r3, r4
159 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
160 ; CHECK-NEXT: cntlzw r3, r3
161 ; CHECK-NEXT: srwi r3, r3, 5
162 ; CHECK-NEXT: neg r3, r3
163 ; CHECK-NEXT: stw r3, glob@toc@l(r5)
165 ; CHECK-BE-LABEL: test_lleqsi_sext_store:
166 ; CHECK-BE: # %bb.0: # %entry
167 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
168 ; CHECK-BE-NEXT: xor r3, r3, r4
169 ; CHECK-BE-NEXT: cntlzw r3, r3
170 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
171 ; CHECK-BE-NEXT: srwi r3, r3, 5
172 ; CHECK-BE-NEXT: neg r3, r3
173 ; CHECK-BE-NEXT: stw r3, 0(r4)
176 ; CHECK-LE-LABEL: test_lleqsi_sext_store:
177 ; CHECK-LE: # %bb.0: # %entry
178 ; CHECK-LE-NEXT: xor r3, r3, r4
179 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
180 ; CHECK-LE-NEXT: cntlzw r3, r3
181 ; CHECK-LE-NEXT: srwi r3, r3, 5
182 ; CHECK-LE-NEXT: neg r3, r3
183 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r5)
186 %cmp = icmp eq i32 %a, %b
187 %sub = sext i1 %cmp to i32
188 store i32 %sub, i32* @glob, align 4
192 ; Function Attrs: norecurse nounwind
193 define void @test_lleqsi_z_store(i32 signext %a) {
194 ; CHECK-LABEL: test_lleqsi_z_store:
195 ; CHECK: # %bb.0: # %entry
196 ; CHECK-NEXT: cntlzw r3, r3
197 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
198 ; CHECK-NEXT: srwi r3, r3, 5
199 ; CHECK-NEXT: stw r3, glob@toc@l(r4)
202 ; CHECK-BE-LABEL: test_lleqsi_z_store:
203 ; CHECK-BE: # %bb.0: # %entry
204 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
205 ; CHECK-BE-NEXT: cntlzw r3, r3
206 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
207 ; CHECK-BE-NEXT: srwi r3, r3, 5
208 ; CHECK-BE-NEXT: stw r3, 0(r4)
211 ; CHECK-LE-LABEL: test_lleqsi_z_store:
212 ; CHECK-LE: # %bb.0: # %entry
213 ; CHECK-LE-NEXT: cntlzw r3, r3
214 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
215 ; CHECK-LE-NEXT: srwi r3, r3, 5
216 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r4)
219 %cmp = icmp eq i32 %a, 0
220 %conv = zext i1 %cmp to i32
221 store i32 %conv, i32* @glob, align 4
225 ; Function Attrs: norecurse nounwind
226 define void @test_lleqsi_sext_z_store(i32 signext %a) {
227 ; CHECK-LABEL: test_lleqsi_sext_z_store:
228 ; CHECK: # %bb.0: # %entry
229 ; CHECK-NEXT: cntlzw r3, r3
230 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
231 ; CHECK-NEXT: srwi r3, r3, 5
232 ; CHECK-NEXT: neg r3, r3
233 ; CHECK-NEXT: stw r3, glob@toc@l(r4)
235 ; CHECK-BE-LABEL: test_lleqsi_sext_z_store:
236 ; CHECK-BE: # %bb.0: # %entry
237 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
238 ; CHECK-BE-NEXT: cntlzw r3, r3
239 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
240 ; CHECK-BE-NEXT: srwi r3, r3, 5
241 ; CHECK-BE-NEXT: neg r3, r3
242 ; CHECK-BE-NEXT: stw r3, 0(r4)
245 ; CHECK-LE-LABEL: test_lleqsi_sext_z_store:
246 ; CHECK-LE: # %bb.0: # %entry
247 ; CHECK-LE-NEXT: cntlzw r3, r3
248 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
249 ; CHECK-LE-NEXT: srwi r3, r3, 5
250 ; CHECK-LE-NEXT: neg r3, r3
251 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r4)
254 %cmp = icmp eq i32 %a, 0
255 %sub = sext i1 %cmp to i32
256 store i32 %sub, i32* @glob, align 4