ac/nir: fix 64-bit nir_op_f2f16_rtz
authorRhys Perry <pendingchaos02@gmail.com>
Thu, 6 Dec 2018 15:00:21 +0000 (15:00 +0000)
committerRhys Perry <pendingchaos02@gmail.com>
Tue, 19 Feb 2019 11:03:44 +0000 (11:03 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/common/ac_nir_to_llvm.c

index 9646a65df1e974d202612912475bc5d485b9a439..336346f60401bde1238d2a6b571167892fd9ae5e 100644 (file)
@@ -884,6 +884,8 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
                break;
        case nir_op_f2f16_rtz:
                src[0] = ac_to_float(&ctx->ac, src[0]);
+               if (LLVMTypeOf(src[0]) == ctx->ac.f64)
+                       src[0] = LLVMBuildFPTrunc(ctx->ac.builder, src[0], ctx->ac.f32, "");
                LLVMValueRef param[2] = { src[0], ctx->ac.f32_0 };
                result = ac_build_cvt_pkrtz_f16(&ctx->ac, param);
                result = LLVMBuildExtractElement(ctx->ac.builder, result, ctx->ac.i32_0, "");