[Mesa-dev] [PATCH 1/5] ac/nir: fix nir_op_b2i16
Samuel Pitoiset
samuel.pitoiset at gmail.com
Tue Mar 26 10:34:42 UTC 2019
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at 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
More information about the mesa-dev
mailing list