2014-07-15 23:50:10 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=SI -mattr=-fp32-denormals -verify-machineinstrs -enable-unsafe-fp-math < %s | FileCheck -check-prefix=SI-UNSAFE -check-prefix=SI %s
|
|
|
|
; RUN: llc -march=r600 -mcpu=SI -mattr=-fp32-denormals -verify-machineinstrs < %s | FileCheck -check-prefix=SI-SAFE -check-prefix=SI %s
|
2014-06-05 00:15:55 +00:00
|
|
|
|
|
|
|
declare float @llvm.sqrt.f32(float) nounwind readnone
|
|
|
|
declare double @llvm.sqrt.f64(double) nounwind readnone
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}rsq_f32:
|
2014-07-15 23:50:10 +00:00
|
|
|
; SI: V_RSQ_F32_e32
|
2014-06-05 00:15:55 +00:00
|
|
|
; SI: S_ENDPGM
|
|
|
|
define void @rsq_f32(float addrspace(1)* noalias %out, float addrspace(1)* noalias %in) nounwind {
|
|
|
|
%val = load float addrspace(1)* %in, align 4
|
|
|
|
%sqrt = call float @llvm.sqrt.f32(float %val) nounwind readnone
|
|
|
|
%div = fdiv float 1.0, %sqrt
|
|
|
|
store float %div, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}rsq_f64:
|
2014-07-15 23:50:10 +00:00
|
|
|
; SI-UNSAFE: V_RSQ_F64_e32
|
|
|
|
; SI-SAFE: V_SQRT_F64_e32
|
2014-06-05 00:15:55 +00:00
|
|
|
; SI: S_ENDPGM
|
|
|
|
define void @rsq_f64(double addrspace(1)* noalias %out, double addrspace(1)* noalias %in) nounwind {
|
|
|
|
%val = load double addrspace(1)* %in, align 4
|
|
|
|
%sqrt = call double @llvm.sqrt.f64(double %val) nounwind readnone
|
|
|
|
%div = fdiv double 1.0, %sqrt
|
|
|
|
store double %div, double addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
2014-09-15 17:15:02 +00:00
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; SI-LABEL: {{^}}rsq_f32_sgpr:
|
2014-09-15 17:15:02 +00:00
|
|
|
; SI: V_RSQ_F32_e32 {{v[0-9]+}}, {{s[0-9]+}}
|
|
|
|
; SI: S_ENDPGM
|
|
|
|
define void @rsq_f32_sgpr(float addrspace(1)* noalias %out, float %val) nounwind {
|
|
|
|
%sqrt = call float @llvm.sqrt.f32(float %val) nounwind readnone
|
|
|
|
%div = fdiv float 1.0, %sqrt
|
|
|
|
store float %div, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|