[Mesa-dev] [PATCH v2] ac: fix f2b and i2b for doubles

Samuel Pitoiset samuel.pitoiset at gmail.com
Mon Feb 26 10:20:03 UTC 2018


Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 02/26/2018 10:14 AM, Timothy Arceri wrote:
> Without this llvm was asserting in debug builds.
> 
> V2: use LLVMConstNull()
> ---
>   src/amd/common/ac_nir_to_llvm.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index f37f19404e..789928761b 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1437,8 +1437,9 @@ static LLVMValueRef emit_f2b(struct ac_llvm_context *ctx,
>   			     LLVMValueRef src0)
>   {
>   	src0 = ac_to_float(ctx, src0);
> +	LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(src0));
>   	return LLVMBuildSExt(ctx->builder,
> -			     LLVMBuildFCmp(ctx->builder, LLVMRealUNE, src0, ctx->f32_0, ""),
> +			     LLVMBuildFCmp(ctx->builder, LLVMRealUNE, src0, zero, ""),
>   			     ctx->i32, "");
>   }
>   
> @@ -1457,8 +1458,9 @@ static LLVMValueRef emit_b2i(struct ac_llvm_context *ctx,
>   static LLVMValueRef emit_i2b(struct ac_llvm_context *ctx,
>   			     LLVMValueRef src0)
>   {
> +	LLVMValueRef zero = LLVMConstNull(LLVMTypeOf(src0));
>   	return LLVMBuildSExt(ctx->builder,
> -			     LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, ctx->i32_0, ""),
> +			     LLVMBuildICmp(ctx->builder, LLVMIntNE, src0, zero, ""),
>   			     ctx->i32, "");
>   }
>   
> 


More information about the mesa-dev mailing list