[Mesa-dev] [PATCH v2 20/41] ac/nir: make emit_b2i work on all bit sizes

Rhys Perry pendingchaos02 at gmail.com
Sat Feb 16 00:22:09 UTC 2019


v2: don't use ac_int_of_size()

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 e459001c1cf..75bb19031bf 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, LLVMIntTypeInContext(ctx->context, bitsize));
 }
 
 static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
-- 
2.20.1



More information about the mesa-dev mailing list