diff options
author | Samuel Pitoiset <[email protected]> | 2019-04-08 09:24:56 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-04-10 09:05:55 +0200 |
commit | bc6d486c78a43ab86aecf68e095620d72edc135e (patch) | |
tree | 17464308a92e52c69e46d5d25a54b2d01f7ccc53 /src/amd/common | |
parent | 1f063c0bfbc4451f2d7f08e3b4f6eb8b15007966 (diff) |
ac/nir: fix nir_op_b2f16
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 12 |
1 files 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 f2d527540d8..3d2f738edec 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, |