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 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 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: addis r5, r2, .LC0@toc@ha
126 ; CHECK-BE-NEXT: xor r3, r3, r4
127 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
128 ; CHECK-BE-NEXT: cntlzd r3, r3
129 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
130 ; CHECK-BE-NEXT: std r3, 0(r4)
133 ; CHECK-LE-LABEL: test_lleqsll_store:
134 ; CHECK-LE: # %bb.0: # %entry
135 ; CHECK-LE-NEXT: xor r3, r3, r4
136 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
137 ; CHECK-LE-NEXT: cntlzd r3, r3
138 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
139 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
142 %cmp = icmp eq i64 %a, %b
143 %conv1 = zext i1 %cmp to i64
144 store i64 %conv1, i64* @glob, align 8
148 ; Function Attrs: norecurse nounwind
149 define void @test_lleqsll_sext_store(i64 %a, i64 %b) {
150 ; CHECK-LABEL: test_lleqsll_sext_store:
151 ; CHECK: # %bb.0: # %entry
152 ; CHECK-NEXT: xor r3, r3, r4
153 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
154 ; CHECK-NEXT: addic r3, r3, -1
155 ; CHECK-NEXT: subfe r3, r3, r3
156 ; CHECK-NEXT: std r3, glob@toc@l(r5)
158 ; CHECK-BE-LABEL: test_lleqsll_sext_store:
159 ; CHECK-BE: # %bb.0: # %entry
160 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
161 ; CHECK-BE-NEXT: xor r3, r3, r4
162 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
163 ; CHECK-BE-NEXT: addic r3, r3, -1
164 ; CHECK-BE-NEXT: subfe r3, r3, r3
165 ; CHECK-BE-NEXT: std r3, 0(r4)
168 ; CHECK-LE-LABEL: test_lleqsll_sext_store:
169 ; CHECK-LE: # %bb.0: # %entry
170 ; CHECK-LE-NEXT: xor r3, r3, r4
171 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
172 ; CHECK-LE-NEXT: addic r3, r3, -1
173 ; CHECK-LE-NEXT: subfe r3, r3, r3
174 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
177 %cmp = icmp eq i64 %a, %b
178 %conv1 = sext i1 %cmp to i64
179 store i64 %conv1, i64* @glob, align 8
183 ; Function Attrs: norecurse nounwind
184 define void @test_lleqsll_z_store(i64 %a) {
185 ; CHECK-LABEL: test_lleqsll_z_store:
186 ; CHECK: # %bb.0: # %entry
187 ; CHECK-NEXT: cntlzd r3, r3
188 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
189 ; CHECK-NEXT: rldicl r3, r3, 58, 63
190 ; CHECK-NEXT: std r3, glob@toc@l(r4)
192 ; CHECK-BE-LABEL: test_lleqsll_z_store:
193 ; CHECK-BE: # %bb.0: # %entry
194 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
195 ; CHECK-BE-NEXT: cntlzd r3, r3
196 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
197 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
198 ; CHECK-BE-NEXT: std r3, 0(r4)
201 ; CHECK-LE-LABEL: test_lleqsll_z_store:
202 ; CHECK-LE: # %bb.0: # %entry
203 ; CHECK-LE-NEXT: cntlzd r3, r3
204 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
205 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
206 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
209 %cmp = icmp eq i64 %a, 0
210 %conv1 = zext i1 %cmp to i64
211 store i64 %conv1, i64* @glob, align 8
215 ; Function Attrs: norecurse nounwind
216 define void @test_lleqsll_sext_z_store(i64 %a) {
217 ; CHECK-LABEL: test_lleqsll_sext_z_store:
218 ; CHECK: # %bb.0: # %entry
219 ; CHECK-NEXT: addic r3, r3, -1
220 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
221 ; CHECK-NEXT: subfe r3, r3, r3
222 ; CHECK-NEXT: std r3, glob@toc@l(r4)
224 ; CHECK-BE-LABEL: test_lleqsll_sext_z_store:
225 ; CHECK-BE: # %bb.0: # %entry
226 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
227 ; CHECK-BE-NEXT: addic r3, r3, -1
228 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
229 ; CHECK-BE-NEXT: subfe r3, r3, r3
230 ; CHECK-BE-NEXT: std r3, 0(r4)
233 ; CHECK-LE-LABEL: test_lleqsll_sext_z_store:
234 ; CHECK-LE: # %bb.0: # %entry
235 ; CHECK-LE-NEXT: addic r3, r3, -1
236 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
237 ; CHECK-LE-NEXT: subfe r3, r3, r3
238 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
241 %cmp = icmp eq i64 %a, 0
242 %conv1 = sext i1 %cmp to i64
243 store i64 %conv1, i64* @glob, align 8