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 @glob = dso_local local_unnamed_addr global i64 0, align 8
10 ; Function Attrs: norecurse nounwind readnone
11 define i64 @test_lllesll(i64 %a, i64 %b) {
12 ; CHECK-LABEL: test_lllesll:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: sradi r5, r4, 63
15 ; CHECK-NEXT: rldicl r6, r3, 1, 63
16 ; CHECK-NEXT: subfc r3, r3, r4
17 ; CHECK-NEXT: adde r3, r5, r6
19 ; CHECK-BE-LABEL: test_lllesll:
20 ; CHECK-BE: # %bb.0: # %entry
21 ; CHECK-BE-NEXT: rldicl r5, r3, 1, 63
22 ; CHECK-BE-NEXT: sradi r6, r4, 63
23 ; CHECK-BE-NEXT: subc r3, r4, r3
24 ; CHECK-BE-NEXT: adde r3, r6, r5
27 ; CHECK-LE-LABEL: test_lllesll:
28 ; CHECK-LE: # %bb.0: # %entry
29 ; CHECK-LE-NEXT: rldicl r5, r3, 1, 63
30 ; CHECK-LE-NEXT: sradi r6, r4, 63
31 ; CHECK-LE-NEXT: subc r3, r4, r3
32 ; CHECK-LE-NEXT: adde r3, r6, r5
35 %cmp = icmp sle i64 %a, %b
36 %conv1 = zext i1 %cmp to i64
40 ; Function Attrs: norecurse nounwind readnone
41 define i64 @test_lllesll_sext(i64 %a, i64 %b) {
42 ; CHECK-LABEL: test_lllesll_sext:
43 ; CHECK: # %bb.0: # %entry
44 ; CHECK-NEXT: sradi r5, r4, 63
45 ; CHECK-NEXT: rldicl r6, r3, 1, 63
46 ; CHECK-NEXT: subfc r3, r3, r4
47 ; CHECK-NEXT: adde r3, r5, r6
48 ; CHECK-NEXT: neg r3, r3
50 ; CHECK-BE-LABEL: test_lllesll_sext:
51 ; CHECK-BE: # %bb.0: # %entry
52 ; CHECK-BE-NEXT: rldicl r5, r3, 1, 63
53 ; CHECK-BE-NEXT: sradi r6, r4, 63
54 ; CHECK-BE-NEXT: subc r3, r4, r3
55 ; CHECK-BE-NEXT: adde r3, r6, r5
56 ; CHECK-BE-NEXT: neg r3, r3
59 ; CHECK-LE-LABEL: test_lllesll_sext:
60 ; CHECK-LE: # %bb.0: # %entry
61 ; CHECK-LE-NEXT: rldicl r5, r3, 1, 63
62 ; CHECK-LE-NEXT: sradi r6, r4, 63
63 ; CHECK-LE-NEXT: subc r3, r4, r3
64 ; CHECK-LE-NEXT: adde r3, r6, r5
65 ; CHECK-LE-NEXT: neg r3, r3
68 %cmp = icmp sle i64 %a, %b
69 %conv1 = sext i1 %cmp to i64
73 ; Function Attrs: norecurse nounwind readnone
74 define i64 @test_lllesll_z(i64 %a) {
75 ; CHECK-LABEL: test_lllesll_z:
76 ; CHECK: # %bb.0: # %entry
77 ; CHECK-NEXT: addi r4, r3, -1
78 ; CHECK-NEXT: or r3, r4, r3
79 ; CHECK-NEXT: rldicl r3, r3, 1, 63
81 ; CHECK-BE-LABEL: test_lllesll_z:
82 ; CHECK-BE: # %bb.0: # %entry
83 ; CHECK-BE-NEXT: addi r4, r3, -1
84 ; CHECK-BE-NEXT: or r3, r4, r3
85 ; CHECK-BE-NEXT: rldicl r3, r3, 1, 63
88 ; CHECK-LE-LABEL: test_lllesll_z:
89 ; CHECK-LE: # %bb.0: # %entry
90 ; CHECK-LE-NEXT: addi r4, r3, -1
91 ; CHECK-LE-NEXT: or r3, r4, r3
92 ; CHECK-LE-NEXT: rldicl r3, r3, 1, 63
95 %cmp = icmp slt i64 %a, 1
96 %conv1 = zext i1 %cmp to i64
100 ; Function Attrs: norecurse nounwind readnone
101 define i64 @test_lllesll_sext_z(i64 %a) {
102 ; CHECK-LABEL: test_lllesll_sext_z:
103 ; CHECK: # %bb.0: # %entry
104 ; CHECK-NEXT: addi r4, r3, -1
105 ; CHECK-NEXT: or r3, r4, r3
106 ; CHECK-NEXT: sradi r3, r3, 63
108 ; CHECK-BE-LABEL: test_lllesll_sext_z:
109 ; CHECK-BE: # %bb.0: # %entry
110 ; CHECK-BE-NEXT: addi r4, r3, -1
111 ; CHECK-BE-NEXT: or r3, r4, r3
112 ; CHECK-BE-NEXT: sradi r3, r3, 63
115 ; CHECK-LE-LABEL: test_lllesll_sext_z:
116 ; CHECK-LE: # %bb.0: # %entry
117 ; CHECK-LE-NEXT: addi r4, r3, -1
118 ; CHECK-LE-NEXT: or r3, r4, r3
119 ; CHECK-LE-NEXT: sradi r3, r3, 63
122 %cmp = icmp slt i64 %a, 1
123 %conv1 = sext i1 %cmp to i64
127 ; Function Attrs: norecurse nounwind
128 define dso_local void @test_lllesll_store(i64 %a, i64 %b) {
129 ; CHECK-LABEL: test_lllesll_store:
130 ; CHECK: # %bb.0: # %entry
131 ; CHECK-NEXT: sradi r6, r4, 63
132 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
133 ; CHECK-NEXT: subfc r4, r3, r4
134 ; CHECK-NEXT: rldicl r3, r3, 1, 63
135 ; CHECK-NEXT: adde r3, r6, r3
136 ; CHECK-NEXT: std r3, glob@toc@l(r5)
138 ; CHECK-BE-LABEL: test_lllesll_store:
139 ; CHECK-BE: # %bb.0: # %entry
140 ; CHECK-BE-NEXT: rldicl r5, r3, 1, 63
141 ; CHECK-BE-NEXT: sradi r6, r4, 63
142 ; CHECK-BE-NEXT: subc r3, r4, r3
143 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
144 ; CHECK-BE-NEXT: adde r3, r6, r5
145 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
148 ; CHECK-LE-LABEL: test_lllesll_store:
149 ; CHECK-LE: # %bb.0: # %entry
150 ; CHECK-LE-NEXT: rldicl r5, r3, 1, 63
151 ; CHECK-LE-NEXT: sradi r6, r4, 63
152 ; CHECK-LE-NEXT: subc r3, r4, r3
153 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
154 ; CHECK-LE-NEXT: adde r3, r6, r5
155 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
158 %cmp = icmp sle i64 %a, %b
159 %conv1 = zext i1 %cmp to i64
160 store i64 %conv1, ptr @glob, align 8
164 ; Function Attrs: norecurse nounwind
165 define dso_local void @test_lllesll_sext_store(i64 %a, i64 %b) {
166 ; CHECK-LABEL: test_lllesll_sext_store:
167 ; CHECK: # %bb.0: # %entry
168 ; CHECK-NEXT: sradi r6, r4, 63
169 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
170 ; CHECK-NEXT: subfc r4, r3, r4
171 ; CHECK-NEXT: rldicl r3, r3, 1, 63
172 ; CHECK-NEXT: adde r3, r6, r3
173 ; CHECK-NEXT: neg r3, r3
174 ; CHECK-NEXT: std r3, glob@toc@l(r5)
176 ; CHECK-BE-LABEL: test_lllesll_sext_store:
177 ; CHECK-BE: # %bb.0: # %entry
178 ; CHECK-BE-NEXT: rldicl r5, r3, 1, 63
179 ; CHECK-BE-NEXT: sradi r6, r4, 63
180 ; CHECK-BE-NEXT: subc r3, r4, r3
181 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
182 ; CHECK-BE-NEXT: adde r3, r6, r5
183 ; CHECK-BE-NEXT: neg r3, r3
184 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
187 ; CHECK-LE-LABEL: test_lllesll_sext_store:
188 ; CHECK-LE: # %bb.0: # %entry
189 ; CHECK-LE-NEXT: rldicl r5, r3, 1, 63
190 ; CHECK-LE-NEXT: sradi r6, r4, 63
191 ; CHECK-LE-NEXT: subc r3, r4, r3
192 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
193 ; CHECK-LE-NEXT: adde r3, r6, r5
194 ; CHECK-LE-NEXT: neg r3, r3
195 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
198 %cmp = icmp sle i64 %a, %b
199 %conv1 = sext i1 %cmp to i64
200 store i64 %conv1, ptr @glob, align 8
204 ; Function Attrs: norecurse nounwind
205 define dso_local void @test_lllesll_z_store(i64 %a) {
206 ; CHECK-LABEL: test_lllesll_z_store:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: addi r5, r3, -1
209 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
210 ; CHECK-NEXT: or r3, r5, r3
211 ; CHECK-NEXT: rldicl r3, r3, 1, 63
212 ; CHECK-NEXT: std r3, glob@toc@l(r4)
214 ; CHECK-BE-LABEL: test_lllesll_z_store:
215 ; CHECK-BE: # %bb.0: # %entry
216 ; CHECK-BE-NEXT: addi r4, r3, -1
217 ; CHECK-BE-NEXT: or r3, r4, r3
218 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
219 ; CHECK-BE-NEXT: rldicl r3, r3, 1, 63
220 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
223 ; CHECK-LE-LABEL: test_lllesll_z_store:
224 ; CHECK-LE: # %bb.0: # %entry
225 ; CHECK-LE-NEXT: addi r4, r3, -1
226 ; CHECK-LE-NEXT: or r3, r4, r3
227 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
228 ; CHECK-LE-NEXT: rldicl r3, r3, 1, 63
229 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
232 %cmp = icmp slt i64 %a, 1
233 %conv1 = zext i1 %cmp to i64
234 store i64 %conv1, ptr @glob, align 8
238 ; Function Attrs: norecurse nounwind
239 define dso_local void @test_lllesll_sext_z_store(i64 %a) {
240 ; CHECK-LABEL: test_lllesll_sext_z_store:
241 ; CHECK: # %bb.0: # %entry
242 ; CHECK-NEXT: addi r5, r3, -1
243 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
244 ; CHECK-NEXT: or r3, r5, r3
245 ; CHECK-NEXT: sradi r3, r3, 63
246 ; CHECK-NEXT: std r3, glob@toc@l(r4)
248 ; CHECK-BE-LABEL: test_lllesll_sext_z_store:
249 ; CHECK-BE: # %bb.0: # %entry
250 ; CHECK-BE-NEXT: addi r4, r3, -1
251 ; CHECK-BE-NEXT: or r3, r4, r3
252 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
253 ; CHECK-BE-NEXT: sradi r3, r3, 63
254 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
257 ; CHECK-LE-LABEL: test_lllesll_sext_z_store:
258 ; CHECK-LE: # %bb.0: # %entry
259 ; CHECK-LE-NEXT: addi r4, r3, -1
260 ; CHECK-LE-NEXT: or r3, r4, r3
261 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
262 ; CHECK-LE-NEXT: sradi r3, r3, 63
263 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
266 %cmp = icmp slt i64 %a, 1
267 %conv1 = sext i1 %cmp to i64
268 store i64 %conv1, ptr @glob, align 8