1; RUN: llc < %s -march=amdgcn -mcpu=tahiti -verify-machineinstrs | FileCheck %s
2; RUN: llc < %s -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs | FileCheck %s
3
4; CHECK-LABEL: {{^}}flt_f64:
5; CHECK: v_cmp_nge_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
6define amdgpu_kernel void @flt_f64(i32 addrspace(1)* %out, double addrspace(1)* %in1,
7                     double addrspace(1)* %in2) {
8   %r0 = load double, double addrspace(1)* %in1
9   %r1 = load double, double addrspace(1)* %in2
10   %r2 = fcmp ult double %r0, %r1
11   %r3 = zext i1 %r2 to i32
12   store i32 %r3, i32 addrspace(1)* %out
13   ret void
14}
15
16; CHECK-LABEL: {{^}}fle_f64:
17; CHECK: v_cmp_ngt_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
18define amdgpu_kernel void @fle_f64(i32 addrspace(1)* %out, double addrspace(1)* %in1,
19                     double addrspace(1)* %in2) {
20   %r0 = load double, double addrspace(1)* %in1
21   %r1 = load double, double addrspace(1)* %in2
22   %r2 = fcmp ule double %r0, %r1
23   %r3 = zext i1 %r2 to i32
24   store i32 %r3, i32 addrspace(1)* %out
25   ret void
26}
27
28; CHECK-LABEL: {{^}}fgt_f64:
29; CHECK: v_cmp_nle_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
30define amdgpu_kernel void @fgt_f64(i32 addrspace(1)* %out, double addrspace(1)* %in1,
31                     double addrspace(1)* %in2) {
32   %r0 = load double, double addrspace(1)* %in1
33   %r1 = load double, double addrspace(1)* %in2
34   %r2 = fcmp ugt double %r0, %r1
35   %r3 = zext i1 %r2 to i32
36   store i32 %r3, i32 addrspace(1)* %out
37   ret void
38}
39
40; CHECK-LABEL: {{^}}fge_f64:
41; CHECK: v_cmp_nlt_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
42define amdgpu_kernel void @fge_f64(i32 addrspace(1)* %out, double addrspace(1)* %in1,
43                     double addrspace(1)* %in2) {
44   %r0 = load double, double addrspace(1)* %in1
45   %r1 = load double, double addrspace(1)* %in2
46   %r2 = fcmp uge double %r0, %r1
47   %r3 = zext i1 %r2 to i32
48   store i32 %r3, i32 addrspace(1)* %out
49   ret void
50}
51
52; CHECK-LABEL: {{^}}fne_f64:
53; CHECK: v_cmp_neq_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
54define amdgpu_kernel void @fne_f64(double addrspace(1)* %out, double addrspace(1)* %in1,
55                     double addrspace(1)* %in2) {
56   %r0 = load double, double addrspace(1)* %in1
57   %r1 = load double, double addrspace(1)* %in2
58   %r2 = fcmp une double %r0, %r1
59   %r3 = select i1 %r2, double %r0, double %r1
60   store double %r3, double addrspace(1)* %out
61   ret void
62}
63
64; CHECK-LABEL: {{^}}feq_f64:
65; CHECK: v_cmp_nlg_f64_e32 vcc, {{s[[0-9]+:[0-9]+], v[[0-9]+:[0-9]+]}}
66define amdgpu_kernel void @feq_f64(double addrspace(1)* %out, double addrspace(1)* %in1,
67                     double addrspace(1)* %in2) {
68   %r0 = load double, double addrspace(1)* %in1
69   %r1 = load double, double addrspace(1)* %in2
70   %r2 = fcmp ueq double %r0, %r1
71   %r3 = select i1 %r2, double %r0, double %r1
72   store double %r3, double addrspace(1)* %out
73   ret void
74}
75