[Mesa-dev] [PATCH 4/4] gallivm/tgsi: handle untyped moves
Roland Scheidegger
sroland at vmware.com
Tue Apr 9 18:17:06 PDT 2013
Am 10.04.2013 02:22, schrieb Zack Rusin:
> both mov and ucmp can be used to move variables of any type.
> correctly note that about ucmp in the tgsi_info and make
> sure gallivm can handle that by correctly casting the untyped
> moves.
>
> Signed-off-by: Zack Rusin <zackr at vmware.com>
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 8 ++++++++
> src/gallium/auxiliary/tgsi/tgsi_info.c | 1 +
> 2 files changed, 9 insertions(+)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 6cc72ff..9501100 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -1084,6 +1084,14 @@ emit_store_chan(
> break;
> }
>
> + /* If we're destination is untyped then the source can be anything,
The sentence doesn't parse.
> + * but LLVM won't like if the types don't match so lets cast
> + * to the correct destination type as expected by LLVM */
> + if (dtype == TGSI_TYPE_UNTYPED &&
> + !lp_check_vec_type(bld_store->type, LLVMTypeOf(value))) {
> + value = LLVMBuildBitCast(builder, value, bld_store->vec_type, "src_casted");
> + }
> +
> switch( inst->Instruction.Saturate ) {
> case TGSI_SAT_NONE:
> break;
> diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
> index 8ae5523..1fadfec 100644
> --- a/src/gallium/auxiliary/tgsi/tgsi_info.c
> +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
> @@ -327,6 +327,7 @@ tgsi_opcode_infer_dst_type( uint opcode )
> {
> switch (opcode) {
> case TGSI_OPCODE_MOV:
> + case TGSI_OPCODE_UCMP:
> return TGSI_TYPE_UNTYPED;
> case TGSI_OPCODE_F2U:
> case TGSI_OPCODE_AND:
>
Otherwise looks good.
Roland
More information about the mesa-dev
mailing list