[Mesa-dev] [PATCH 6/9] gallivm: enable stores of integer types. (v2)
Jose Fonseca
jfonseca at vmware.com
Thu Feb 9 07:22:13 PST 2012
I think that we could probably just remove TGSI_TYPE_UNTYPED and just say MOV is TGSI_TYPE_FLOAT.
I'm OK either way.
Jose
----- Original Message -----
> From: Dave Airlie <airlied at redhat.com>
>
> Infer from the operand the type of value to store.
> MOV is untyped but we use the float store path.
>
> v2: make MOV use float store path.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 47
> +++++++++++++++++++++--
> 1 files changed, 43 insertions(+), 4 deletions(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> index 920fed2..e3f9463 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c
> @@ -855,7 +855,6 @@ emit_fetch_predicate(
> }
> }
>
> -
> /**
> * Register store.
> */
> @@ -875,8 +874,26 @@ emit_store_chan(
> struct lp_build_context *uint_bld = &bld_base->uint_bld;
> LLVMValueRef indirect_index = NULL;
> struct lp_build_context *bld_store;
> + enum tgsi_opcode_type dtype =
> tgsi_opcode_infer_dst_type(inst->Instruction.Opcode);
>
> - bld_store = &bld->bld_base.base;
> + switch (dtype) {
> + default:
> + case TGSI_TYPE_FLOAT:
> + case TGSI_TYPE_UNTYPED:
> + bld_store = &bld_base->base;
> + break;
> + case TGSI_TYPE_UNSIGNED:
> + bld_store = &bld_base->uint_bld;
> + break;
> + case TGSI_TYPE_SIGNED:
> + bld_store = &bld_base->int_bld;
> + break;
> + case TGSI_TYPE_DOUBLE:
> + case TGSI_TYPE_VOID:
> + assert(0);
> + bld_store = NULL;
> + break;
> + }
>
> switch( inst->Instruction.Saturate ) {
> case TGSI_SAT_NONE:
> @@ -986,8 +1003,30 @@ emit_store_chan(
> &bld->exec_mask, pred);
> }
> else {
> - LLVMValueRef temp_ptr = lp_get_temp_ptr_soa(bld,
> reg->Register.Index,
> - chan_index);
> + LLVMValueRef temp_ptr;
> +
> + switch (dtype) {
> + case TGSI_TYPE_UNSIGNED:
> + case TGSI_TYPE_SIGNED: {
> + LLVMTypeRef itype =
> LLVMVectorType(LLVMInt32TypeInContext(gallivm->context), 4);
> + LLVMTypeRef ivtype = LLVMPointerType(itype, 0);
> + LLVMValueRef tint_ptr = lp_get_temp_ptr_soa(bld,
> reg->Register.Index,
> + chan_index);
> + LLVMValueRef temp_value_ptr;
> +
> + temp_ptr = LLVMBuildBitCast(builder, tint_ptr, ivtype,
> "");
> + temp_value_ptr = LLVMBuildBitCast(builder, value, itype,
> "");
> + value = temp_value_ptr;
> + break;
> + }
> + default:
> + case TGSI_TYPE_FLOAT:
> + case TGSI_TYPE_UNTYPED:
> + temp_ptr = lp_get_temp_ptr_soa(bld, reg->Register.Index,
> + chan_index);
> + break;
> + }
> +
> lp_exec_mask_store(&bld->exec_mask, bld_store, pred, value,
> temp_ptr);
> }
> break;
> --
> 1.7.7.6
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list