From 660b55e6d9aa704022476a50e264e56ecaa3fc2d Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Thu, 16 Feb 2017 22:41:16 +0100 Subject: radeonsi: stop using TGSI_OPCODE_CLAMP by moving it amd/common MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Dave Airlie Reviewed-by: Nicolai Hähnle --- src/amd/common/ac_llvm_build.c | 14 ++++++++++++++ src/amd/common/ac_llvm_build.h | 2 ++ 2 files changed, 16 insertions(+) (limited to 'src/amd/common') diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 9751a9329dd..351ff88306e 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -814,3 +814,17 @@ ac_emit_umsb(struct ac_llvm_context *ctx, LLVMConstInt(ctx->i32, 0, 0), ""), LLVMConstInt(ctx->i32, -1, true), msb, ""); } + +LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + const char *intr = HAVE_LLVM >= 0x0308 ? "llvm.AMDGPU.clamp." : + "llvm.AMDIL.clamp."; + LLVMValueRef args[3] = { + value, + LLVMConstReal(ctx->f32, 0), + LLVMConstReal(ctx->f32, 1), + }; + + return ac_emit_llvm_intrinsic(ctx, intr, ctx->f32, args, 3, + AC_FUNC_ATTR_READNONE); +} diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 3258e5ef54a..57bfdbdecd6 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -190,6 +190,8 @@ LLVMValueRef ac_emit_umsb(struct ac_llvm_context *ctx, LLVMValueRef arg, LLVMTypeRef dst_type); +LLVMValueRef ac_emit_clamp(struct ac_llvm_context *ctx, LLVMValueRef value); + #ifdef __cplusplus } #endif -- cgit v1.2.3