Revert 239644.
[oota-llvm.git] / test / CodeGen / R600 / fsqrt.ll
1 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck %s
2 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck %s
3 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck %s
4 ; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck %s
5
6 ; Run with unsafe-fp-math to make sure nothing tries to turn this into 1 / rsqrt(x)
7
8 ; CHECK: {{^}}fsqrt_f32:
9 ; CHECK: v_sqrt_f32_e32 {{v[0-9]+, v[0-9]+}}
10
11 define void @fsqrt_f32(float addrspace(1)* %out, float addrspace(1)* %in) {
12    %r0 = load float, float addrspace(1)* %in
13    %r1 = call float @llvm.sqrt.f32(float %r0)
14    store float %r1, float addrspace(1)* %out
15    ret void
16 }
17
18 ; CHECK: {{^}}fsqrt_f64:
19 ; CHECK: v_sqrt_f64_e32 {{v\[[0-9]+:[0-9]+\], v\[[0-9]+:[0-9]+\]}}
20
21 define void @fsqrt_f64(double addrspace(1)* %out, double addrspace(1)* %in) {
22    %r0 = load double, double addrspace(1)* %in
23    %r1 = call double @llvm.sqrt.f64(double %r0)
24    store double %r1, double addrspace(1)* %out
25    ret void
26 }
27
28 declare float @llvm.sqrt.f32(float %Val)
29 declare double @llvm.sqrt.f64(double %Val)