2014-09-30 19:49:48 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -strict-whitespace -check-prefix=SI -check-prefix=FUNC %s
|
2014-06-19 04:24:43 +00:00
|
|
|
; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s
|
|
|
|
|
|
|
|
declare float @llvm.AMDGPU.clamp.f32(float, float, float) nounwind readnone
|
|
|
|
declare float @llvm.AMDIL.clamp.f32(float, float, float) nounwind readnone
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}clamp_0_1_f32:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: s_load_dword [[ARG:s[0-9]+]],
|
|
|
|
; SI: v_add_f32_e64 [[RESULT:v[0-9]+]], 0, [[ARG]] clamp{{$}}
|
|
|
|
; SI: buffer_store_dword [[RESULT]]
|
|
|
|
; SI: s_endpgm
|
2014-06-19 04:24:43 +00:00
|
|
|
|
|
|
|
; EG: MOV_SAT
|
|
|
|
define void @clamp_0_1_f32(float addrspace(1)* %out, float %src) nounwind {
|
|
|
|
%clamp = call float @llvm.AMDGPU.clamp.f32(float %src, float 0.0, float 1.0) nounwind readnone
|
|
|
|
store float %clamp, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2014-10-01 17:15:17 +00:00
|
|
|
; FUNC-LABEL: {{^}}clamp_0_1_amdil_legacy_f32:
|
2014-11-05 14:50:53 +00:00
|
|
|
; SI: s_load_dword [[ARG:s[0-9]+]],
|
|
|
|
; SI: v_add_f32_e64 [[RESULT:v[0-9]+]], 0, [[ARG]] clamp{{$}}
|
|
|
|
; SI: buffer_store_dword [[RESULT]]
|
2014-06-19 04:24:43 +00:00
|
|
|
define void @clamp_0_1_amdil_legacy_f32(float addrspace(1)* %out, float %src) nounwind {
|
|
|
|
%clamp = call float @llvm.AMDIL.clamp.f32(float %src, float 0.0, float 1.0) nounwind readnone
|
|
|
|
store float %clamp, float addrspace(1)* %out, align 4
|
|
|
|
ret void
|
|
|
|
}
|