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 i16 0, align 2
11 ; Function Attrs: norecurse nounwind readnone
12 define i64 @test_llequs(i16 zeroext %a, i16 zeroext %b) {
13 ; CHECK-LABEL: test_llequs:
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_llequs:
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_llequs:
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 i16 %a, %b
34 %conv3 = zext i1 %cmp to i64
38 ; Function Attrs: norecurse nounwind readnone
39 define i64 @test_llequs_sext(i16 zeroext %a, i16 zeroext %b) {
40 ; CHECK-LABEL: test_llequs_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_llequs_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_llequs_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 i16 %a, %b
64 %conv3 = sext i1 %cmp to i64
68 ; Function Attrs: norecurse nounwind readnone
69 define i64 @test_llequs_z(i16 zeroext %a) {
70 ; CHECK-LABEL: test_llequs_z:
71 ; CHECK: # %bb.0: # %entry
72 ; CHECK-NEXT: cntlzw r3, r3
73 ; CHECK-NEXT: srwi r3, r3, 5
75 ; CHECK-BE-LABEL: test_llequs_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_llequs_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 i16 %a, 0
88 %conv2 = zext i1 %cmp to i64
92 ; Function Attrs: norecurse nounwind readnone
93 define i64 @test_llequs_sext_z(i16 zeroext %a) {
94 ; CHECK-LABEL: test_llequs_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_llequs_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_llequs_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 i16 %a, 0
115 %conv2 = sext i1 %cmp to i64
119 ; Function Attrs: norecurse nounwind
120 define dso_local void @test_llequs_store(i16 zeroext %a, i16 zeroext %b) {
121 ; CHECK-LABEL: test_llequs_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: sth r3, glob@toc@l(r5)
129 ; CHECK-BE-LABEL: test_llequs_store:
130 ; CHECK-BE: # %bb.0: # %entry
131 ; CHECK-BE-NEXT: xor r3, r3, r4
132 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
133 ; CHECK-BE-NEXT: cntlzw r3, r3
134 ; CHECK-BE-NEXT: srwi r3, r3, 5
135 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
138 ; CHECK-LE-LABEL: test_llequs_store:
139 ; CHECK-LE: # %bb.0: # %entry
140 ; CHECK-LE-NEXT: xor r3, r3, r4
141 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
142 ; CHECK-LE-NEXT: cntlzw r3, r3
143 ; CHECK-LE-NEXT: srwi r3, r3, 5
144 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
147 %cmp = icmp eq i16 %a, %b
148 %conv3 = zext i1 %cmp to i16
149 store i16 %conv3, ptr @glob, align 2
153 ; Function Attrs: norecurse nounwind
154 define dso_local void @test_llequs_sext_store(i16 zeroext %a, i16 zeroext %b) {
155 ; CHECK-LABEL: test_llequs_sext_store:
156 ; CHECK: # %bb.0: # %entry
157 ; CHECK-NEXT: xor r3, r3, r4
158 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
159 ; CHECK-NEXT: cntlzw r3, r3
160 ; CHECK-NEXT: srwi r3, r3, 5
161 ; CHECK-NEXT: neg r3, r3
162 ; CHECK-NEXT: sth r3, glob@toc@l(r5)
164 ; CHECK-BE-LABEL: test_llequs_sext_store:
165 ; CHECK-BE: # %bb.0: # %entry
166 ; CHECK-BE-NEXT: xor r3, r3, r4
167 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
168 ; CHECK-BE-NEXT: cntlzw r3, r3
169 ; CHECK-BE-NEXT: srwi r3, r3, 5
170 ; CHECK-BE-NEXT: neg r3, r3
171 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
174 ; CHECK-LE-LABEL: test_llequs_sext_store:
175 ; CHECK-LE: # %bb.0: # %entry
176 ; CHECK-LE-NEXT: xor r3, r3, r4
177 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
178 ; CHECK-LE-NEXT: cntlzw r3, r3
179 ; CHECK-LE-NEXT: srwi r3, r3, 5
180 ; CHECK-LE-NEXT: neg r3, r3
181 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
184 %cmp = icmp eq i16 %a, %b
185 %conv3 = sext i1 %cmp to i16
186 store i16 %conv3, ptr @glob, align 2
190 ; Function Attrs: norecurse nounwind
191 define dso_local void @test_llequs_z_store(i16 zeroext %a) {
192 ; CHECK-LABEL: test_llequs_z_store:
193 ; CHECK: # %bb.0: # %entry
194 ; CHECK-NEXT: cntlzw r3, r3
195 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
196 ; CHECK-NEXT: srwi r3, r3, 5
197 ; CHECK-NEXT: sth r3, glob@toc@l(r4)
199 ; CHECK-BE-LABEL: test_llequs_z_store:
200 ; CHECK-BE: # %bb.0: # %entry
201 ; CHECK-BE-NEXT: cntlzw r3, r3
202 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
203 ; CHECK-BE-NEXT: srwi r3, r3, 5
204 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
207 ; CHECK-LE-LABEL: test_llequs_z_store:
208 ; CHECK-LE: # %bb.0: # %entry
209 ; CHECK-LE-NEXT: cntlzw r3, r3
210 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
211 ; CHECK-LE-NEXT: srwi r3, r3, 5
212 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
215 %cmp = icmp eq i16 %a, 0
216 %conv2 = zext i1 %cmp to i16
217 store i16 %conv2, ptr @glob, align 2
221 ; Function Attrs: norecurse nounwind
222 define dso_local void @test_llequs_sext_z_store(i16 zeroext %a) {
223 ; CHECK-LABEL: test_llequs_sext_z_store:
224 ; CHECK: # %bb.0: # %entry
225 ; CHECK-NEXT: cntlzw r3, r3
226 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
227 ; CHECK-NEXT: srwi r3, r3, 5
228 ; CHECK-NEXT: neg r3, r3
229 ; CHECK-NEXT: sth r3, glob@toc@l(r4)
231 ; CHECK-BE-LABEL: test_llequs_sext_z_store:
232 ; CHECK-BE: # %bb.0: # %entry
233 ; CHECK-BE-NEXT: cntlzw r3, r3
234 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
235 ; CHECK-BE-NEXT: srwi r3, r3, 5
236 ; CHECK-BE-NEXT: neg r3, r3
237 ; CHECK-BE-NEXT: sth r3, glob@toc@l(r4)
240 ; CHECK-LE-LABEL: test_llequs_sext_z_store:
241 ; CHECK-LE: # %bb.0: # %entry
242 ; CHECK-LE-NEXT: cntlzw r3, r3
243 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
244 ; CHECK-LE-NEXT: srwi r3, r3, 5
245 ; CHECK-LE-NEXT: neg r3, r3
246 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
249 %cmp = icmp eq i16 %a, 0
250 %conv2 = sext i1 %cmp to i16
251 store i16 %conv2, ptr @glob, align 2