[Mesa-dev] [PATCH 18/38] ac/nir: make emit_b2i work on all bit sizes

Rhys Perry pendingchaos02 at gmail.com
Fri Dec 7 17:22:11 UTC 2018


Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 459d9c119c..517da7ba9b 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -347,11 +347,7 @@ static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx,
 			     unsigned bitsize)
 {
 	LLVMValueRef result = LLVMBuildAnd(ctx->builder, src0, ctx->i32_1, "");
-
-	if (bitsize == 32)
-		return result;
-
-	return LLVMBuildZExt(ctx->builder, result, ctx->i64, "");
+	return ac_build_ui_cast(ctx, result, ac_int_of_size(ctx, bitsize));
 }
 
 static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
-- 
2.19.2



More information about the mesa-dev mailing list