[Mesa-dev] [PATCH 1/2] ac/nir: fix nir_op_b2f16
Samuel Pitoiset
samuel.pitoiset at gmail.com
Mon Apr 8 07:24:56 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 6739551ca26..8510be5dfe6 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -322,10 +322,16 @@ static LLVMValueRef emit_b2f(struct ac_llvm_context *ctx,
"");
result = LLVMBuildBitCast(ctx->builder, result, ctx->f32, "");
- if (bitsize == 32)
+ switch (bitsize) {
+ case 16:
+ return LLVMBuildFPTrunc(ctx->builder, result, ctx->f16, "");
+ case 32:
return result;
-
- return LLVMBuildFPExt(ctx->builder, result, ctx->f64, "");
+ case 64:
+ return LLVMBuildFPExt(ctx->builder, result, ctx->f64, "");
+ default:
+ unreachable("Unsupported bit size.");
+ }
}
static LLVMValueRef emit_f2b(struct ac_llvm_context *ctx,
--
2.21.0
More information about the mesa-dev
mailing list