1; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN %s
2; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=GCN %s
3
4declare float @llvm.amdgcn.fract.f32(float) #0
5declare double @llvm.amdgcn.fract.f64(double) #0
6
7; GCN-LABEL: {{^}}v_fract_f32:
8; GCN: v_fract_f32_e32 {{v[0-9]+}}, {{s[0-9]+}}
9define amdgpu_kernel void @v_fract_f32(float addrspace(1)* %out, float %src) #1 {
10  %fract = call float @llvm.amdgcn.fract.f32(float %src)
11  store float %fract, float addrspace(1)* %out
12  ret void
13}
14
15; GCN-LABEL: {{^}}v_fract_f64:
16; GCN: v_fract_f64_e32 {{v\[[0-9]+:[0-9]+\]}}, {{s\[[0-9]+:[0-9]+\]}}
17define amdgpu_kernel void @v_fract_f64(double addrspace(1)* %out, double %src) #1 {
18  %fract = call double @llvm.amdgcn.fract.f64(double %src)
19  store double %fract, double addrspace(1)* %out
20  ret void
21}
22
23; GCN-LABEL: {{^}}v_fract_undef_f32:
24; GCN-NOT: v_fract_f32
25; GCN-NOT: store_dword
26define amdgpu_kernel void @v_fract_undef_f32(float addrspace(1)* %out) #1 {
27  %fract = call float @llvm.amdgcn.fract.f32(float undef)
28  store float %fract, float addrspace(1)* %out
29  ret void
30}
31
32attributes #0 = { nounwind readnone }
33attributes #1 = { nounwind }
34