• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
2; RUN: llc -march=amdgcn -mcpu=fiji -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
3
4declare i64 @llvm.amdgcn.fcmp.f32(float, float, i32) #0
5declare i64 @llvm.amdgcn.fcmp.f64(double, double, i32) #0
6declare float @llvm.fabs.f32(float) #0
7
8; GCN-LABEL: {{^}}v_fcmp_f32_dynamic_cc:
9; GCN: s_endpgm
10define amdgpu_kernel void @v_fcmp_f32_dynamic_cc(i64 addrspace(1)* %out, float %src0, float %src1, i32 %cc) {
11  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src0, float %src1, i32 %cc)
12  store i64 %result, i64 addrspace(1)* %out
13  ret void
14}
15
16; GCN-LABEL: {{^}}v_fcmp_f32_oeq_with_fabs:
17; GCN: v_cmp_eq_f32_e64 {{s\[[0-9]+:[0-9]+\]}}, {{s[0-9]+}}, |{{v[0-9]+}}|
18define amdgpu_kernel void @v_fcmp_f32_oeq_with_fabs(i64 addrspace(1)* %out, float %src, float %a) {
19  %temp = call float @llvm.fabs.f32(float %a)
20  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float %temp, i32 1)
21  store i64 %result, i64 addrspace(1)* %out
22  ret void
23}
24
25; GCN-LABEL: {{^}}v_fcmp_f32_oeq_both_operands_with_fabs:
26; GCN: v_cmp_eq_f32_e64 {{s\[[0-9]+:[0-9]+\]}}, |{{s[0-9]+}}|, |{{v[0-9]+}}|
27define amdgpu_kernel void @v_fcmp_f32_oeq_both_operands_with_fabs(i64 addrspace(1)* %out, float %src, float %a) {
28  %temp = call float @llvm.fabs.f32(float %a)
29  %src_input = call float @llvm.fabs.f32(float %src)
30  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src_input, float %temp, i32 1)
31  store i64 %result, i64 addrspace(1)* %out
32  ret void
33}
34
35; GCN-LABEL: {{^}}v_fcmp:
36; GCN-NOT: v_cmp_eq_f32_e64
37define amdgpu_kernel void @v_fcmp(i64 addrspace(1)* %out, float %src) {
38  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 -1)
39  store i64 %result, i64 addrspace(1)* %out
40  ret void
41}
42
43; GCN-LABEL: {{^}}v_fcmp_f32_oeq:
44; GCN: v_cmp_eq_f32_e64
45define amdgpu_kernel void @v_fcmp_f32_oeq(i64 addrspace(1)* %out, float %src) {
46  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 1)
47  store i64 %result, i64 addrspace(1)* %out
48  ret void
49}
50
51; GCN-LABEL: {{^}}v_fcmp_f32_one:
52; GCN: v_cmp_neq_f32_e64
53define amdgpu_kernel void @v_fcmp_f32_one(i64 addrspace(1)* %out, float %src) {
54  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 6)
55  store i64 %result, i64 addrspace(1)* %out
56  ret void
57}
58
59; GCN-LABEL: {{^}}v_fcmp_f32_ogt:
60; GCN: v_cmp_gt_f32_e64
61define amdgpu_kernel void @v_fcmp_f32_ogt(i64 addrspace(1)* %out, float %src) {
62  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 2)
63  store i64 %result, i64 addrspace(1)* %out
64  ret void
65}
66
67; GCN-LABEL: {{^}}v_fcmp_f32_oge:
68; GCN: v_cmp_ge_f32_e64
69define amdgpu_kernel void @v_fcmp_f32_oge(i64 addrspace(1)* %out, float %src) {
70  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 3)
71  store i64 %result, i64 addrspace(1)* %out
72  ret void
73}
74
75; GCN-LABEL: {{^}}v_fcmp_f32_olt:
76; GCN: v_cmp_lt_f32_e64
77define amdgpu_kernel void @v_fcmp_f32_olt(i64 addrspace(1)* %out, float %src) {
78  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 4)
79  store i64 %result, i64 addrspace(1)* %out
80  ret void
81}
82
83; GCN-LABEL: {{^}}v_fcmp_f32_ole:
84; GCN: v_cmp_le_f32_e64
85define amdgpu_kernel void @v_fcmp_f32_ole(i64 addrspace(1)* %out, float %src) {
86  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 5)
87  store i64 %result, i64 addrspace(1)* %out
88  ret void
89}
90
91
92; GCN-LABEL: {{^}}v_fcmp_f32_ueq:
93; GCN: v_cmp_nlg_f32_e64
94define amdgpu_kernel void @v_fcmp_f32_ueq(i64 addrspace(1)* %out, float %src) {
95  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 9)
96  store i64 %result, i64 addrspace(1)* %out
97  ret void
98}
99
100; GCN-LABEL: {{^}}v_fcmp_f32_une:
101; GCN: v_cmp_neq_f32_e64
102define amdgpu_kernel void @v_fcmp_f32_une(i64 addrspace(1)* %out, float %src) {
103  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 14)
104  store i64 %result, i64 addrspace(1)* %out
105  ret void
106}
107
108; GCN-LABEL: {{^}}v_fcmp_f32_ugt:
109; GCN: v_cmp_nle_f32_e64
110define amdgpu_kernel void @v_fcmp_f32_ugt(i64 addrspace(1)* %out, float %src) {
111  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 10)
112  store i64 %result, i64 addrspace(1)* %out
113  ret void
114}
115
116; GCN-LABEL: {{^}}v_fcmp_f32_uge:
117; GCN: v_cmp_nlt_f32_e64
118define amdgpu_kernel void @v_fcmp_f32_uge(i64 addrspace(1)* %out, float %src) {
119  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 11)
120  store i64 %result, i64 addrspace(1)* %out
121  ret void
122}
123
124; GCN-LABEL: {{^}}v_fcmp_f32_ult:
125; GCN: v_cmp_nge_f32_e64
126define amdgpu_kernel void @v_fcmp_f32_ult(i64 addrspace(1)* %out, float %src) {
127  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 12)
128  store i64 %result, i64 addrspace(1)* %out
129  ret void
130}
131
132; GCN-LABEL: {{^}}v_fcmp_f32_ule:
133; GCN: v_cmp_ngt_f32_e64
134define amdgpu_kernel void @v_fcmp_f32_ule(i64 addrspace(1)* %out, float %src) {
135  %result = call i64 @llvm.amdgcn.fcmp.f32(float %src, float 100.00, i32 13)
136  store i64 %result, i64 addrspace(1)* %out
137  ret void
138}
139
140; GCN-LABEL: {{^}}v_fcmp_f64_oeq:
141; GCN: v_cmp_eq_f64_e64
142define amdgpu_kernel void @v_fcmp_f64_oeq(i64 addrspace(1)* %out, double %src) {
143  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 1)
144  store i64 %result, i64 addrspace(1)* %out
145  ret void
146}
147
148; GCN-LABEL: {{^}}v_fcmp_f64_one:
149; GCN: v_cmp_neq_f64_e64
150define amdgpu_kernel void @v_fcmp_f64_one(i64 addrspace(1)* %out, double %src) {
151  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 6)
152  store i64 %result, i64 addrspace(1)* %out
153  ret void
154}
155
156; GCN-LABEL: {{^}}v_fcmp_f64_ogt:
157; GCN: v_cmp_gt_f64_e64
158define amdgpu_kernel void @v_fcmp_f64_ogt(i64 addrspace(1)* %out, double %src) {
159  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 2)
160  store i64 %result, i64 addrspace(1)* %out
161  ret void
162}
163
164; GCN-LABEL: {{^}}v_fcmp_f64_oge:
165; GCN: v_cmp_ge_f64_e64
166define amdgpu_kernel void @v_fcmp_f64_oge(i64 addrspace(1)* %out, double %src) {
167  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 3)
168  store i64 %result, i64 addrspace(1)* %out
169  ret void
170}
171
172; GCN-LABEL: {{^}}v_fcmp_f64_olt:
173; GCN: v_cmp_lt_f64_e64
174define amdgpu_kernel void @v_fcmp_f64_olt(i64 addrspace(1)* %out, double %src) {
175  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 4)
176  store i64 %result, i64 addrspace(1)* %out
177  ret void
178}
179
180; GCN-LABEL: {{^}}v_fcmp_f64_ole:
181; GCN: v_cmp_le_f64_e64
182define amdgpu_kernel void @v_fcmp_f64_ole(i64 addrspace(1)* %out, double %src) {
183  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 5)
184  store i64 %result, i64 addrspace(1)* %out
185  ret void
186}
187
188; GCN-LABEL: {{^}}v_fcmp_f64_ueq:
189; GCN: v_cmp_nlg_f64_e64
190define amdgpu_kernel void @v_fcmp_f64_ueq(i64 addrspace(1)* %out, double %src) {
191  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 9)
192  store i64 %result, i64 addrspace(1)* %out
193  ret void
194}
195
196; GCN-LABEL: {{^}}v_fcmp_f64_une:
197; GCN: v_cmp_neq_f64_e64
198define amdgpu_kernel void @v_fcmp_f64_une(i64 addrspace(1)* %out, double %src) {
199  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 14)
200  store i64 %result, i64 addrspace(1)* %out
201  ret void
202}
203
204; GCN-LABEL: {{^}}v_fcmp_f64_ugt:
205; GCN: v_cmp_nle_f64_e64
206define amdgpu_kernel void @v_fcmp_f64_ugt(i64 addrspace(1)* %out, double %src) {
207  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 10)
208  store i64 %result, i64 addrspace(1)* %out
209  ret void
210}
211
212; GCN-LABEL: {{^}}v_fcmp_f64_uge:
213; GCN: v_cmp_nlt_f64_e64
214define amdgpu_kernel void @v_fcmp_f64_uge(i64 addrspace(1)* %out, double %src) {
215  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 11)
216  store i64 %result, i64 addrspace(1)* %out
217  ret void
218}
219
220; GCN-LABEL: {{^}}v_fcmp_f64_ult:
221; GCN: v_cmp_nge_f64_e64
222define amdgpu_kernel void @v_fcmp_f64_ult(i64 addrspace(1)* %out, double %src) {
223  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 12)
224  store i64 %result, i64 addrspace(1)* %out
225  ret void
226}
227
228; GCN-LABEL: {{^}}v_fcmp_f64_ule:
229; GCN: v_cmp_ngt_f64_e64
230define amdgpu_kernel void @v_fcmp_f64_ule(i64 addrspace(1)* %out, double %src) {
231  %result = call i64 @llvm.amdgcn.fcmp.f64(double %src, double 100.00, i32 13)
232  store i64 %result, i64 addrspace(1)* %out
233  ret void
234}
235
236attributes #0 = { nounwind readnone convergent }
237