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 = dso_local local_unnamed_addr global i64 0, align 8
11 define i64 @test_llneull(i64 %a, i64 %b) {
12 ; CHECK-LABEL: test_llneull:
13 ; CHECK: # %bb.0: # %entry
14 ; CHECK-NEXT: xor r3, r3, r4
15 ; CHECK-NEXT: addic r4, r3, -1
16 ; CHECK-NEXT: subfe r3, r4, r3
18 ; CHECK-BE-LABEL: test_llneull:
19 ; CHECK-BE: # %bb.0: # %entry
20 ; CHECK-BE-NEXT: xor r3, r3, r4
21 ; CHECK-BE-NEXT: addic r4, r3, -1
22 ; CHECK-BE-NEXT: subfe r3, r4, r3
25 ; CHECK-LE-LABEL: test_llneull:
26 ; CHECK-LE: # %bb.0: # %entry
27 ; CHECK-LE-NEXT: xor r3, r3, r4
28 ; CHECK-LE-NEXT: addic r4, r3, -1
29 ; CHECK-LE-NEXT: subfe r3, r4, r3
32 %cmp = icmp ne i64 %a, %b
33 %conv1 = zext i1 %cmp to i64
37 define i64 @test_llneull_sext(i64 %a, i64 %b) {
38 ; CHECK-LABEL: test_llneull_sext:
39 ; CHECK: # %bb.0: # %entry
40 ; CHECK-NEXT: xor r3, r3, r4
41 ; CHECK-NEXT: subfic r3, r3, 0
42 ; CHECK-NEXT: subfe r3, r3, r3
44 ; CHECK-BE-LABEL: test_llneull_sext:
45 ; CHECK-BE: # %bb.0: # %entry
46 ; CHECK-BE-NEXT: xor r3, r3, r4
47 ; CHECK-BE-NEXT: subfic r3, r3, 0
48 ; CHECK-BE-NEXT: subfe r3, r3, r3
51 ; CHECK-LE-LABEL: test_llneull_sext:
52 ; CHECK-LE: # %bb.0: # %entry
53 ; CHECK-LE-NEXT: xor r3, r3, r4
54 ; CHECK-LE-NEXT: subfic r3, r3, 0
55 ; CHECK-LE-NEXT: subfe r3, r3, r3
58 %cmp = icmp ne i64 %a, %b
59 %conv1 = sext i1 %cmp to i64
63 define i64 @test_llneull_z(i64 %a) {
64 ; CHECK-LABEL: test_llneull_z:
65 ; CHECK: # %bb.0: # %entry
66 ; CHECK-NEXT: addic r4, r3, -1
67 ; CHECK-NEXT: subfe r3, r4, r3
69 ; CHECK-BE-LABEL: test_llneull_z:
70 ; CHECK-BE: # %bb.0: # %entry
71 ; CHECK-BE-NEXT: addic r4, r3, -1
72 ; CHECK-BE-NEXT: subfe r3, r4, r3
75 ; CHECK-LE-LABEL: test_llneull_z:
76 ; CHECK-LE: # %bb.0: # %entry
77 ; CHECK-LE-NEXT: addic r4, r3, -1
78 ; CHECK-LE-NEXT: subfe r3, r4, r3
81 %cmp = icmp ne i64 %a, 0
82 %conv1 = zext i1 %cmp to i64
86 define i64 @test_llneull_sext_z(i64 %a) {
87 ; CHECK-LABEL: test_llneull_sext_z:
88 ; CHECK: # %bb.0: # %entry
89 ; CHECK-NEXT: subfic r3, r3, 0
90 ; CHECK-NEXT: subfe r3, r3, r3
92 ; CHECK-BE-LABEL: test_llneull_sext_z:
93 ; CHECK-BE: # %bb.0: # %entry
94 ; CHECK-BE-NEXT: subfic r3, r3, 0
95 ; CHECK-BE-NEXT: subfe r3, r3, r3
98 ; CHECK-LE-LABEL: test_llneull_sext_z:
99 ; CHECK-LE: # %bb.0: # %entry
100 ; CHECK-LE-NEXT: subfic r3, r3, 0
101 ; CHECK-LE-NEXT: subfe r3, r3, r3
104 %cmp = icmp ne i64 %a, 0
105 %conv1 = sext i1 %cmp to i64
109 define dso_local void @test_llneull_store(i64 %a, i64 %b) {
110 ; CHECK-LABEL: test_llneull_store:
111 ; CHECK: # %bb.0: # %entry
112 ; CHECK-NEXT: xor r3, r3, r4
113 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
114 ; CHECK-NEXT: addic r4, r3, -1
115 ; CHECK-NEXT: subfe r3, r4, r3
116 ; CHECK-NEXT: std r3, glob@toc@l(r5)
118 ; CHECK-BE-LABEL: test_llneull_store:
119 ; CHECK-BE: # %bb.0: # %entry
120 ; CHECK-BE-NEXT: xor r3, r3, r4
121 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
122 ; CHECK-BE-NEXT: addic r4, r3, -1
123 ; CHECK-BE-NEXT: subfe r3, r4, r3
124 ; CHECK-BE-NEXT: std r3, glob@toc@l(r5)
127 ; CHECK-LE-LABEL: test_llneull_store:
128 ; CHECK-LE: # %bb.0: # %entry
129 ; CHECK-LE-NEXT: xor r3, r3, r4
130 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
131 ; CHECK-LE-NEXT: addic r4, r3, -1
132 ; CHECK-LE-NEXT: subfe r3, r4, r3
133 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
136 %cmp = icmp ne i64 %a, %b
137 %conv1 = zext i1 %cmp to i64
138 store i64 %conv1, ptr @glob, align 8
142 define dso_local void @test_llneull_sext_store(i64 %a, i64 %b) {
143 ; CHECK-LABEL: test_llneull_sext_store:
144 ; CHECK: # %bb.0: # %entry
145 ; CHECK-NEXT: xor r3, r3, r4
146 ; CHECK-NEXT: addis r5, r2, glob@toc@ha
147 ; CHECK-NEXT: subfic r3, r3, 0
148 ; CHECK-NEXT: subfe r3, r3, r3
149 ; CHECK-NEXT: std r3, glob@toc@l(r5)
151 ; CHECK-BE-LABEL: test_llneull_sext_store:
152 ; CHECK-BE: # %bb.0: # %entry
153 ; CHECK-BE-NEXT: xor r3, r3, r4
154 ; CHECK-BE-NEXT: addis r5, r2, glob@toc@ha
155 ; CHECK-BE-NEXT: subfic r3, r3, 0
156 ; CHECK-BE-NEXT: subfe r3, r3, r3
157 ; CHECK-BE-NEXT: std r3, glob@toc@l(r5)
160 ; CHECK-LE-LABEL: test_llneull_sext_store:
161 ; CHECK-LE: # %bb.0: # %entry
162 ; CHECK-LE-NEXT: xor r3, r3, r4
163 ; CHECK-LE-NEXT: addis r5, r2, glob@toc@ha
164 ; CHECK-LE-NEXT: subfic r3, r3, 0
165 ; CHECK-LE-NEXT: subfe r3, r3, r3
166 ; CHECK-LE-NEXT: std r3, glob@toc@l(r5)
169 %cmp = icmp ne i64 %a, %b
170 %conv1 = sext i1 %cmp to i64
171 store i64 %conv1, ptr @glob, align 8
175 define dso_local void @test_llneull_z_store(i64 %a) {
176 ; CHECK-LABEL: test_llneull_z_store:
177 ; CHECK: # %bb.0: # %entry
178 ; CHECK-NEXT: addic r5, r3, -1
179 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
180 ; CHECK-NEXT: subfe r3, r5, r3
181 ; CHECK-NEXT: std r3, glob@toc@l(r4)
183 ; CHECK-BE-LABEL: test_llneull_z_store:
184 ; CHECK-BE: # %bb.0: # %entry
185 ; CHECK-BE-NEXT: addic r5, r3, -1
186 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
187 ; CHECK-BE-NEXT: subfe r3, r5, r3
188 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
191 ; CHECK-LE-LABEL: test_llneull_z_store:
192 ; CHECK-LE: # %bb.0: # %entry
193 ; CHECK-LE-NEXT: addic r5, r3, -1
194 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
195 ; CHECK-LE-NEXT: subfe r3, r5, r3
196 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
199 %cmp = icmp ne i64 %a, 0
200 %conv1 = zext i1 %cmp to i64
201 store i64 %conv1, ptr @glob, align 8
205 define dso_local void @test_llneull_sext_z_store(i64 %a) {
206 ; CHECK-LABEL: test_llneull_sext_z_store:
207 ; CHECK: # %bb.0: # %entry
208 ; CHECK-NEXT: subfic r3, r3, 0
209 ; CHECK-NEXT: addis r4, r2, glob@toc@ha
210 ; CHECK-NEXT: subfe r3, r3, r3
211 ; CHECK-NEXT: std r3, glob@toc@l(r4)
213 ; CHECK-BE-LABEL: test_llneull_sext_z_store:
214 ; CHECK-BE: # %bb.0: # %entry
215 ; CHECK-BE-NEXT: subfic r3, r3, 0
216 ; CHECK-BE-NEXT: addis r4, r2, glob@toc@ha
217 ; CHECK-BE-NEXT: subfe r3, r3, r3
218 ; CHECK-BE-NEXT: std r3, glob@toc@l(r4)
221 ; CHECK-LE-LABEL: test_llneull_sext_z_store:
222 ; CHECK-LE: # %bb.0: # %entry
223 ; CHECK-LE-NEXT: subfic r3, r3, 0
224 ; CHECK-LE-NEXT: addis r4, r2, glob@toc@ha
225 ; CHECK-LE-NEXT: subfe r3, r3, r3
226 ; CHECK-LE-NEXT: std r3, glob@toc@l(r4)
229 %cmp = icmp ne i64 %a, 0
230 %conv1 = sext i1 %cmp to i64
231 store i64 %conv1, ptr @glob, align 8