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/testComparesieqss.c'
10 @glob = dso_local local_unnamed_addr global i16 0, align 2
12 ; Function Attrs: norecurse nounwind readnone
13 define dso_local signext i32 @test_ieqss(i16 signext %a, i16 signext %b) {
14 ; CHECK-LABEL: test_ieqss:
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_ieqss:
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_ieqss:
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 i16 %a, %b
35 %conv2 = zext i1 %cmp to i32
39 ; Function Attrs: norecurse nounwind readnone
40 define dso_local signext i32 @test_ieqss_sext(i16 signext %a, i16 signext %b) {
41 ; CHECK-LABEL: test_ieqss_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_ieqss_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_ieqss_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 i16 %a, %b
65 %sub = sext i1 %cmp to i32
69 ; Function Attrs: norecurse nounwind readnone
70 define dso_local signext i32 @test_ieqss_z(i16 signext %a) {
71 ; CHECK-LABEL: test_ieqss_z:
72 ; CHECK: # %bb.0: # %entry
73 ; CHECK-NEXT: cntlzw r3, r3
74 ; CHECK-NEXT: srwi r3, r3, 5
76 ; CHECK-BE-LABEL: test_ieqss_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_ieqss_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 i16 %a, 0
89 %conv1 = zext i1 %cmp to i32
93 ; Function Attrs: norecurse nounwind readnone
94 define dso_local signext i32 @test_ieqss_sext_z(i16 signext %a) {
95 ; CHECK-LABEL: test_ieqss_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_ieqss_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_ieqss_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 i16 %a, 0
116 %sub = sext i1 %cmp to i32
120 ; Function Attrs: norecurse nounwind
121 define dso_local void @test_ieqss_store(i16 signext %a, i16 signext %b) {
122 ; CHECK-LABEL: test_ieqss_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: sth r3, glob@toc@l(r5)
130 ; CHECK-BE-LABEL: test_ieqss_store:
131 ; CHECK-BE: # %bb.0: # %entry
132 ; CHECK-BE-NEXT: xor r3, r3, r4
133 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
134 ; CHECK-BE-NEXT: cntlzw r3, r3
135 ; CHECK-BE-NEXT: srwi r3, r3, 5
136 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
139 ; CHECK-LE-LABEL: test_ieqss_store:
140 ; CHECK-LE: # %bb.0: # %entry
141 ; CHECK-LE-NEXT: xor r3, r3, r4
142 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
143 ; CHECK-LE-NEXT: cntlzw r3, r3
144 ; CHECK-LE-NEXT: srwi r3, r3, 5
145 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
148 %cmp = icmp eq i16 %a, %b
149 %conv3 = zext i1 %cmp to i16
150 store i16 %conv3, ptr @glob, align 2
154 ; Function Attrs: norecurse nounwind
155 define dso_local void @test_ieqss_sext_store(i16 signext %a, i16 signext %b) {
156 ; CHECK-LABEL: test_ieqss_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: sth r3, glob@toc@l(r5)
165 ; CHECK-BE-LABEL: test_ieqss_sext_store:
166 ; CHECK-BE: # %bb.0: # %entry
167 ; CHECK-BE-NEXT: xor r3, r3, r4
168 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
169 ; CHECK-BE-NEXT: cntlzw r3, r3
170 ; CHECK-BE-NEXT: srwi r3, r3, 5
171 ; CHECK-BE-NEXT: neg r3, r3
172 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
175 ; CHECK-LE-LABEL: test_ieqss_sext_store:
176 ; CHECK-LE: # %bb.0: # %entry
177 ; CHECK-LE-NEXT: xor r3, r3, r4
178 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
179 ; CHECK-LE-NEXT: cntlzw r3, r3
180 ; CHECK-LE-NEXT: srwi r3, r3, 5
181 ; CHECK-LE-NEXT: neg r3, r3
182 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
185 %cmp = icmp eq i16 %a, %b
186 %conv3 = sext i1 %cmp to i16
187 store i16 %conv3, ptr @glob, align 2
191 ; Function Attrs: norecurse nounwind
192 define dso_local void @test_ieqss_z_store(i16 signext %a) {
193 ; CHECK-LABEL: test_ieqss_z_store:
194 ; CHECK: # %bb.0: # %entry
195 ; CHECK-NEXT: cntlzw r3, r3
196 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
197 ; CHECK-NEXT: srwi r3, r3, 5
198 ; CHECK-NEXT: sth r3, glob@toc@l(r4)
200 ; CHECK-BE-LABEL: test_ieqss_z_store:
201 ; CHECK-BE: # %bb.0: # %entry
202 ; CHECK-BE-NEXT: cntlzw r3, r3
203 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
204 ; CHECK-BE-NEXT: srwi r3, r3, 5
205 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
208 ; CHECK-LE-LABEL: test_ieqss_z_store:
209 ; CHECK-LE: # %bb.0: # %entry
210 ; CHECK-LE-NEXT: cntlzw r3, r3
211 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
212 ; CHECK-LE-NEXT: srwi r3, r3, 5
213 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
216 %cmp = icmp eq i16 %a, 0
217 %conv2 = zext i1 %cmp to i16
218 store i16 %conv2, ptr @glob, align 2
222 ; Function Attrs: norecurse nounwind
223 define dso_local void @test_ieqss_sext_z_store(i16 signext %a) {
224 ; CHECK-LABEL: test_ieqss_sext_z_store:
225 ; CHECK: # %bb.0: # %entry
226 ; CHECK-NEXT: cntlzw r3, r3
227 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
228 ; CHECK-NEXT: srwi r3, r3, 5
229 ; CHECK-NEXT: neg r3, r3
230 ; CHECK-NEXT: sth r3, glob@toc@l(r4)
232 ; CHECK-BE-LABEL: test_ieqss_sext_z_store:
233 ; CHECK-BE: # %bb.0: # %entry
234 ; CHECK-BE-NEXT: cntlzw r3, r3
235 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
236 ; CHECK-BE-NEXT: srwi r3, r3, 5
237 ; CHECK-BE-NEXT: neg r3, r3
238 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
241 ; CHECK-LE-LABEL: test_ieqss_sext_z_store:
242 ; CHECK-LE: # %bb.0: # %entry
243 ; CHECK-LE-NEXT: cntlzw r3, r3
244 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
245 ; CHECK-LE-NEXT: srwi r3, r3, 5
246 ; CHECK-LE-NEXT: neg r3, r3
247 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
250 %cmp = icmp eq i16 %a, 0
251 %conv2 = sext i1 %cmp to i16
252 store i16 %conv2, ptr @glob, align 2