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 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 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: 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: sth r3, 0(r4)
139 ; CHECK-LE-LABEL: test_llequs_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: sth r3, glob@toc@l(r5)
148 %cmp = icmp eq i16 %a, %b
149 %conv3 = zext i1 %cmp to i16
150 store i16 %conv3, i16* @glob, align 2
154 ; Function Attrs: norecurse nounwind
155 define void @test_llequs_sext_store(i16 zeroext %a, i16 zeroext %b) {
156 ; CHECK-LABEL: test_llequs_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_llequs_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: sth r3, 0(r4)
176 ; CHECK-LE-LABEL: test_llequs_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: sth r3, glob@toc@l(r5)
186 %cmp = icmp eq i16 %a, %b
187 %conv3 = sext i1 %cmp to i16
188 store i16 %conv3, i16* @glob, align 2
192 ; Function Attrs: norecurse nounwind
193 define void @test_llequs_z_store(i16 zeroext %a) {
194 ; CHECK-LABEL: test_llequs_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: sth r3, glob@toc@l(r4)
201 ; CHECK-BE-LABEL: test_llequs_z_store:
202 ; CHECK-BE: # %bb.0: # %entry
203 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
204 ; CHECK-BE-NEXT: cntlzw r3, r3
205 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
206 ; CHECK-BE-NEXT: srwi r3, r3, 5
207 ; CHECK-BE-NEXT: sth r3, 0(r4)
210 ; CHECK-LE-LABEL: test_llequs_z_store:
211 ; CHECK-LE: # %bb.0: # %entry
212 ; CHECK-LE-NEXT: cntlzw r3, r3
213 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
214 ; CHECK-LE-NEXT: srwi r3, r3, 5
215 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
218 %cmp = icmp eq i16 %a, 0
219 %conv2 = zext i1 %cmp to i16
220 store i16 %conv2, i16* @glob, align 2
224 ; Function Attrs: norecurse nounwind
225 define void @test_llequs_sext_z_store(i16 zeroext %a) {
226 ; CHECK-LABEL: test_llequs_sext_z_store:
227 ; CHECK: # %bb.0: # %entry
228 ; CHECK-NEXT: cntlzw r3, r3
229 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
230 ; CHECK-NEXT: srwi r3, r3, 5
231 ; CHECK-NEXT: neg r3, r3
232 ; CHECK-NEXT: sth r3, glob@toc@l(r4)
234 ; CHECK-BE-LABEL: test_llequs_sext_z_store:
235 ; CHECK-BE: # %bb.0: # %entry
236 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
237 ; CHECK-BE-NEXT: cntlzw r3, r3
238 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
239 ; CHECK-BE-NEXT: srwi r3, r3, 5
240 ; CHECK-BE-NEXT: neg r3, r3
241 ; CHECK-BE-NEXT: sth r3, 0(r4)
244 ; CHECK-LE-LABEL: test_llequs_sext_z_store:
245 ; CHECK-LE: # %bb.0: # %entry
246 ; CHECK-LE-NEXT: cntlzw r3, r3
247 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
248 ; CHECK-LE-NEXT: srwi r3, r3, 5
249 ; CHECK-LE-NEXT: neg r3, r3
250 ; CHECK-LE-NEXT: sth r3, glob@toc@l(r4)
253 %cmp = icmp eq i16 %a, 0
254 %conv2 = sext i1 %cmp to i16
255 store i16 %conv2, i16* @glob, align 2