[Mesa-dev] [PATCH] ac: fix nir_op_f2f64
Nicolai Hähnle
nhaehnle at gmail.com
Tue Dec 12 09:33:39 UTC 2017
On 12.12.2017 06:13, Timothy Arceri wrote:
> Without this we get the error "FPExt only operates on FP" when
> converting the following:
>
> vec1 32 ssa_5 = b2f ssa_4
> vec1 64 ssa_6 = f2f64 ssa_5
>
> Which results in:
>
> %44 = and i32 %43, 1065353216
> %45 = fpext i32 %44 to double
>
> With this patch we now get:
>
> %44 = and i32 %43, 1065353216
> %45 = bitcast i32 %44 to float
> %46 = fpext float %45 to double
Yay for informative commit messages :)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
> ---
> src/amd/common/ac_nir_to_llvm.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index f5cf9d271d3..a1958b4332d 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1770,20 +1770,21 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr)
> case nir_op_i2f64:
> src[0] = ac_to_integer(&ctx->ac, src[0]);
> result = LLVMBuildSIToFP(ctx->ac.builder, src[0], ac_to_float_type(&ctx->ac, def_type), "");
> break;
> case nir_op_u2f32:
> case nir_op_u2f64:
> src[0] = ac_to_integer(&ctx->ac, src[0]);
> result = LLVMBuildUIToFP(ctx->ac.builder, src[0], ac_to_float_type(&ctx->ac, def_type), "");
> break;
> case nir_op_f2f64:
> + src[0] = ac_to_float(&ctx->ac, src[0]);
> result = LLVMBuildFPExt(ctx->ac.builder, src[0], ac_to_float_type(&ctx->ac, def_type), "");
> break;
> case nir_op_f2f32:
> result = LLVMBuildFPTrunc(ctx->ac.builder, src[0], ac_to_float_type(&ctx->ac, def_type), "");
> break;
> case nir_op_u2u32:
> case nir_op_u2u64:
> src[0] = ac_to_integer(&ctx->ac, src[0]);
> if (get_elem_bits(&ctx->ac, LLVMTypeOf(src[0])) < get_elem_bits(&ctx->ac, def_type))
> result = LLVMBuildZExt(ctx->ac.builder, src[0], def_type, "");
>
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
More information about the mesa-dev
mailing list