1 ; RUN: llc -mtriple=amdgcn -verify-machineinstrs < %s| FileCheck -check-prefixes=GCN,SI %s
2 ; RUN: llc -mtriple=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=GCN,VI %s
4 ; XXX: Merge this into setcc, once R600 supports 64-bit operations
6 ;;;==========================================================================;;;
8 ;;;==========================================================================;;;
10 ; GCN-LABEL: {{^}}f64_oeq:
12 define amdgpu_kernel void @f64_oeq(ptr addrspace(1) %out, double %a, double %b) #0 {
14 %tmp0 = fcmp oeq double %a, %b
15 %tmp1 = sext i1 %tmp0 to i32
16 store i32 %tmp1, ptr addrspace(1) %out
20 ; GCN-LABEL: {{^}}f64_ogt:
22 define amdgpu_kernel void @f64_ogt(ptr addrspace(1) %out, double %a, double %b) #0 {
24 %tmp0 = fcmp ogt double %a, %b
25 %tmp1 = sext i1 %tmp0 to i32
26 store i32 %tmp1, ptr addrspace(1) %out
30 ; GCN-LABEL: {{^}}f64_oge:
32 define amdgpu_kernel void @f64_oge(ptr addrspace(1) %out, double %a, double %b) #0 {
34 %tmp0 = fcmp oge double %a, %b
35 %tmp1 = sext i1 %tmp0 to i32
36 store i32 %tmp1, ptr addrspace(1) %out
40 ; GCN-LABEL: {{^}}f64_olt:
42 define amdgpu_kernel void @f64_olt(ptr addrspace(1) %out, double %a, double %b) #0 {
44 %tmp0 = fcmp olt double %a, %b
45 %tmp1 = sext i1 %tmp0 to i32
46 store i32 %tmp1, ptr addrspace(1) %out
50 ; GCN-LABEL: {{^}}f64_ole:
52 define amdgpu_kernel void @f64_ole(ptr addrspace(1) %out, double %a, double %b) #0 {
54 %tmp0 = fcmp ole double %a, %b
55 %tmp1 = sext i1 %tmp0 to i32
56 store i32 %tmp1, ptr addrspace(1) %out
60 ; GCN-LABEL: {{^}}f64_one:
61 ; GCN: v_cmp_lg_f64_e32 vcc
62 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
63 define amdgpu_kernel void @f64_one(ptr addrspace(1) %out, double %a, double %b) #0 {
65 %tmp0 = fcmp one double %a, %b
66 %tmp1 = sext i1 %tmp0 to i32
67 store i32 %tmp1, ptr addrspace(1) %out
71 ; GCN-LABEL: {{^}}f64_ord:
73 define amdgpu_kernel void @f64_ord(ptr addrspace(1) %out, double %a, double %b) #0 {
75 %tmp0 = fcmp ord double %a, %b
76 %tmp1 = sext i1 %tmp0 to i32
77 store i32 %tmp1, ptr addrspace(1) %out
81 ; GCN-LABEL: {{^}}f64_ueq:
82 ; GCN: v_cmp_nlg_f64_e32 vcc
83 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
84 define amdgpu_kernel void @f64_ueq(ptr addrspace(1) %out, double %a, double %b) #0 {
86 %tmp0 = fcmp ueq double %a, %b
87 %tmp1 = sext i1 %tmp0 to i32
88 store i32 %tmp1, ptr addrspace(1) %out
92 ; GCN-LABEL: {{^}}f64_ugt:
94 ; GCN: v_cmp_nle_f64_e32 vcc
95 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
96 define amdgpu_kernel void @f64_ugt(ptr addrspace(1) %out, double %a, double %b) #0 {
98 %tmp0 = fcmp ugt double %a, %b
99 %tmp1 = sext i1 %tmp0 to i32
100 store i32 %tmp1, ptr addrspace(1) %out
104 ; GCN-LABEL: {{^}}f64_uge:
105 ; GCN: v_cmp_nlt_f64_e32 vcc
106 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
107 define amdgpu_kernel void @f64_uge(ptr addrspace(1) %out, double %a, double %b) #0 {
109 %tmp0 = fcmp uge double %a, %b
110 %tmp1 = sext i1 %tmp0 to i32
111 store i32 %tmp1, ptr addrspace(1) %out
115 ; GCN-LABEL: {{^}}f64_ult:
116 ; GCN: v_cmp_nge_f64_e32 vcc
117 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
118 define amdgpu_kernel void @f64_ult(ptr addrspace(1) %out, double %a, double %b) #0 {
120 %tmp0 = fcmp ult double %a, %b
121 %tmp1 = sext i1 %tmp0 to i32
122 store i32 %tmp1, ptr addrspace(1) %out
126 ; GCN-LABEL: {{^}}f64_ule:
127 ; GCN: v_cmp_ngt_f64_e32 vcc
128 ; GCN: v_cndmask_b32_e64 {{v[0-9]+}}, 0, -1, vcc
129 define amdgpu_kernel void @f64_ule(ptr addrspace(1) %out, double %a, double %b) #0 {
131 %tmp0 = fcmp ule double %a, %b
132 %tmp1 = sext i1 %tmp0 to i32
133 store i32 %tmp1, ptr addrspace(1) %out
137 ; GCN-LABEL: {{^}}f64_une:
139 define amdgpu_kernel void @f64_une(ptr addrspace(1) %out, double %a, double %b) #0 {
141 %tmp0 = fcmp une double %a, %b
142 %tmp1 = sext i1 %tmp0 to i32
143 store i32 %tmp1, ptr addrspace(1) %out
147 ; GCN-LABEL: {{^}}f64_uno:
149 define amdgpu_kernel void @f64_uno(ptr addrspace(1) %out, double %a, double %b) #0 {
151 %tmp0 = fcmp uno double %a, %b
152 %tmp1 = sext i1 %tmp0 to i32
153 store i32 %tmp1, ptr addrspace(1) %out
157 ;;;==========================================================================;;;
158 ;; 64-bit integer comparisons
159 ;;;==========================================================================;;;
161 ; GCN-LABEL: {{^}}i64_eq:
164 define amdgpu_kernel void @i64_eq(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
166 %tmp0 = icmp eq i64 %a, %b
167 %tmp1 = sext i1 %tmp0 to i32
168 store i32 %tmp1, ptr addrspace(1) %out
172 ; GCN-LABEL: {{^}}i64_ne:
175 define amdgpu_kernel void @i64_ne(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
177 %tmp0 = icmp ne i64 %a, %b
178 %tmp1 = sext i1 %tmp0 to i32
179 store i32 %tmp1, ptr addrspace(1) %out
183 ; GCN-LABEL: {{^}}i64_ugt:
185 define amdgpu_kernel void @i64_ugt(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
187 %tmp0 = icmp ugt i64 %a, %b
188 %tmp1 = sext i1 %tmp0 to i32
189 store i32 %tmp1, ptr addrspace(1) %out
193 ; GCN-LABEL: {{^}}i64_uge:
195 define amdgpu_kernel void @i64_uge(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
197 %tmp0 = icmp uge i64 %a, %b
198 %tmp1 = sext i1 %tmp0 to i32
199 store i32 %tmp1, ptr addrspace(1) %out
203 ; GCN-LABEL: {{^}}i64_ult:
205 define amdgpu_kernel void @i64_ult(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
207 %tmp0 = icmp ult i64 %a, %b
208 %tmp1 = sext i1 %tmp0 to i32
209 store i32 %tmp1, ptr addrspace(1) %out
213 ; GCN-LABEL: {{^}}i64_ule:
215 define amdgpu_kernel void @i64_ule(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
217 %tmp0 = icmp ule i64 %a, %b
218 %tmp1 = sext i1 %tmp0 to i32
219 store i32 %tmp1, ptr addrspace(1) %out
223 ; GCN-LABEL: {{^}}i64_sgt:
225 define amdgpu_kernel void @i64_sgt(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
227 %tmp0 = icmp sgt i64 %a, %b
228 %tmp1 = sext i1 %tmp0 to i32
229 store i32 %tmp1, ptr addrspace(1) %out
233 ; GCN-LABEL: {{^}}i64_sge:
235 define amdgpu_kernel void @i64_sge(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
237 %tmp0 = icmp sge i64 %a, %b
238 %tmp1 = sext i1 %tmp0 to i32
239 store i32 %tmp1, ptr addrspace(1) %out
243 ; GCN-LABEL: {{^}}i64_slt:
245 define amdgpu_kernel void @i64_slt(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
247 %tmp0 = icmp slt i64 %a, %b
248 %tmp1 = sext i1 %tmp0 to i32
249 store i32 %tmp1, ptr addrspace(1) %out
253 ; GCN-LABEL: {{^}}i64_sle:
255 define amdgpu_kernel void @i64_sle(ptr addrspace(1) %out, i64 %a, i64 %b) #0 {
257 %tmp0 = icmp sle i64 %a, %b
258 %tmp1 = sext i1 %tmp0 to i32
259 store i32 %tmp1, ptr addrspace(1) %out
263 ; GCN-LABEL: {{^}}i128_sle:
268 define amdgpu_kernel void @i128_sle(ptr addrspace(1) %out, i128 %a, i128 %b) #0 {
270 %tmp0 = icmp sle i128 %a, %b
271 %tmp1 = sext i1 %tmp0 to i32
272 store i32 %tmp1, ptr addrspace(1) %out
276 ; GCN-LABEL: {{^}}i128_eq_const:
279 define amdgpu_kernel void @i128_eq_const(ptr addrspace(1) %out, i128 %a) #0 {
281 %tmp0 = icmp eq i128 %a, 85070591730234615865843651857942052992
282 %tmp1 = sext i1 %tmp0 to i32
283 store i32 %tmp1, ptr addrspace(1) %out
287 attributes #0 = { nounwind }