Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
 src/amd/common/ac_nir_to_llvm.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 2321fed69f3..d74693ddd68 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -344,10 +344,16 @@ static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx,
 {
        LLVMValueRef result = LLVMBuildAnd(ctx->builder, src0, ctx->i32_1, "");
 
-       if (bitsize == 32)
+       switch (bitsize) {
+       case 16:
+               return LLVMBuildTrunc(ctx->builder, result, ctx->i16, "");
+       case 32:
                return result;
-
-       return LLVMBuildZExt(ctx->builder, result, ctx->i64, "");
+       case 64:
+               return LLVMBuildZExt(ctx->builder, result, ctx->i64, "");
+       default:
+               unreachable("Unsupported bit size.");
+       }
 }
 
 static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
-- 
2.21.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to