X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Fgallivm%2Flp_bld_tgsi.c;h=079a6eed4963f5a6046d368defac34ef347038ed;hb=1dca234daf1ef0a61fadc0ae0dadc599d3f8b7f0;hp=1ef6ae4268ae368552051bda7e02af6b3d8096fd;hpb=ace70aedcf8b29380a17f68a994b18f60976bca6;p=mesa.git diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c index 1ef6ae4268a..079a6eed496 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi.c @@ -201,8 +201,8 @@ void lp_build_fetch_args( static int get_src_chan_idx(unsigned opcode, int dst_chan_index) { - enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(opcode); - enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(opcode); + enum tgsi_opcode_type dtype = tgsi_opcode_infer_dst_type(opcode, 0); + enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(opcode, 0); if (!tgsi_type_is_64bit(dtype) && !tgsi_type_is_64bit(stype)) return dst_chan_index; @@ -251,9 +251,6 @@ lp_build_tgsi_inst_llvm( case TGSI_OPCODE_UP2US: case TGSI_OPCODE_UP4B: case TGSI_OPCODE_UP4UB: - case TGSI_OPCODE_PUSHA: - case TGSI_OPCODE_POPA: - case TGSI_OPCODE_SAD: /* deprecated? */ assert(0); return FALSE; @@ -267,11 +264,17 @@ lp_build_tgsi_inst_llvm( memset(&emit_data, 0, sizeof(emit_data)); - assert(info->num_dst <= 1); + assert(info->num_dst <= 2); if (info->num_dst) { TGSI_FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { emit_data.output[chan_index] = bld_base->base.undef; } + + if (info->num_dst >= 2) { + TGSI_FOR_EACH_DST1_ENABLED_CHANNEL( inst, chan_index ) { + emit_data.output1[chan_index] = bld_base->base.undef; + } + } } emit_data.inst = inst; @@ -312,27 +315,35 @@ lp_build_tgsi_inst_llvm( TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan_index) { emit_data.output[chan_index] = val; } + + if (info->num_dst >= 2) { + val = emit_data.output1[0]; + memset(emit_data.output1, 0, sizeof(emit_data.output1)); + TGSI_FOR_EACH_DST1_ENABLED_CHANNEL(inst, chan_index) { + emit_data.output1[chan_index] = val; + } + } } } if (info->num_dst > 0 && info->opcode != TGSI_OPCODE_STORE) { - bld_base->emit_store(bld_base, inst, info, emit_data.output); + bld_base->emit_store(bld_base, inst, info, 0, emit_data.output); + if (info->num_dst >= 2) + bld_base->emit_store(bld_base, inst, info, 1, emit_data.output1); } return TRUE; } LLVMValueRef -lp_build_emit_fetch( +lp_build_emit_fetch_src( struct lp_build_tgsi_context *bld_base, - const struct tgsi_full_instruction *inst, - unsigned src_op, + const struct tgsi_full_src_register *reg, + enum tgsi_opcode_type stype, const unsigned chan_index) { - const struct tgsi_full_src_register *reg = &inst->Src[src_op]; unsigned swizzle; LLVMValueRef res; - enum tgsi_opcode_type stype = tgsi_opcode_infer_src_type(inst->Instruction.Opcode); if (chan_index == LP_CHAN_ALL) { swizzle = ~0u; @@ -360,10 +371,12 @@ lp_build_emit_fetch( case TGSI_TYPE_DOUBLE: case TGSI_TYPE_UNTYPED: /* modifiers on movs assume data is float */ - res = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_ABS, res); + res = lp_build_abs(&bld_base->base, res); break; case TGSI_TYPE_UNSIGNED: case TGSI_TYPE_SIGNED: + case TGSI_TYPE_UNSIGNED64: + case TGSI_TYPE_SIGNED64: case TGSI_TYPE_VOID: default: /* abs modifier is only legal on floating point types */ @@ -387,6 +400,10 @@ lp_build_emit_fetch( case TGSI_TYPE_UNSIGNED: res = lp_build_negate( &bld_base->int_bld, res ); break; + case TGSI_TYPE_SIGNED64: + case TGSI_TYPE_UNSIGNED64: + res = lp_build_negate( &bld_base->int64_bld, res ); + break; case TGSI_TYPE_VOID: default: assert(0); @@ -407,7 +424,21 @@ lp_build_emit_fetch( } return res; +} + + +LLVMValueRef +lp_build_emit_fetch( + struct lp_build_tgsi_context *bld_base, + const struct tgsi_full_instruction *inst, + unsigned src_op, + const unsigned chan_index) +{ + const struct tgsi_full_src_register *reg = &inst->Src[src_op]; + enum tgsi_opcode_type stype = + tgsi_opcode_infer_src_type(inst->Instruction.Opcode, src_op); + return lp_build_emit_fetch_src(bld_base, reg, stype, chan_index); } @@ -512,11 +543,9 @@ lp_build_tgsi_llvm( while (bld_base->pc != -1) { const struct tgsi_full_instruction *instr = bld_base->instructions + bld_base->pc; - const struct tgsi_opcode_info *opcode_info = - tgsi_get_opcode_info(instr->Instruction.Opcode); if (!lp_build_tgsi_inst_llvm(bld_base, instr)) { _debug_printf("warning: failed to translate tgsi opcode %s to LLVM\n", - opcode_info->mnemonic); + tgsi_get_opcode_name(instr->Instruction.Opcode)); return FALSE; } }