1; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s | FileCheck -check-prefix=CI -check-prefix=FUNC %s
3; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
4
5; FUNC-LABEL: {{^}}rint_f64:
6; CI: v_rndne_f64_e32
7
8; SI-DAG: v_add_f64
9; SI-DAG: v_add_f64
10; SI-DAG: v_cmp_gt_f64_e64
11; SI: v_cndmask_b32
12; SI: v_cndmask_b32
13; SI: s_endpgm
14define amdgpu_kernel void @rint_f64(double addrspace(1)* %out, double %in) {
15entry:
16  %0 = call double @llvm.rint.f64(double %in)
17  store double %0, double addrspace(1)* %out
18  ret void
19}
20
21; FUNC-LABEL: {{^}}rint_v2f64:
22; CI: v_rndne_f64_e32
23; CI: v_rndne_f64_e32
24define amdgpu_kernel void @rint_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %in) {
25entry:
26  %0 = call <2 x double> @llvm.rint.v2f64(<2 x double> %in)
27  store <2 x double> %0, <2 x double> addrspace(1)* %out
28  ret void
29}
30
31; FUNC-LABEL: {{^}}rint_v4f64:
32; CI: v_rndne_f64_e32
33; CI: v_rndne_f64_e32
34; CI: v_rndne_f64_e32
35; CI: v_rndne_f64_e32
36define amdgpu_kernel void @rint_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %in) {
37entry:
38  %0 = call <4 x double> @llvm.rint.v4f64(<4 x double> %in)
39  store <4 x double> %0, <4 x double> addrspace(1)* %out
40  ret void
41}
42
43
44declare double @llvm.rint.f64(double) #0
45declare <2 x double> @llvm.rint.v2f64(<2 x double>) #0
46declare <4 x double> @llvm.rint.v4f64(<4 x double>) #0
47