R600: Implement zero undef variants of ctlz/cttz
[oota-llvm.git] / test / CodeGen / R600 / rsq.ll
1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI %s
2
3 declare float @llvm.sqrt.f32(float) nounwind readnone
4 declare double @llvm.sqrt.f64(double) nounwind readnone
5
6 ; SI-LABEL: @rsq_f32
7 ; SI: V_RSQ_F32_e32
8 ; SI: S_ENDPGM
9 define void @rsq_f32(float addrspace(1)* noalias %out, float addrspace(1)* noalias %in) nounwind {
10   %val = load float addrspace(1)* %in, align 4
11   %sqrt = call float @llvm.sqrt.f32(float %val) nounwind readnone
12   %div = fdiv float 1.0, %sqrt
13   store float %div, float addrspace(1)* %out, align 4
14   ret void
15 }
16
17 ; SI-LABEL: @rsq_f64
18 ; SI: V_RSQ_F64_e32
19 ; SI: S_ENDPGM
20 define void @rsq_f64(double addrspace(1)* noalias %out, double addrspace(1)* noalias %in) nounwind {
21   %val = load double addrspace(1)* %in, align 4
22   %sqrt = call double @llvm.sqrt.f64(double %val) nounwind readnone
23   %div = fdiv double 1.0, %sqrt
24   store double %div, double addrspace(1)* %out, align 4
25   ret void
26 }