Dave, I really see no point of inferring anything when translating MOVs. The src/dst value will need to be converted from/to a floating point anyway so this is unnecessary complexity AFAICS. If you believe this is really necessary please provide a concrete example.
Jose ----- Original Message ----- > From: Dave Airlie <airl...@redhat.com> > > This infers the type of pointer to store to from the opcode, > for MOV instructions it infers it from the type of data its being > asked to store. > > Signed-off-by: Dave Airlie <airl...@redhat.com> > --- > src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c | 68 > ++++++++++++++++++++++- > 1 files changed, 65 insertions(+), 3 deletions(-) > > diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c > b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c > index 17c5d83..01b683a 100644 > --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c > +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_soa.c > @@ -843,6 +843,24 @@ emit_fetch_predicate( > } > > > +static struct lp_build_context *get_mov_type(struct > lp_build_tgsi_context *bld_base, > + LLVMValueRef value) > +{ > + LLVMTypeRef val_type = LLVMTypeOf(value); > + LLVMTypeKind kind_type; > + struct lp_build_context *bld_d; > + kind_type = LLVMGetTypeKind(val_type); > + if (kind_type == LLVMVectorTypeKind) { > + val_type = LLVMGetElementType(val_type); > + kind_type = LLVMGetTypeKind(val_type); > + if (kind_type == LLVMFloatTypeKind) > + bld_d = &bld_base->base; > + else if (kind_type == LLVMIntegerTypeKind) > + bld_d = &bld_base->uintbld; > + } > + return bld_d; > +} > + > /** > * Register store. > */ > @@ -862,8 +880,23 @@ emit_store_chan( > struct lp_build_context *uint_bld = &bld->uint_bld; > LLVMValueRef indirect_index = NULL; > struct lp_build_context *bld_store; > + enum util_format_type dtype = > tgsi_opcode_infer_dst_type(inst->Instruction.Opcode); > > - bld_store = &bld->bld_base.base; > + switch (dtype) { > + default: > + case UTIL_FORMAT_TYPE_FLOAT: > + bld_store = &bld_base->base; > + break; > + case UTIL_FORMAT_TYPE_UNSIGNED: > + bld_store = &bld_base->uintbld; > + break; > + case UTIL_FORMAT_TYPE_SIGNED: > + bld_store = &bld_base->intbld; > + break; > + case UTIL_FORMAT_TYPE_VOID: > + bld_store = get_mov_type(bld_base, value); > + break; > + } > > switch( inst->Instruction.Saturate ) { > case TGSI_SAT_NONE: > @@ -973,8 +1006,37 @@ 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 UTIL_FORMAT_TYPE_VOID: { > + LLVMTypeRef val_type = LLVMTypeOf(value); > + LLVMTypeRef ivtype = LLVMPointerType(val_type, 0); > + LLVMValueRef tint_ptr = lp_get_temp_ptr_soa(bld, > reg->Register.Index, > + chan_index); > + temp_ptr = LLVMBuildBitCast(builder, tint_ptr, ivtype, > ""); > + break; > + } > + case UTIL_FORMAT_TYPE_UNSIGNED: > + case UTIL_FORMAT_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 UTIL_FORMAT_TYPE_FLOAT: > + 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@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev