1 ; RUN: llc -march=r600 -mcpu=SI -verify-machineinstrs < %s | FileCheck -check-prefix=SI -check-prefix=FUNC %s 2 ; RUN: llc -march=r600 -mcpu=cypress -verify-machineinstrs < %s | FileCheck -check-prefix=EG -check-prefix=FUNC %s 3 4 declare float @llvm.AMDGPU.clamp.f32(float, float, float) nounwind readnone 5 declare float @llvm.AMDIL.clamp.f32(float, float, float) nounwind readnone 6 7 ; FUNC-LABEL: @clamp_0_1_f32 8 ; SI: S_LOAD_DWORD [[ARG:s[0-9]+]], 9 ; SI: V_ADD_F32_e64 [[RESULT:v[0-9]+]], [[ARG]], 0, 1, 0 10 ; SI: BUFFER_STORE_DWORD [[RESULT]] 11 ; SI: S_ENDPGM 12 13 ; EG: MOV_SAT 14 define void @clamp_0_1_f32(float addrspace(1)* %out, float %src) nounwind { 15 %clamp = call float @llvm.AMDGPU.clamp.f32(float %src, float 0.0, float 1.0) nounwind readnone 16 store float %clamp, float addrspace(1)* %out, align 4 17 ret void 18 } 19 20 ; FUNC-LABEL: @clamp_0_1_amdil_legacy_f32 21 ; SI: S_LOAD_DWORD [[ARG:s[0-9]+]], 22 ; SI: V_ADD_F32_e64 [[RESULT:v[0-9]+]], [[ARG]], 0, 1, 0 23 ; SI: BUFFER_STORE_DWORD [[RESULT]] 24 define void @clamp_0_1_amdil_legacy_f32(float addrspace(1)* %out, float %src) nounwind { 25 %clamp = call float @llvm.AMDIL.clamp.f32(float %src, float 0.0, float 1.0) nounwind readnone 26 store float %clamp, float addrspace(1)* %out, align 4 27 ret void 28 } 29