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 define i64 @test_llgesll(i64 %a, i64 %b) {
11 ; CHECK-LABEL: test_llgesll:
12 ; CHECK: # %bb.0: # %entry
13 ; CHECK-NEXT: sradi r5, r3, 63
14 ; CHECK-NEXT: rldicl r6, r4, 1, 63
15 ; CHECK-NEXT: subfc r3, r4, r3
16 ; CHECK-NEXT: adde r3, r5, r6
18 ; CHECK-BE-LABEL: test_llgesll:
19 ; CHECK-BE: # %bb.0: # %entry
20 ; CHECK-BE-NEXT: sradi r5, r3, 63
21 ; CHECK-BE-NEXT: rldicl r6, r4, 1, 63
22 ; CHECK-BE-NEXT: subc r3, r3, r4
23 ; CHECK-BE-NEXT: adde r3, r5, r6
26 ; CHECK-LE-LABEL: test_llgesll:
27 ; CHECK-LE: # %bb.0: # %entry
28 ; CHECK-LE-NEXT: sradi r5, r3, 63
29 ; CHECK-LE-NEXT: rldicl r6, r4, 1, 63
30 ; CHECK-LE-NEXT: subc r3, r3, r4
31 ; CHECK-LE-NEXT: adde r3, r5, r6
34 %cmp = icmp sge i64 %a, %b
35 %conv1 = zext i1 %cmp to i64
39 define i64 @test_llgesll_sext(i64 %a, i64 %b) {
40 ; CHECK-LABEL: test_llgesll_sext:
41 ; CHECK: # %bb.0: # %entry
42 ; CHECK-NEXT: sradi r5, r3, 63
43 ; CHECK-NEXT: rldicl r6, r4, 1, 63
44 ; CHECK-NEXT: subfc r3, r4, r3
45 ; CHECK-NEXT: adde r3, r5, r6
46 ; CHECK-NEXT: neg r3, r3
48 ; CHECK-BE-LABEL: test_llgesll_sext:
49 ; CHECK-BE: # %bb.0: # %entry
50 ; CHECK-BE-NEXT: sradi r5, r3, 63
51 ; CHECK-BE-NEXT: rldicl r6, r4, 1, 63
52 ; CHECK-BE-NEXT: subc r3, r3, r4
53 ; CHECK-BE-NEXT: adde r3, r5, r6
54 ; CHECK-BE-NEXT: neg r3, r3
57 ; CHECK-LE-LABEL: test_llgesll_sext:
58 ; CHECK-LE: # %bb.0: # %entry
59 ; CHECK-LE-NEXT: sradi r5, r3, 63
60 ; CHECK-LE-NEXT: rldicl r6, r4, 1, 63
61 ; CHECK-LE-NEXT: subc r3, r3, r4
62 ; CHECK-LE-NEXT: adde r3, r5, r6
63 ; CHECK-LE-NEXT: neg r3, r3
66 %cmp = icmp sge i64 %a, %b
67 %conv1 = sext i1 %cmp to i64
71 define i64 @test_llgesll_z(i64 %a) {
72 ; CHECK-LABEL: test_llgesll_z:
73 ; CHECK: # %bb.0: # %entry
74 ; CHECK-NEXT: not r3, r3
75 ; CHECK-NEXT: rldicl r3, r3, 1, 63
77 ; CHECK-BE-LABEL: test_llgesll_z:
78 ; CHECK-BE: # %bb.0: # %entry
79 ; CHECK-BE-NEXT: not r3, r3
80 ; CHECK-BE-NEXT: rldicl r3, r3, 1, 63
83 ; CHECK-LE-LABEL: test_llgesll_z:
84 ; CHECK-LE: # %bb.0: # %entry
85 ; CHECK-LE-NEXT: not r3, r3
86 ; CHECK-LE-NEXT: rldicl r3, r3, 1, 63
89 %cmp = icmp sgt i64 %a, -1
90 %conv1 = zext i1 %cmp to i64
94 define i64 @test_llgesll_sext_z(i64 %a) {
95 ; CHECK-LABEL: test_llgesll_sext_z:
96 ; CHECK: # %bb.0: # %entry
97 ; CHECK-NEXT: not r3, r3
98 ; CHECK-NEXT: sradi r3, r3, 63
100 ; CHECK-BE-LABEL: test_llgesll_sext_z:
101 ; CHECK-BE: # %bb.0: # %entry
102 ; CHECK-BE-NEXT: not r3, r3
103 ; CHECK-BE-NEXT: sradi r3, r3, 63
106 ; CHECK-LE-LABEL: test_llgesll_sext_z:
107 ; CHECK-LE: # %bb.0: # %entry
108 ; CHECK-LE-NEXT: not r3, r3
109 ; CHECK-LE-NEXT: sradi r3, r3, 63
112 %cmp = icmp sgt i64 %a, -1
113 %conv1 = sext i1 %cmp to i64
117 define dso_local void @test_llgesll_store(i64 %a, i64 %b) {
118 ; CHECK-LABEL: test_llgesll_store:
119 ; CHECK: # %bb.0: # %entry
120 ; CHECK-NEXT: sradi r6, r3, 63
121 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
122 ; CHECK-NEXT: subfc r3, r4, r3
123 ; CHECK-NEXT: rldicl r3, r4, 1, 63
124 ; CHECK-NEXT: adde r3, r6, r3
125 ; CHECK-NEXT: std r3, glob@toc@l(r5)
127 ; CHECK-BE-LABEL: test_llgesll_store:
128 ; CHECK-BE: # %bb.0: # %entry
129 ; CHECK-BE-NEXT: sradi r6, r3, 63
130 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
131 ; CHECK-BE-NEXT: subc r3, r3, r4
132 ; CHECK-BE-NEXT: rldicl r3, r4, 1, 63
133 ; CHECK-BE-NEXT: adde r3, r6, r3
134 ; CHECK-BE-NEXT: std r3, glob@toc@l(r5)
137 ; CHECK-LE-LABEL: test_llgesll_store:
138 ; CHECK-LE: # %bb.0: # %entry
139 ; CHECK-LE-NEXT: sradi r6, r3, 63
140 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
141 ; CHECK-LE-NEXT: subc r3, r3, r4
142 ; CHECK-LE-NEXT: rldicl r3, r4, 1, 63
143 ; CHECK-LE-NEXT: adde r3, r6, r3
144 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
147 %cmp = icmp sge i64 %a, %b
148 %conv1 = zext i1 %cmp to i64
149 store i64 %conv1, ptr @glob, align 8
153 define dso_local void @test_llgesll_sext_store(i64 %a, i64 %b) {
154 ; CHECK-LABEL: test_llgesll_sext_store:
155 ; CHECK: # %bb.0: # %entry
156 ; CHECK-NEXT: sradi r6, r3, 63
157 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
158 ; CHECK-NEXT: subfc r3, r4, r3
159 ; CHECK-NEXT: rldicl r3, r4, 1, 63
160 ; CHECK-NEXT: adde r3, r6, r3
161 ; CHECK-NEXT: neg r3, r3
162 ; CHECK-NEXT: std r3, glob@toc@l(r5)
164 ; CHECK-BE-LABEL: test_llgesll_sext_store:
165 ; CHECK-BE: # %bb.0: # %entry
166 ; CHECK-BE-NEXT: sradi r6, r3, 63
167 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
168 ; CHECK-BE-NEXT: subc r3, r3, r4
169 ; CHECK-BE-NEXT: rldicl r3, r4, 1, 63
170 ; CHECK-BE-NEXT: adde r3, r6, r3
171 ; CHECK-BE-NEXT: neg r3, r3
172 ; CHECK-BE-NEXT: std r3, glob@toc@l(r5)
175 ; CHECK-LE-LABEL: test_llgesll_sext_store:
176 ; CHECK-LE: # %bb.0: # %entry
177 ; CHECK-LE-NEXT: sradi r6, r3, 63
178 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
179 ; CHECK-LE-NEXT: subc r3, r3, r4
180 ; CHECK-LE-NEXT: rldicl r3, r4, 1, 63
181 ; CHECK-LE-NEXT: adde r3, r6, r3
182 ; CHECK-LE-NEXT: neg r3, r3
183 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
186 %cmp = icmp sge i64 %a, %b
187 %conv1 = sext i1 %cmp to i64
188 store i64 %conv1, ptr @glob, align 8
192 define dso_local void @test_llgesll_z_store(i64 %a) {
193 ; CHECK-LABEL: test_llgesll_z_store:
194 ; CHECK: # %bb.0: # %entry
195 ; CHECK-NEXT: not r3, r3
196 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
197 ; CHECK-NEXT: rldicl r3, r3, 1, 63
198 ; CHECK-NEXT: std r3, glob@toc@l(r4)
200 ; CHECK-BE-LABEL: test_llgesll_z_store:
201 ; CHECK-BE: # %bb.0: # %entry
202 ; CHECK-BE-NEXT: not r3, r3
203 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
204 ; CHECK-BE-NEXT: rldicl r3, r3, 1, 63
205 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
208 ; CHECK-LE-LABEL: test_llgesll_z_store:
209 ; CHECK-LE: # %bb.0: # %entry
210 ; CHECK-LE-NEXT: not r3, r3
211 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
212 ; CHECK-LE-NEXT: rldicl r3, r3, 1, 63
213 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
216 %cmp = icmp sgt i64 %a, -1
217 %conv1 = zext i1 %cmp to i64
218 store i64 %conv1, ptr @glob, align 8
222 define dso_local void @test_llgesll_sext_z_store(i64 %a) {
223 ; CHECK-LABEL: test_llgesll_sext_z_store:
224 ; CHECK: # %bb.0: # %entry
225 ; CHECK-NEXT: not r3, r3
226 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
227 ; CHECK-NEXT: sradi r3, r3, 63
228 ; CHECK-NEXT: std r3, glob@toc@l(r4)
230 ; CHECK-BE-LABEL: test_llgesll_sext_z_store:
231 ; CHECK-BE: # %bb.0: # %entry
232 ; CHECK-BE-NEXT: not r3, r3
233 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
234 ; CHECK-BE-NEXT: sradi r3, r3, 63
235 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
238 ; CHECK-LE-LABEL: test_llgesll_sext_z_store:
239 ; CHECK-LE: # %bb.0: # %entry
240 ; CHECK-LE-NEXT: not r3, r3
241 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
242 ; CHECK-LE-NEXT: sradi r3, r3, 63
243 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
246 %cmp = icmp sgt i64 %a, -1
247 %conv1 = sext i1 %cmp to i64
248 store i64 %conv1, ptr @glob, align 8