[Mesa-dev] [PATCH 2/3] radv/ac: use shader umsb helper.

Gustaw Smolarczyk wielkiegie at gmail.com
Thu Feb 16 08:48:27 UTC 2017


I think you meant "shared" and not "shader" in the first line of the commit
message.

Gustaw

16 lut 2017 04:55 "Dave Airlie" <airlied at gmail.com> napisaƂ(a):

From: Dave Airlie <airlied at redhat.com>

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/common/ac_nir_to_llvm.c | 18 +-----------------
 1 file changed, 1 insertion(+), 17 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_
llvm.c
index b28812e..c1e838e 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -937,23 +937,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,
--
2.7.4

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170216/f3947651/attachment-0001.html>


More information about the mesa-dev mailing list