blob: 282a5dea976bd516541620d2db40e3cd51f0bb3e [file] [log] [blame]
Tom Stellard919bb6b2014-04-29 23:12:53 +00001;RUN: llc < %s -march=r600 -mcpu=SI -verify-machineinstrs| FileCheck --check-prefix=SI --check-prefix=FUNC %s
Tom Stellardc0845332013-11-22 23:07:58 +00002
3; XXX: Merge this into setcc, once R600 supports 64-bit operations
4
5;;;==========================================================================;;;
6;; Double comparisons
7;;;==========================================================================;;;
8
Tom Stellard79243d92014-10-01 17:15:17 +00009; FUNC-LABEL: {{^}}f64_oeq:
Tom Stellard326d6ec2014-11-05 14:50:53 +000010; SI: v_cmp_eq_f64
Tom Stellardc0845332013-11-22 23:07:58 +000011define void @f64_oeq(i32 addrspace(1)* %out, double %a, double %b) {
12entry:
13 %0 = fcmp oeq double %a, %b
14 %1 = sext i1 %0 to i32
15 store i32 %1, i32 addrspace(1)* %out
16 ret void
17}
18
Tom Stellard79243d92014-10-01 17:15:17 +000019; FUNC-LABEL: {{^}}f64_ogt:
Tom Stellard326d6ec2014-11-05 14:50:53 +000020; SI: v_cmp_gt_f64
Tom Stellardc0845332013-11-22 23:07:58 +000021define void @f64_ogt(i32 addrspace(1)* %out, double %a, double %b) {
22entry:
23 %0 = fcmp ogt double %a, %b
24 %1 = sext i1 %0 to i32
25 store i32 %1, i32 addrspace(1)* %out
26 ret void
27}
28
Tom Stellard79243d92014-10-01 17:15:17 +000029; FUNC-LABEL: {{^}}f64_oge:
Tom Stellard326d6ec2014-11-05 14:50:53 +000030; SI: v_cmp_ge_f64
Tom Stellardc0845332013-11-22 23:07:58 +000031define void @f64_oge(i32 addrspace(1)* %out, double %a, double %b) {
32entry:
33 %0 = fcmp oge double %a, %b
34 %1 = sext i1 %0 to i32
35 store i32 %1, i32 addrspace(1)* %out
36 ret void
37}
38
Tom Stellard79243d92014-10-01 17:15:17 +000039; FUNC-LABEL: {{^}}f64_olt:
Tom Stellard326d6ec2014-11-05 14:50:53 +000040; SI: v_cmp_lt_f64
Tom Stellardc0845332013-11-22 23:07:58 +000041define void @f64_olt(i32 addrspace(1)* %out, double %a, double %b) {
42entry:
43 %0 = fcmp olt double %a, %b
44 %1 = sext i1 %0 to i32
45 store i32 %1, i32 addrspace(1)* %out
46 ret void
47}
48
Tom Stellard79243d92014-10-01 17:15:17 +000049; FUNC-LABEL: {{^}}f64_ole:
Tom Stellard326d6ec2014-11-05 14:50:53 +000050; SI: v_cmp_le_f64
Tom Stellardc0845332013-11-22 23:07:58 +000051define void @f64_ole(i32 addrspace(1)* %out, double %a, double %b) {
52entry:
53 %0 = fcmp ole double %a, %b
54 %1 = sext i1 %0 to i32
55 store i32 %1, i32 addrspace(1)* %out
56 ret void
57}
58
Tom Stellard79243d92014-10-01 17:15:17 +000059; FUNC-LABEL: {{^}}f64_one:
Matt Arsenaultbecd6562014-12-03 05:22:35 +000060; SI-DAG: v_cmp_o_f64_e32 vcc
61; SI-DAG: v_cmp_neq_f64_e64 [[CMP1:s\[[0-9]+:[0-9]+\]]]
62; SI: s_and_b64 [[AND:s\[[0-9]+:[0-9]+\]]], [[CMP1]], vcc
63; SI: v_cndmask_b32_e64 [[VRESULT:v[0-9]+]], 0, -1, [[AND]]
64; SI: buffer_store_dword [[VRESULT]]
Tom Stellardc0845332013-11-22 23:07:58 +000065define void @f64_one(i32 addrspace(1)* %out, double %a, double %b) {
66entry:
67 %0 = fcmp one double %a, %b
68 %1 = sext i1 %0 to i32
69 store i32 %1, i32 addrspace(1)* %out
70 ret void
71}
72
Tom Stellard79243d92014-10-01 17:15:17 +000073; FUNC-LABEL: {{^}}f64_ord:
Tom Stellard326d6ec2014-11-05 14:50:53 +000074; SI: v_cmp_o_f64
Tom Stellardc0845332013-11-22 23:07:58 +000075define void @f64_ord(i32 addrspace(1)* %out, double %a, double %b) {
76entry:
77 %0 = fcmp ord double %a, %b
78 %1 = sext i1 %0 to i32
79 store i32 %1, i32 addrspace(1)* %out
80 ret void
81}
82
Tom Stellard79243d92014-10-01 17:15:17 +000083; FUNC-LABEL: {{^}}f64_ueq:
Tom Stellard326d6ec2014-11-05 14:50:53 +000084; SI: v_cmp_u_f64
85; SI: v_cmp_eq_f64
Matt Arsenaultbecd6562014-12-03 05:22:35 +000086; SI: s_or_b64
87; SI: v_cndmask_b32
Tom Stellardc0845332013-11-22 23:07:58 +000088define void @f64_ueq(i32 addrspace(1)* %out, double %a, double %b) {
89entry:
90 %0 = fcmp ueq double %a, %b
91 %1 = sext i1 %0 to i32
92 store i32 %1, i32 addrspace(1)* %out
93 ret void
94}
95
Tom Stellard79243d92014-10-01 17:15:17 +000096; FUNC-LABEL: {{^}}f64_ugt:
Tom Stellard326d6ec2014-11-05 14:50:53 +000097; SI: v_cmp_u_f64
98; SI: v_cmp_gt_f64
Matt Arsenaultbecd6562014-12-03 05:22:35 +000099; SI: s_or_b64
100; SI: v_cndmask_b32
Tom Stellardc0845332013-11-22 23:07:58 +0000101define void @f64_ugt(i32 addrspace(1)* %out, double %a, double %b) {
102entry:
103 %0 = fcmp ugt double %a, %b
104 %1 = sext i1 %0 to i32
105 store i32 %1, i32 addrspace(1)* %out
106 ret void
107}
108
Tom Stellard79243d92014-10-01 17:15:17 +0000109; FUNC-LABEL: {{^}}f64_uge:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000110; SI: v_cmp_u_f64
111; SI: v_cmp_ge_f64
Matt Arsenaultbecd6562014-12-03 05:22:35 +0000112; SI: s_or_b64
113; SI: v_cndmask_b32
Tom Stellardc0845332013-11-22 23:07:58 +0000114define void @f64_uge(i32 addrspace(1)* %out, double %a, double %b) {
115entry:
116 %0 = fcmp uge double %a, %b
117 %1 = sext i1 %0 to i32
118 store i32 %1, i32 addrspace(1)* %out
119 ret void
120}
121
Tom Stellard79243d92014-10-01 17:15:17 +0000122; FUNC-LABEL: {{^}}f64_ult:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000123; SI: v_cmp_u_f64
124; SI: v_cmp_lt_f64
Matt Arsenaultbecd6562014-12-03 05:22:35 +0000125; SI: s_or_b64
126; SI: v_cndmask_b32
Tom Stellardc0845332013-11-22 23:07:58 +0000127define void @f64_ult(i32 addrspace(1)* %out, double %a, double %b) {
128entry:
129 %0 = fcmp ult double %a, %b
130 %1 = sext i1 %0 to i32
131 store i32 %1, i32 addrspace(1)* %out
132 ret void
133}
134
Tom Stellard79243d92014-10-01 17:15:17 +0000135; FUNC-LABEL: {{^}}f64_ule:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000136; SI: v_cmp_u_f64
137; SI: v_cmp_le_f64
Matt Arsenaultbecd6562014-12-03 05:22:35 +0000138; SI: s_or_b64
139; SI: v_cndmask_b32
Tom Stellardc0845332013-11-22 23:07:58 +0000140define void @f64_ule(i32 addrspace(1)* %out, double %a, double %b) {
141entry:
142 %0 = fcmp ule double %a, %b
143 %1 = sext i1 %0 to i32
144 store i32 %1, i32 addrspace(1)* %out
145 ret void
146}
147
Tom Stellard79243d92014-10-01 17:15:17 +0000148; FUNC-LABEL: {{^}}f64_une:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000149; SI: v_cmp_neq_f64
Tom Stellardc0845332013-11-22 23:07:58 +0000150define void @f64_une(i32 addrspace(1)* %out, double %a, double %b) {
151entry:
152 %0 = fcmp une double %a, %b
153 %1 = sext i1 %0 to i32
154 store i32 %1, i32 addrspace(1)* %out
155 ret void
156}
157
Tom Stellard79243d92014-10-01 17:15:17 +0000158; FUNC-LABEL: {{^}}f64_uno:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000159; SI: v_cmp_u_f64
Tom Stellardc0845332013-11-22 23:07:58 +0000160define void @f64_uno(i32 addrspace(1)* %out, double %a, double %b) {
161entry:
162 %0 = fcmp uno double %a, %b
163 %1 = sext i1 %0 to i32
164 store i32 %1, i32 addrspace(1)* %out
165 ret void
166}
167
168;;;==========================================================================;;;
169;; 64-bit integer comparisons
170;;;==========================================================================;;;
171
Tom Stellard79243d92014-10-01 17:15:17 +0000172; FUNC-LABEL: {{^}}i64_eq:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000173; SI: v_cmp_eq_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000174define void @i64_eq(i32 addrspace(1)* %out, i64 %a, i64 %b) {
175entry:
176 %0 = icmp eq i64 %a, %b
177 %1 = sext i1 %0 to i32
178 store i32 %1, i32 addrspace(1)* %out
179 ret void
180}
181
Tom Stellard79243d92014-10-01 17:15:17 +0000182; FUNC-LABEL: {{^}}i64_ne:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000183; SI: v_cmp_ne_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000184define void @i64_ne(i32 addrspace(1)* %out, i64 %a, i64 %b) {
185entry:
186 %0 = icmp ne i64 %a, %b
187 %1 = sext i1 %0 to i32
188 store i32 %1, i32 addrspace(1)* %out
189 ret void
190}
191
Tom Stellard79243d92014-10-01 17:15:17 +0000192; FUNC-LABEL: {{^}}i64_ugt:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000193; SI: v_cmp_gt_u64
Tom Stellardc0845332013-11-22 23:07:58 +0000194define void @i64_ugt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
195entry:
196 %0 = icmp ugt i64 %a, %b
197 %1 = sext i1 %0 to i32
198 store i32 %1, i32 addrspace(1)* %out
199 ret void
200}
201
Tom Stellard79243d92014-10-01 17:15:17 +0000202; FUNC-LABEL: {{^}}i64_uge:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000203; SI: v_cmp_ge_u64
Tom Stellardc0845332013-11-22 23:07:58 +0000204define void @i64_uge(i32 addrspace(1)* %out, i64 %a, i64 %b) {
205entry:
206 %0 = icmp uge i64 %a, %b
207 %1 = sext i1 %0 to i32
208 store i32 %1, i32 addrspace(1)* %out
209 ret void
210}
211
Tom Stellard79243d92014-10-01 17:15:17 +0000212; FUNC-LABEL: {{^}}i64_ult:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000213; SI: v_cmp_lt_u64
Tom Stellardc0845332013-11-22 23:07:58 +0000214define void @i64_ult(i32 addrspace(1)* %out, i64 %a, i64 %b) {
215entry:
216 %0 = icmp ult i64 %a, %b
217 %1 = sext i1 %0 to i32
218 store i32 %1, i32 addrspace(1)* %out
219 ret void
220}
221
Tom Stellard79243d92014-10-01 17:15:17 +0000222; FUNC-LABEL: {{^}}i64_ule:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000223; SI: v_cmp_le_u64
Tom Stellardc0845332013-11-22 23:07:58 +0000224define void @i64_ule(i32 addrspace(1)* %out, i64 %a, i64 %b) {
225entry:
226 %0 = icmp ule i64 %a, %b
227 %1 = sext i1 %0 to i32
228 store i32 %1, i32 addrspace(1)* %out
229 ret void
230}
231
Tom Stellard79243d92014-10-01 17:15:17 +0000232; FUNC-LABEL: {{^}}i64_sgt:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000233; SI: v_cmp_gt_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000234define void @i64_sgt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
235entry:
236 %0 = icmp sgt i64 %a, %b
237 %1 = sext i1 %0 to i32
238 store i32 %1, i32 addrspace(1)* %out
239 ret void
240}
241
Tom Stellard79243d92014-10-01 17:15:17 +0000242; FUNC-LABEL: {{^}}i64_sge:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000243; SI: v_cmp_ge_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000244define void @i64_sge(i32 addrspace(1)* %out, i64 %a, i64 %b) {
245entry:
246 %0 = icmp sge i64 %a, %b
247 %1 = sext i1 %0 to i32
248 store i32 %1, i32 addrspace(1)* %out
249 ret void
250}
251
Tom Stellard79243d92014-10-01 17:15:17 +0000252; FUNC-LABEL: {{^}}i64_slt:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000253; SI: v_cmp_lt_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000254define void @i64_slt(i32 addrspace(1)* %out, i64 %a, i64 %b) {
255entry:
256 %0 = icmp slt i64 %a, %b
257 %1 = sext i1 %0 to i32
258 store i32 %1, i32 addrspace(1)* %out
259 ret void
260}
261
Tom Stellard79243d92014-10-01 17:15:17 +0000262; FUNC-LABEL: {{^}}i64_sle:
Tom Stellard326d6ec2014-11-05 14:50:53 +0000263; SI: v_cmp_le_i64
Tom Stellardc0845332013-11-22 23:07:58 +0000264define void @i64_sle(i32 addrspace(1)* %out, i64 %a, i64 %b) {
265entry:
266 %0 = icmp sle i64 %a, %b
267 %1 = sext i1 %0 to i32
268 store i32 %1, i32 addrspace(1)* %out
269 ret void
270}