2015-01-07 02:00:21 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
2015-01-28 01:27:15 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s
|
2014-07-12 08:36:19 +08:00
|
|
|
|
|
|
|
declare double @llvm.AMDGPU.rcp.f64(double) nounwind readnone
|
|
|
|
declare double @llvm.sqrt.f64(double) nounwind readnone
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}rcp_f64:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI: v_rcp_f64_e32
|
2014-07-12 08:36:19 +08:00
|
|
|
define void @rcp_f64(double addrspace(1)* %out, double %src) nounwind {
|
|
|
|
%rcp = call double @llvm.AMDGPU.rcp.f64(double %src) nounwind readnone
|
|
|
|
store double %rcp, double addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}rcp_pat_f64:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI: v_rcp_f64_e32
|
2014-07-12 08:36:19 +08:00
|
|
|
define void @rcp_pat_f64(double addrspace(1)* %out, double %src) nounwind {
|
|
|
|
%rcp = fdiv double 1.0, %src
|
|
|
|
store double %rcp, double addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}rsq_rcp_pat_f64:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI-UNSAFE: v_rsq_f64_e32
|
|
|
|
; SI-SAFE-NOT: v_rsq_f64_e32
|
2015-02-14 12:30:08 +08:00
|
|
|
; SI-SAFE: v_sqrt_f64
|
|
|
|
; SI-SAFE: v_rcp_f64
|
2014-07-12 08:36:19 +08:00
|
|
|
define void @rsq_rcp_pat_f64(double addrspace(1)* %out, double %src) nounwind {
|
|
|
|
%sqrt = call double @llvm.sqrt.f64(double %src) nounwind readnone
|
|
|
|
%rcp = call double @llvm.AMDGPU.rcp.f64(double %sqrt) nounwind readnone
|
|
|
|
store double %rcp, double addrspace(1)* %out, align 8
|
|
|
|
ret void
|
|
|
|
}
|