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 ; ModuleID = 'ComparisonTestCases/testComparesieqsi.c'
10 @glob = common local_unnamed_addr global i32 0, align 4
12 ; Function Attrs: norecurse nounwind readnone
13 define signext i32 @test_ieqsi(i32 signext %a, i32 signext %b) {
14 ; CHECK-LABEL: test_ieqsi:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: xor r3, r3, r4
17 ; CHECK-NEXT: cntlzw r3, r3
18 ; CHECK-NEXT: srwi r3, r3, 5
20 ; CHECK-BE-LABEL: test_ieqsi:
21 ; CHECK-BE: # %bb.0: # %entry
22 ; CHECK-BE-NEXT: xor r3, r3, r4
23 ; CHECK-BE-NEXT: cntlzw r3, r3
24 ; CHECK-BE-NEXT: srwi r3, r3, 5
27 ; CHECK-LE-LABEL: test_ieqsi:
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
34 %cmp = icmp eq i32 %a, %b
35 %conv = zext i1 %cmp to i32
39 ; Function Attrs: norecurse nounwind readnone
40 define signext i32 @test_ieqsi_sext(i32 signext %a, i32 signext %b) {
41 ; CHECK-LABEL: test_ieqsi_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: neg r3, r3
48 ; CHECK-BE-LABEL: test_ieqsi_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: neg r3, r3
56 ; CHECK-LE-LABEL: test_ieqsi_sext:
57 ; CHECK-LE: # %bb.0: # %entry
58 ; CHECK-LE-NEXT: xor r3, r3, r4
59 ; CHECK-LE-NEXT: cntlzw r3, r3
60 ; CHECK-LE-NEXT: srwi r3, r3, 5
61 ; CHECK-LE-NEXT: neg r3, r3
64 %cmp = icmp eq i32 %a, %b
65 %sub = sext i1 %cmp to i32
69 ; Function Attrs: norecurse nounwind readnone
70 define signext i32 @test_ieqsi_z(i32 signext %a) {
71 ; CHECK-LABEL: test_ieqsi_z:
72 ; CHECK: # %bb.0: # %entry
73 ; CHECK-NEXT: cntlzw r3, r3
74 ; CHECK-NEXT: srwi r3, r3, 5
76 ; CHECK-BE-LABEL: test_ieqsi_z:
77 ; CHECK-BE: # %bb.0: # %entry
78 ; CHECK-BE-NEXT: cntlzw r3, r3
79 ; CHECK-BE-NEXT: srwi r3, r3, 5
82 ; CHECK-LE-LABEL: test_ieqsi_z:
83 ; CHECK-LE: # %bb.0: # %entry
84 ; CHECK-LE-NEXT: cntlzw r3, r3
85 ; CHECK-LE-NEXT: srwi r3, r3, 5
88 %cmp = icmp eq i32 %a, 0
89 %conv = zext i1 %cmp to i32
93 ; Function Attrs: norecurse nounwind readnone
94 define signext i32 @test_ieqsi_sext_z(i32 signext %a) {
95 ; CHECK-LABEL: test_ieqsi_sext_z:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK-NEXT: cntlzw r3, r3
98 ; CHECK-NEXT: srwi r3, r3, 5
99 ; CHECK-NEXT: neg r3, r3
101 ; CHECK-BE-LABEL: test_ieqsi_sext_z:
102 ; CHECK-BE: # %bb.0: # %entry
103 ; CHECK-BE-NEXT: cntlzw r3, r3
104 ; CHECK-BE-NEXT: srwi r3, r3, 5
105 ; CHECK-BE-NEXT: neg r3, r3
108 ; CHECK-LE-LABEL: test_ieqsi_sext_z:
109 ; CHECK-LE: # %bb.0: # %entry
110 ; CHECK-LE-NEXT: cntlzw r3, r3
111 ; CHECK-LE-NEXT: srwi r3, r3, 5
112 ; CHECK-LE-NEXT: neg r3, r3
115 %cmp = icmp eq i32 %a, 0
116 %sub = sext i1 %cmp to i32
120 ; Function Attrs: norecurse nounwind
121 define void @test_ieqsi_store(i32 signext %a, i32 signext %b) {
122 ; CHECK-LABEL: test_ieqsi_store:
123 ; CHECK: # %bb.0: # %entry
124 ; CHECK-NEXT: xor r3, r3, r4
125 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
126 ; CHECK-NEXT: cntlzw r3, r3
127 ; CHECK-NEXT: srwi r3, r3, 5
128 ; CHECK-NEXT: stw r3, glob@toc@l(r5)
130 ; CHECK-BE-LABEL: test_ieqsi_store:
131 ; CHECK-BE: # %bb.0: # %entry
132 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
133 ; CHECK-BE-NEXT: xor r3, r3, r4
134 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
135 ; CHECK-BE-NEXT: cntlzw r3, r3
136 ; CHECK-BE-NEXT: srwi r3, r3, 5
137 ; CHECK-BE-NEXT: stw r3, 0(r4)
140 ; CHECK-LE-LABEL: test_ieqsi_store:
141 ; CHECK-LE: # %bb.0: # %entry
142 ; CHECK-LE-NEXT: xor r3, r3, r4
143 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
144 ; CHECK-LE-NEXT: cntlzw r3, r3
145 ; CHECK-LE-NEXT: srwi r3, r3, 5
146 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r5)
149 %cmp = icmp eq i32 %a, %b
150 %conv = zext i1 %cmp to i32
151 store i32 %conv, i32* @glob, align 4
155 ; Function Attrs: norecurse nounwind
156 define void @test_ieqsi_sext_store(i32 signext %a, i32 signext %b) {
157 ; CHECK-LABEL: test_ieqsi_sext_store:
158 ; CHECK: # %bb.0: # %entry
159 ; CHECK-NEXT: xor r3, r3, r4
160 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
161 ; CHECK-NEXT: cntlzw r3, r3
162 ; CHECK-NEXT: srwi r3, r3, 5
163 ; CHECK-NEXT: neg r3, r3
164 ; CHECK-NEXT: stw r3, glob@toc@l(r5)
166 ; CHECK-BE-LABEL: test_ieqsi_sext_store:
167 ; CHECK-BE: # %bb.0: # %entry
168 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
169 ; CHECK-BE-NEXT: xor r3, r3, r4
170 ; CHECK-BE-NEXT: cntlzw r3, r3
171 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
172 ; CHECK-BE-NEXT: srwi r3, r3, 5
173 ; CHECK-BE-NEXT: neg r3, r3
174 ; CHECK-BE-NEXT: stw r3, 0(r4)
177 ; CHECK-LE-LABEL: test_ieqsi_sext_store:
178 ; CHECK-LE: # %bb.0: # %entry
179 ; CHECK-LE-NEXT: xor r3, r3, r4
180 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
181 ; CHECK-LE-NEXT: cntlzw r3, r3
182 ; CHECK-LE-NEXT: srwi r3, r3, 5
183 ; CHECK-LE-NEXT: neg r3, r3
184 ; CHECK-LE-NEXT: stw r3, glob@toc@l(r5)
187 %cmp = icmp eq i32 %a, %b
188 %sub = sext i1 %cmp to i32
189 store i32 %sub, i32* @glob, align 4
193 ; Function Attrs: norecurse nounwind
194 define void @test_ieqsi_z_store(i32 signext %a) {
195 ; CHECK-LABEL: test_ieqsi_z_store:
196 ; CHECK: # %bb.0: # %entry
197 ; CHECK-NEXT: cntlzw r3, r3
198 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
199 ; CHECK-NEXT: srwi r3, r3, 5
200 ; CHECK-NEXT: stw r3, glob@toc@l(r4)
202 ; CHECK-BE-LABEL: test_ieqsi_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_ieqsi_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_ieqsi_sext_z_store(i32 signext %a) {
227 ; CHECK-LABEL: test_ieqsi_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_ieqsi_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_ieqsi_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