1; RUN: llc -march=amdgcn -verify-machineinstrs < %s
2; RUN: llc -march=amdgcn -mcpu=bonaire -verify-machineinstrs < %s
3; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s
4
5; This should have the exactly the same output as the test for rint,
6; so no need to check anything.
7
8declare float @llvm.nearbyint.f32(float) #0
9declare <2 x float> @llvm.nearbyint.v2f32(<2 x float>) #0
10declare <4 x float> @llvm.nearbyint.v4f32(<4 x float>) #0
11declare double @llvm.nearbyint.f64(double) #0
12declare <2 x double> @llvm.nearbyint.v2f64(<2 x double>) #0
13declare <4 x double> @llvm.nearbyint.v4f64(<4 x double>) #0
14
15
16define amdgpu_kernel void @fnearbyint_f32(float addrspace(1)* %out, float %in) #1 {
17entry:
18  %0 = call float @llvm.nearbyint.f32(float %in)
19  store float %0, float addrspace(1)* %out
20  ret void
21}
22
23define amdgpu_kernel void @fnearbyint_v2f32(<2 x float> addrspace(1)* %out, <2 x float> %in) #1 {
24entry:
25  %0 = call <2 x float> @llvm.nearbyint.v2f32(<2 x float> %in)
26  store <2 x float> %0, <2 x float> addrspace(1)* %out
27  ret void
28}
29
30define amdgpu_kernel void @fnearbyint_v4f32(<4 x float> addrspace(1)* %out, <4 x float> %in) #1 {
31entry:
32  %0 = call <4 x float> @llvm.nearbyint.v4f32(<4 x float> %in)
33  store <4 x float> %0, <4 x float> addrspace(1)* %out
34  ret void
35}
36
37define amdgpu_kernel void @nearbyint_f64(double addrspace(1)* %out, double %in) {
38entry:
39  %0 = call double @llvm.nearbyint.f64(double %in)
40  store double %0, double addrspace(1)* %out
41  ret void
42}
43define amdgpu_kernel void @nearbyint_v2f64(<2 x double> addrspace(1)* %out, <2 x double> %in) {
44entry:
45  %0 = call <2 x double> @llvm.nearbyint.v2f64(<2 x double> %in)
46  store <2 x double> %0, <2 x double> addrspace(1)* %out
47  ret void
48}
49
50define amdgpu_kernel void @nearbyint_v4f64(<4 x double> addrspace(1)* %out, <4 x double> %in) {
51entry:
52  %0 = call <4 x double> @llvm.nearbyint.v4f64(<4 x double> %in)
53  store <4 x double> %0, <4 x double> addrspace(1)* %out
54  ret void
55}
56
57attributes #0 = { nounwind readonly }
58attributes #1 = { nounwind }
59