summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2017-02-16 03:54:01 +0000
committerDave Airlie <[email protected]>2017-02-16 22:57:16 +0000
commitebed22ec675dd8feb96edc900cb720ef74845fff (patch)
treeadf65c66c7bee3e131684ffd79b8ef1e595be640
parent0ec66b99691ab8a09d2e16bd562b700a6624579e (diff)
radv/ac: use shared umsb helper.
Reviewed-by: Edward O'Callaghan <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/amd/common/ac_nir_to_llvm.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index d3c02ceb4a4..b3dc63c602d 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -936,23 +936,7 @@ static LLVMValueRef emit_ifind_msb(struct nir_to_llvm_context *ctx,
static LLVMValueRef emit_ufind_msb(struct nir_to_llvm_context *ctx,
LLVMValueRef src0)
{
- LLVMValueRef args[2] = {
- src0,
- ctx->i32one,
- };
- LLVMValueRef msb = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.ctlz.i32",
- ctx->i32, args, ARRAY_SIZE(args),
- AC_FUNC_ATTR_READNONE);
-
- /* The HW returns the last bit index from MSB, but NIR wants
- * the index from LSB. Invert it by doing "31 - msb". */
- msb = LLVMBuildSub(ctx->builder, LLVMConstInt(ctx->i32, 31, false),
- msb, "");
-
- return LLVMBuildSelect(ctx->builder,
- LLVMBuildICmp(ctx->builder, LLVMIntEQ, src0,
- ctx->i32zero, ""),
- LLVMConstInt(ctx->i32, -1, true), msb, "");
+ return ac_emit_umsb(&ctx->ac, src0, ctx->i32);
}
static LLVMValueRef emit_minmax_int(struct nir_to_llvm_context *ctx,