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 i64 0, align 8
11 ; Function Attrs: norecurse nounwind readnone
12 define i64 @test_lleqsll(i64 %a, i64 %b) {
13 ; CHECK-LABEL: test_lleqsll:
14 ; CHECK: # %bb.0: # %entry
15 ; CHECK-NEXT: xor r3, r3, r4
16 ; CHECK-NEXT: cntlzd r3, r3
17 ; CHECK-NEXT: rldicl r3, r3, 58, 63
19 ; CHECK-BE-LABEL: test_lleqsll:
20 ; CHECK-BE: # %bb.0: # %entry
21 ; CHECK-BE-NEXT: xor r3, r3, r4
22 ; CHECK-BE-NEXT: cntlzd r3, r3
23 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
26 ; CHECK-LE-LABEL: test_lleqsll:
27 ; CHECK-LE: # %bb.0: # %entry
28 ; CHECK-LE-NEXT: xor r3, r3, r4
29 ; CHECK-LE-NEXT: cntlzd r3, r3
30 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
33 %cmp = icmp eq i64 %a, %b
34 %conv1 = zext i1 %cmp to i64
38 ; Function Attrs: norecurse nounwind readnone
39 define i64 @test_lleqsll_sext(i64 %a, i64 %b) {
40 ; CHECK-LABEL: test_lleqsll_sext:
41 ; CHECK: # %bb.0: # %entry
42 ; CHECK-NEXT: xor r3, r3, r4
43 ; CHECK-NEXT: addic r3, r3, -1
44 ; CHECK-NEXT: subfe r3, r3, r3
46 ; CHECK-BE-LABEL: test_lleqsll_sext:
47 ; CHECK-BE: # %bb.0: # %entry
48 ; CHECK-BE-NEXT: xor r3, r3, r4
49 ; CHECK-BE-NEXT: addic r3, r3, -1
50 ; CHECK-BE-NEXT: subfe r3, r3, r3
53 ; CHECK-LE-LABEL: test_lleqsll_sext:
54 ; CHECK-LE: # %bb.0: # %entry
55 ; CHECK-LE-NEXT: xor r3, r3, r4
56 ; CHECK-LE-NEXT: addic r3, r3, -1
57 ; CHECK-LE-NEXT: subfe r3, r3, r3
60 %cmp = icmp eq i64 %a, %b
61 %conv1 = sext i1 %cmp to i64
65 ; Function Attrs: norecurse nounwind readnone
66 define i64 @test_lleqsll_z(i64 %a) {
67 ; CHECK-LABEL: test_lleqsll_z:
68 ; CHECK: # %bb.0: # %entry
69 ; CHECK-NEXT: cntlzd r3, r3
70 ; CHECK-NEXT: rldicl r3, r3, 58, 63
72 ; CHECK-BE-LABEL: test_lleqsll_z:
73 ; CHECK-BE: # %bb.0: # %entry
74 ; CHECK-BE-NEXT: cntlzd r3, r3
75 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
78 ; CHECK-LE-LABEL: test_lleqsll_z:
79 ; CHECK-LE: # %bb.0: # %entry
80 ; CHECK-LE-NEXT: cntlzd r3, r3
81 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
84 %cmp = icmp eq i64 %a, 0
85 %conv1 = zext i1 %cmp to i64
89 ; Function Attrs: norecurse nounwind readnone
90 define i64 @test_lleqsll_sext_z(i64 %a) {
91 ; CHECK-LABEL: test_lleqsll_sext_z:
92 ; CHECK: # %bb.0: # %entry
93 ; CHECK-NEXT: addic r3, r3, -1
94 ; CHECK-NEXT: subfe r3, r3, r3
96 ; CHECK-BE-LABEL: test_lleqsll_sext_z:
97 ; CHECK-BE: # %bb.0: # %entry
98 ; CHECK-BE-NEXT: addic r3, r3, -1
99 ; CHECK-BE-NEXT: subfe r3, r3, r3
102 ; CHECK-LE-LABEL: test_lleqsll_sext_z:
103 ; CHECK-LE: # %bb.0: # %entry
104 ; CHECK-LE-NEXT: addic r3, r3, -1
105 ; CHECK-LE-NEXT: subfe r3, r3, r3
108 %cmp = icmp eq i64 %a, 0
109 %conv1 = sext i1 %cmp to i64
113 ; Function Attrs: norecurse nounwind
114 define dso_local void @test_lleqsll_store(i64 %a, i64 %b) {
115 ; CHECK-LABEL: test_lleqsll_store:
116 ; CHECK: # %bb.0: # %entry
117 ; CHECK-NEXT: xor r3, r3, r4
118 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
119 ; CHECK-NEXT: cntlzd r3, r3
120 ; CHECK-NEXT: rldicl r3, r3, 58, 63
121 ; CHECK-NEXT: std r3, glob@toc@l(r5)
123 ; CHECK-BE-LABEL: test_lleqsll_store:
124 ; CHECK-BE: # %bb.0: # %entry
125 ; CHECK-BE-NEXT: xor r3, r3, r4
126 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
127 ; CHECK-BE-NEXT: cntlzd r3, r3
128 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
129 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
132 ; CHECK-LE-LABEL: test_lleqsll_store:
133 ; CHECK-LE: # %bb.0: # %entry
134 ; CHECK-LE-NEXT: xor r3, r3, r4
135 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
136 ; CHECK-LE-NEXT: cntlzd r3, r3
137 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
138 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
141 %cmp = icmp eq i64 %a, %b
142 %conv1 = zext i1 %cmp to i64
143 store i64 %conv1, ptr @glob, align 8
147 ; Function Attrs: norecurse nounwind
148 define dso_local void @test_lleqsll_sext_store(i64 %a, i64 %b) {
149 ; CHECK-LABEL: test_lleqsll_sext_store:
150 ; CHECK: # %bb.0: # %entry
151 ; CHECK-NEXT: xor r3, r3, r4
152 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
153 ; CHECK-NEXT: addic r3, r3, -1
154 ; CHECK-NEXT: subfe r3, r3, r3
155 ; CHECK-NEXT: std r3, glob@toc@l(r5)
157 ; CHECK-BE-LABEL: test_lleqsll_sext_store:
158 ; CHECK-BE: # %bb.0: # %entry
159 ; CHECK-BE-NEXT: xor r3, r3, r4
160 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
161 ; CHECK-BE-NEXT: addic r3, r3, -1
162 ; CHECK-BE-NEXT: subfe r3, r3, r3
163 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
166 ; CHECK-LE-LABEL: test_lleqsll_sext_store:
167 ; CHECK-LE: # %bb.0: # %entry
168 ; CHECK-LE-NEXT: xor r3, r3, r4
169 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
170 ; CHECK-LE-NEXT: addic r3, r3, -1
171 ; CHECK-LE-NEXT: subfe r3, r3, r3
172 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
175 %cmp = icmp eq i64 %a, %b
176 %conv1 = sext i1 %cmp to i64
177 store i64 %conv1, ptr @glob, align 8
181 ; Function Attrs: norecurse nounwind
182 define dso_local void @test_lleqsll_z_store(i64 %a) {
183 ; CHECK-LABEL: test_lleqsll_z_store:
184 ; CHECK: # %bb.0: # %entry
185 ; CHECK-NEXT: cntlzd r3, r3
186 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
187 ; CHECK-NEXT: rldicl r3, r3, 58, 63
188 ; CHECK-NEXT: std r3, glob@toc@l(r4)
190 ; CHECK-BE-LABEL: test_lleqsll_z_store:
191 ; CHECK-BE: # %bb.0: # %entry
192 ; CHECK-BE-NEXT: cntlzd r3, r3
193 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
194 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
195 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
198 ; CHECK-LE-LABEL: test_lleqsll_z_store:
199 ; CHECK-LE: # %bb.0: # %entry
200 ; CHECK-LE-NEXT: cntlzd r3, r3
201 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
202 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
203 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
206 %cmp = icmp eq i64 %a, 0
207 %conv1 = zext i1 %cmp to i64
208 store i64 %conv1, ptr @glob, align 8
212 ; Function Attrs: norecurse nounwind
213 define dso_local void @test_lleqsll_sext_z_store(i64 %a) {
214 ; CHECK-LABEL: test_lleqsll_sext_z_store:
215 ; CHECK: # %bb.0: # %entry
216 ; CHECK-NEXT: addic r3, r3, -1
217 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
218 ; CHECK-NEXT: subfe r3, r3, r3
219 ; CHECK-NEXT: std r3, glob@toc@l(r4)
221 ; CHECK-BE-LABEL: test_lleqsll_sext_z_store:
222 ; CHECK-BE: # %bb.0: # %entry
223 ; CHECK-BE-NEXT: addic r3, r3, -1
224 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
225 ; CHECK-BE-NEXT: subfe r3, r3, r3
226 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
229 ; CHECK-LE-LABEL: test_lleqsll_sext_z_store:
230 ; CHECK-LE: # %bb.0: # %entry
231 ; CHECK-LE-NEXT: addic r3, r3, -1
232 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
233 ; CHECK-LE-NEXT: subfe r3, r3, r3
234 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
237 %cmp = icmp eq i64 %a, 0
238 %conv1 = sext i1 %cmp to i64
239 store i64 %conv1, ptr @glob, align 8