1; RUN: llc -march=r600 -mcpu=redwood < %s | FileCheck %s -check-prefix=R600 -check-prefix=FUNC
2; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
3; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
4
5; FUNC-LABEL: {{^}}rint_f32:
6; R600: RNDNE
7
8; SI: v_rndne_f32_e32
9define void @rint_f32(float addrspace(1)* %out, float %in) {
10entry:
11  %0 = call float @llvm.rint.f32(float %in) #0
12  store float %0, float addrspace(1)* %out
13  ret void
14}
15
16; FUNC-LABEL: {{^}}rint_v2f32:
17; R600: RNDNE
18; R600: RNDNE
19
20; SI: v_rndne_f32_e32
21; SI: v_rndne_f32_e32
22define void @rint_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) {
23entry:
24  %0 = call <2 x float> @llvm.rint.v2f32(<2 x float> %in) #0
25  store <2 x float> %0, <2 x float> addrspace(1)* %out
26  ret void
27}
28
29; FUNC-LABEL: {{^}}rint_v4f32:
30; R600: RNDNE
31; R600: RNDNE
32; R600: RNDNE
33; R600: RNDNE
34
35; SI: v_rndne_f32_e32
36; SI: v_rndne_f32_e32
37; SI: v_rndne_f32_e32
38; SI: v_rndne_f32_e32
39define void @rint_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) {
40entry:
41  %0 = call <4 x float> @llvm.rint.v4f32(<4 x float> %in) #0
42  store <4 x float> %0, <4 x float> addrspace(1)* %out
43  ret void
44}
45
46; FUNC-LABEL: {{^}}legacy_amdil_round_nearest_f32:
47; R600: RNDNE
48
49; SI: v_rndne_f32_e32
50define void @legacy_amdil_round_nearest_f32(float addrspace(1)* %out, float %in) {
51entry:
52  %0 = call float @llvm.AMDIL.round.nearest.f32(float %in) #0
53  store float %0, float addrspace(1)* %out
54  ret void
55}
56
57declare float @llvm.AMDIL.round.nearest.f32(float) #0
58declare float @llvm.rint.f32(float) #0
59declare <2 x float> @llvm.rint.v2f32(<2 x float>) #0
60declare <4 x float> @llvm.rint.v4f32(<4 x float>) #0
61
62attributes #0 = { nounwind readnone }
63