1; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
2; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=GCN -check-prefix=FUNC %s
3
4; FUNC-LABEL: {{^}}v_safe_fsqrt_f64:
5; GCN: v_sqrt_f64_e32 {{v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\]}}
6define void @v_safe_fsqrt_f64(double addrspace(1)* %out, double addrspace(1)* %in) #1 {
7  %r0 = load double, double addrspace(1)* %in
8  %r1 = call double @llvm.sqrt.f64(double %r0)
9  store double %r1, double addrspace(1)* %out
10  ret void
11}
12
13; FUNC-LABEL: {{^}}v_unsafe_fsqrt_f64:
14; GCN: v_sqrt_f64_e32 {{v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\]}}
15define void @v_unsafe_fsqrt_f64(double addrspace(1)* %out, double addrspace(1)* %in) #2 {
16  %r0 = load double, double addrspace(1)* %in
17  %r1 = call double @llvm.sqrt.f64(double %r0)
18  store double %r1, double addrspace(1)* %out
19  ret void
20}
21
22declare double @llvm.sqrt.f64(double %Val) #0
23
24attributes #0 = { nounwind readnone }
25attributes #1 = { nounwind "unsafe-fp-math"="false" }
26attributes #2 = { nounwind "unsafe-fp-math"="true" }
27