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/testComparesiequll.c'
10 @glob = common local_unnamed_addr global i64 0, align 8
12 ; Function Attrs: norecurse nounwind readnone
13 define signext i32 @test_iequll(i64 %a, i64 %b) {
14 ; CHECK-LABEL: test_iequll:
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_iequll:
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_iequll:
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 signext i32 @test_iequll_sext(i64 %a, i64 %b) {
41 ; CHECK-LABEL: test_iequll_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_iequll_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_iequll_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 signext i32 @test_iequll_z(i64 %a) {
68 ; CHECK-LABEL: test_iequll_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_iequll_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_iequll_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 signext i32 @test_iequll_sext_z(i64 %a) {
92 ; CHECK-LABEL: test_iequll_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_iequll_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_iequll_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 void @test_iequll_store(i64 %a, i64 %b) {
116 ; CHECK-LABEL: test_iequll_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_iequll_store:
125 ; CHECK-BE: # %bb.0: # %entry
126 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
127 ; CHECK-BE-NEXT: xor r3, r3, r4
128 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
129 ; CHECK-BE-NEXT: cntlzd r3, r3
130 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
131 ; CHECK-BE-NEXT: std r3, 0(r4)
134 ; CHECK-LE-LABEL: test_iequll_store:
135 ; CHECK-LE: # %bb.0: # %entry
136 ; CHECK-LE-NEXT: xor r3, r3, r4
137 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
138 ; CHECK-LE-NEXT: cntlzd r3, r3
139 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
140 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
143 %cmp = icmp eq i64 %a, %b
144 %conv1 = zext i1 %cmp to i64
145 store i64 %conv1, i64* @glob, align 8
149 ; Function Attrs: norecurse nounwind
150 define void @test_iequll_sext_store(i64 %a, i64 %b) {
151 ; CHECK-LABEL: test_iequll_sext_store:
152 ; CHECK: # %bb.0: # %entry
153 ; CHECK-NEXT: xor r3, r3, r4
154 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
155 ; CHECK-NEXT: addic r3, r3, -1
156 ; CHECK-NEXT: subfe r3, r3, r3
157 ; CHECK-NEXT: std r3, glob@toc@l(r5)
159 ; CHECK-BE-LABEL: test_iequll_sext_store:
160 ; CHECK-BE: # %bb.0: # %entry
161 ; CHECK-BE-NEXT: addis r5, r2, .LC0@toc@ha
162 ; CHECK-BE-NEXT: xor r3, r3, r4
163 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r5)
164 ; CHECK-BE-NEXT: addic r3, r3, -1
165 ; CHECK-BE-NEXT: subfe r3, r3, r3
166 ; CHECK-BE-NEXT: std r3, 0(r4)
169 ; CHECK-LE-LABEL: test_iequll_sext_store:
170 ; CHECK-LE: # %bb.0: # %entry
171 ; CHECK-LE-NEXT: xor r3, r3, r4
172 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
173 ; CHECK-LE-NEXT: addic r3, r3, -1
174 ; CHECK-LE-NEXT: subfe r3, r3, r3
175 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
178 %cmp = icmp eq i64 %a, %b
179 %conv1 = sext i1 %cmp to i64
180 store i64 %conv1, i64* @glob, align 8
184 ; Function Attrs: norecurse nounwind
185 define void @test_iequll_z_store(i64 %a) {
186 ; CHECK-LABEL: test_iequll_z_store:
187 ; CHECK: # %bb.0: # %entry
188 ; CHECK-NEXT: cntlzd r3, r3
189 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
190 ; CHECK-NEXT: rldicl r3, r3, 58, 63
191 ; CHECK-NEXT: std r3, glob@toc@l(r4)
193 ; CHECK-BE-LABEL: test_iequll_z_store:
194 ; CHECK-BE: # %bb.0: # %entry
195 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
196 ; CHECK-BE-NEXT: cntlzd r3, r3
197 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
198 ; CHECK-BE-NEXT: rldicl r3, r3, 58, 63
199 ; CHECK-BE-NEXT: std r3, 0(r4)
202 ; CHECK-LE-LABEL: test_iequll_z_store:
203 ; CHECK-LE: # %bb.0: # %entry
204 ; CHECK-LE-NEXT: cntlzd r3, r3
205 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
206 ; CHECK-LE-NEXT: rldicl r3, r3, 58, 63
207 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
210 %cmp = icmp eq i64 %a, 0
211 %conv1 = zext i1 %cmp to i64
212 store i64 %conv1, i64* @glob, align 8
216 ; Function Attrs: norecurse nounwind
217 define void @test_iequll_sext_z_store(i64 %a) {
218 ; CHECK-LABEL: test_iequll_sext_z_store:
219 ; CHECK: # %bb.0: # %entry
220 ; CHECK-NEXT: addic r3, r3, -1
221 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
222 ; CHECK-NEXT: subfe r3, r3, r3
223 ; CHECK-NEXT: std r3, glob@toc@l(r4)
225 ; CHECK-BE-LABEL: test_iequll_sext_z_store:
226 ; CHECK-BE: # %bb.0: # %entry
227 ; CHECK-BE-NEXT: addis r4, r2, .LC0@toc@ha
228 ; CHECK-BE-NEXT: addic r3, r3, -1
229 ; CHECK-BE-NEXT: ld r4, .LC0@toc@l(r4)
230 ; CHECK-BE-NEXT: subfe r3, r3, r3
231 ; CHECK-BE-NEXT: std r3, 0(r4)
234 ; CHECK-LE-LABEL: test_iequll_sext_z_store:
235 ; CHECK-LE: # %bb.0: # %entry
236 ; CHECK-LE-NEXT: addic r3, r3, -1
237 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
238 ; CHECK-LE-NEXT: subfe r3, r3, r3
239 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
242 %cmp = icmp eq i64 %a, 0
243 %conv1 = sext i1 %cmp to i64
244 store i64 %conv1, i64* @glob, align 8