[Mesa-dev] [PATCH] radv/ac: Add integer->integer casts.

Edward O'Callaghan funfunctor at folklore1984.net
Sun Feb 26 01:43:35 UTC 2017


Acked-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 02/26/2017 12:39 PM, Bas Nieuwenhuizen wrote:
> Signed-off-by: Bas Nieuwenhuizen <basni at google.com>
> ---
>  src/amd/common/ac_nir_to_llvm.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 9778581a1ef..4f3d689db7e 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1476,6 +1476,24 @@ static void visit_alu(struct nir_to_llvm_context *ctx, nir_alu_instr *instr)
>  	case nir_op_d2f:
>  		result = LLVMBuildFPTrunc(ctx->builder, src[0], to_float_type(ctx, def_type), "");
>  		break;
> +	case nir_op_u2u32:
> +	case nir_op_u2u64:
> +	case nir_op_u2i32:
> +	case nir_op_u2i64:
> +		if (get_elem_bits(ctx, LLVMTypeOf(src[0])) < get_elem_bits(ctx, def_type))
> +			result = LLVMBuildZExt(ctx->builder, src[0], def_type, "");
> +		else
> +			result = LLVMBuildTrunc(ctx->builder, src[0], def_type, "");
> +		break;
> +	case nir_op_i2u32:
> +	case nir_op_i2u64:
> +	case nir_op_i2i32:
> +	case nir_op_i2i64:
> +		if (get_elem_bits(ctx, LLVMTypeOf(src[0])) < get_elem_bits(ctx, def_type))
> +			result = LLVMBuildSExt(ctx->builder, src[0], def_type, "");
> +		else
> +			result = LLVMBuildTrunc(ctx->builder, src[0], def_type, "");
> +		break;
>  	case nir_op_bcsel:
>  		result = emit_bcsel(ctx, src[0], src[1], src[2]);
>  		break;
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20170226/5059b37c/attachment.sig>


More information about the mesa-dev mailing list