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 ; ModuleID = 'ComparisonTestCases/testComparesieqsll.c'
10 @glob = dso_local local_unnamed_addr global i64 0, align 8
12 ; Function Attrs: norecurse nounwind readnone
13 define dso_local signext i32 @test_ieqsll(i64 %a, i64 %b) {
14 ; CHECK-LABEL: test_ieqsll:
15 ; CHECK: # %bb.0: # %entry
16 ; CHECK-NEXT: xor r3, r3, r4
17 ; CHECK-NEXT: cntlzd r3, r3
18 ; CHECK-NEXT: rldicl r3, r3, 58, 63
20 ; CHECK-BE-LABEL: test_ieqsll:
21 ; CHECK-BE: # %bb.0: # %entry
22 ; CHECK-BE-NEXT: xor r3, r3, r4
23 ; CHECK-BE-NEXT: cntlzd r3, r3
24 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
27 ; CHECK-LE-LABEL: test_ieqsll:
28 ; CHECK-LE: # %bb.0: # %entry
29 ; CHECK-LE-NEXT: xor r3, r3, r4
30 ; CHECK-LE-NEXT: cntlzd r3, r3
31 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
34 %cmp = icmp eq i64 %a, %b
35 %conv = zext i1 %cmp to i32
39 ; Function Attrs: norecurse nounwind readnone
40 define dso_local signext i32 @test_ieqsll_sext(i64 %a, i64 %b) {
41 ; CHECK-LABEL: test_ieqsll_sext:
42 ; CHECK: # %bb.0: # %entry
43 ; CHECK-NEXT: xor r3, r3, r4
44 ; CHECK-NEXT: addic r3, r3, -1
45 ; CHECK-NEXT: subfe r3, r3, r3
47 ; CHECK-BE-LABEL: test_ieqsll_sext:
48 ; CHECK-BE: # %bb.0: # %entry
49 ; CHECK-BE-NEXT: xor r3, r3, r4
50 ; CHECK-BE-NEXT: addic r3, r3, -1
51 ; CHECK-BE-NEXT: subfe r3, r3, r3
54 ; CHECK-LE-LABEL: test_ieqsll_sext:
55 ; CHECK-LE: # %bb.0: # %entry
56 ; CHECK-LE-NEXT: xor r3, r3, r4
57 ; CHECK-LE-NEXT: addic r3, r3, -1
58 ; CHECK-LE-NEXT: subfe r3, r3, r3
61 %cmp = icmp eq i64 %a, %b
62 %sub = sext i1 %cmp to i32
66 ; Function Attrs: norecurse nounwind readnone
67 define dso_local signext i32 @test_ieqsll_z(i64 %a) {
68 ; CHECK-LABEL: test_ieqsll_z:
69 ; CHECK: # %bb.0: # %entry
70 ; CHECK-NEXT: cntlzd r3, r3
71 ; CHECK-NEXT: rldicl r3, r3, 58, 63
73 ; CHECK-BE-LABEL: test_ieqsll_z:
74 ; CHECK-BE: # %bb.0: # %entry
75 ; CHECK-BE-NEXT: cntlzd r3, r3
76 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
79 ; CHECK-LE-LABEL: test_ieqsll_z:
80 ; CHECK-LE: # %bb.0: # %entry
81 ; CHECK-LE-NEXT: cntlzd r3, r3
82 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
85 %cmp = icmp eq i64 %a, 0
86 %conv = zext i1 %cmp to i32
90 ; Function Attrs: norecurse nounwind readnone
91 define dso_local signext i32 @test_ieqsll_sext_z(i64 %a) {
92 ; CHECK-LABEL: test_ieqsll_sext_z:
93 ; CHECK: # %bb.0: # %entry
94 ; CHECK-NEXT: addic r3, r3, -1
95 ; CHECK-NEXT: subfe r3, r3, r3
97 ; CHECK-BE-LABEL: test_ieqsll_sext_z:
98 ; CHECK-BE: # %bb.0: # %entry
99 ; CHECK-BE-NEXT: addic r3, r3, -1
100 ; CHECK-BE-NEXT: subfe r3, r3, r3
103 ; CHECK-LE-LABEL: test_ieqsll_sext_z:
104 ; CHECK-LE: # %bb.0: # %entry
105 ; CHECK-LE-NEXT: addic r3, r3, -1
106 ; CHECK-LE-NEXT: subfe r3, r3, r3
109 %cmp = icmp eq i64 %a, 0
110 %sub = sext i1 %cmp to i32
114 ; Function Attrs: norecurse nounwind
115 define dso_local void @test_ieqsll_store(i64 %a, i64 %b) {
116 ; CHECK-LABEL: test_ieqsll_store:
117 ; CHECK: # %bb.0: # %entry
118 ; CHECK-NEXT: xor r3, r3, r4
119 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
120 ; CHECK-NEXT: cntlzd r3, r3
121 ; CHECK-NEXT: rldicl r3, r3, 58, 63
122 ; CHECK-NEXT: std r3, glob@toc@l(r5)
124 ; CHECK-BE-LABEL: test_ieqsll_store:
125 ; CHECK-BE: # %bb.0: # %entry
126 ; CHECK-BE-NEXT: xor r3, r3, r4
127 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
128 ; CHECK-BE-NEXT: cntlzd r3, r3
129 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
130 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
133 ; CHECK-LE-LABEL: test_ieqsll_store:
134 ; CHECK-LE: # %bb.0: # %entry
135 ; CHECK-LE-NEXT: xor r3, r3, r4
136 ; CHECK-LE-NEXT: addis r4, 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(r4)
142 %cmp = icmp eq i64 %a, %b
143 %conv1 = zext i1 %cmp to i64
144 store i64 %conv1, ptr @glob, align 8
148 ; Function Attrs: norecurse nounwind
149 define dso_local void @test_ieqsll_sext_store(i64 %a, i64 %b) {
150 ; CHECK-LABEL: test_ieqsll_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_ieqsll_sext_store:
159 ; CHECK-BE: # %bb.0: # %entry
160 ; CHECK-BE-NEXT: xor r3, r3, r4
161 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
162 ; CHECK-BE-NEXT: addic r3, r3, -1
163 ; CHECK-BE-NEXT: subfe r3, r3, r3
164 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
167 ; CHECK-LE-LABEL: test_ieqsll_sext_store:
168 ; CHECK-LE: # %bb.0: # %entry
169 ; CHECK-LE-NEXT: xor r3, r3, r4
170 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
171 ; CHECK-LE-NEXT: addic r3, r3, -1
172 ; CHECK-LE-NEXT: subfe r3, r3, r3
173 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
176 %cmp = icmp eq i64 %a, %b
177 %conv1 = sext i1 %cmp to i64
178 store i64 %conv1, ptr @glob, align 8
182 ; Function Attrs: norecurse nounwind
183 define dso_local void @test_ieqsll_z_store(i64 %a) {
184 ; CHECK-LABEL: test_ieqsll_z_store:
185 ; CHECK: # %bb.0: # %entry
186 ; CHECK-NEXT: cntlzd r3, r3
187 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
188 ; CHECK-NEXT: rldicl r3, r3, 58, 63
189 ; CHECK-NEXT: std r3, glob@toc@l(r4)
191 ; CHECK-BE-LABEL: test_ieqsll_z_store:
192 ; CHECK-BE: # %bb.0: # %entry
193 ; CHECK-BE-NEXT: cntlzd r3, r3
194 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
195 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
196 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
199 ; CHECK-LE-LABEL: test_ieqsll_z_store:
200 ; CHECK-LE: # %bb.0: # %entry
201 ; CHECK-LE-NEXT: cntlzd r3, r3
202 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
203 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
204 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
207 %cmp = icmp eq i64 %a, 0
208 %conv1 = zext i1 %cmp to i64
209 store i64 %conv1, ptr @glob, align 8
213 ; Function Attrs: norecurse nounwind
214 define dso_local void @test_ieqsll_sext_z_store(i64 %a) {
215 ; CHECK-LABEL: test_ieqsll_sext_z_store:
216 ; CHECK: # %bb.0: # %entry
217 ; CHECK-NEXT: addic r3, r3, -1
218 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
219 ; CHECK-NEXT: subfe r3, r3, r3
220 ; CHECK-NEXT: std r3, glob@toc@l(r4)
222 ; CHECK-BE-LABEL: test_ieqsll_sext_z_store:
223 ; CHECK-BE: # %bb.0: # %entry
224 ; CHECK-BE-NEXT: addic r3, r3, -1
225 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
226 ; CHECK-BE-NEXT: subfe r3, r3, r3
227 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
230 ; CHECK-LE-LABEL: test_ieqsll_sext_z_store:
231 ; CHECK-LE: # %bb.0: # %entry
232 ; CHECK-LE-NEXT: addic r3, r3, -1
233 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
234 ; CHECK-LE-NEXT: subfe r3, r3, r3
235 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
238 %cmp = icmp eq i64 %a, 0
239 %conv1 = sext i1 %cmp to i64
240 store i64 %conv1, ptr @glob, align 8