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-02-11 22:26:46 +08:00
|
|
|
; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=VI -check-prefix=FUNC %s
|
2014-06-25 06:13:39 +08:00
|
|
|
; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
|
|
|
|
2016-01-23 05:30:34 +08:00
|
|
|
; FIXME: Uses of this should be moved to llvm.amdgcn.rsq.clamped, and
|
|
|
|
; an r600 variant added.
|
2014-06-25 06:13:39 +08:00
|
|
|
|
|
|
|
declare float @llvm.AMDGPU.rsq.clamped.f32(float) nounwind readnone
|
|
|
|
|
2014-10-02 01:15:17 +08:00
|
|
|
; FUNC-LABEL: {{^}}rsq_clamped_f32:
|
2014-11-05 22:50:53 +08:00
|
|
|
; SI: v_rsq_clamp_f32_e32
|
2015-02-11 22:26:46 +08:00
|
|
|
|
|
|
|
; VI: v_rsq_f32_e32 [[RSQ:v[0-9]+]], {{s[0-9]+}}
|
|
|
|
; VI: v_min_f32_e32 [[MIN:v[0-9]+]], 0x7f7fffff, [[RSQ]]
|
|
|
|
; TODO: this constant should be folded:
|
|
|
|
; VI: v_mov_b32_e32 [[MINFLT:v[0-9]+]], 0xff7fffff
|
|
|
|
; VI: v_max_f32_e32 {{v[0-9]+}}, [[MIN]], [[MINFLT]]
|
|
|
|
|
2014-06-25 06:13:39 +08:00
|
|
|
; EG: RECIPSQRT_CLAMPED
|
2015-02-11 22:26:46 +08:00
|
|
|
|
2014-06-25 06:13:39 +08:00
|
|
|
define void @rsq_clamped_f32(float addrspace(1)* %out, float %src) nounwind {
|
|
|
|
%rsq_clamped = call float @llvm.AMDGPU.rsq.clamped.f32(float %src) nounwind readnone
|
|
|
|
store float %rsq_clamped, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|