diff options
author | Marek Olšák <[email protected]> | 2017-08-19 22:23:08 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-08-22 13:29:47 +0200 |
commit | 985e6b5ef91ec8de7ae5e03fcfb978ea6e8993ea (patch) | |
tree | dc0d1343692b0fd7889905db57dbe85c728554eb /src/gallium/drivers/svga | |
parent | 3e2ff8fade879cedfdff0e180a6996df1223a823 (diff) |
gallium: remove TGSI opcode XPD
use MUL+MAD+MOV instead.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers/svga')
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_insn.c | 61 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 113 |
2 files changed, 0 insertions, 174 deletions
diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 928330ce147..a325a567c18 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -2196,63 +2196,6 @@ emit_pow(struct svga_shader_emitter *emit, /** - * Translate/emit TGSI XPD (vector cross product) instruction. - */ -static boolean -emit_xpd(struct svga_shader_emitter *emit, - const struct tgsi_full_instruction *insn) -{ - SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); - const struct src_register src0 = translate_src_register( - emit, &insn->Src[0] ); - const struct src_register src1 = translate_src_register( - emit, &insn->Src[1] ); - boolean need_dst_tmp = FALSE; - - /* XPD can only output to a temporary */ - if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP) - need_dst_tmp = TRUE; - - /* The dst reg must not be the same as src0 or src1*/ - if (alias_src_dst(src0, dst) || - alias_src_dst(src1, dst)) - need_dst_tmp = TRUE; - - if (need_dst_tmp) { - SVGA3dShaderDestToken tmp = get_temp( emit ); - - /* Obey DX9 restrictions on mask: - */ - tmp.mask = dst.mask & TGSI_WRITEMASK_XYZ; - - if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), tmp, src0, src1)) - return FALSE; - - if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp ))) - return FALSE; - } - else { - if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), dst, src0, src1)) - return FALSE; - } - - /* Need to emit 1.0 to dst.w? - */ - if (dst.mask & TGSI_WRITEMASK_W) { - struct src_register one = get_one_immediate( emit ); - - if (!submit_op1(emit, - inst_token( SVGA3DOP_MOV ), - writemask(dst, TGSI_WRITEMASK_W), - one)) - return FALSE; - } - - return TRUE; -} - - -/** * Emit a LRP (linear interpolation) instruction. */ static boolean @@ -2986,9 +2929,6 @@ svga_emit_instruction(struct svga_shader_emitter *emit, case TGSI_OPCODE_BRK: return emit_brk( emit, insn ); - case TGSI_OPCODE_XPD: - return emit_xpd( emit, insn ); - case TGSI_OPCODE_KILL: return emit_kill( emit, insn ); @@ -3604,7 +3544,6 @@ needs_to_create_common_immediate(const struct svga_shader_emitter *emit) emit->info.opcode_count[TGSI_OPCODE_SEQ] >= 1 || emit->info.opcode_count[TGSI_OPCODE_EXP] >= 1 || emit->info.opcode_count[TGSI_OPCODE_LOG] >= 1 || - emit->info.opcode_count[TGSI_OPCODE_XPD] >= 1 || emit->info.opcode_count[TGSI_OPCODE_KILL] >= 1) return TRUE; diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index e57e78d11a5..9d86f72ea05 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -5210,117 +5210,6 @@ emit_txp(struct svga_shader_emitter_v10 *emit, } -/* - * Emit code for TGSI_OPCODE_XPD instruction. - */ -static boolean -emit_xpd(struct svga_shader_emitter_v10 *emit, - const struct tgsi_full_instruction *inst) -{ - /* dst.x = src0.y * src1.z - src1.y * src0.z - * dst.y = src0.z * src1.x - src1.z * src0.x - * dst.z = src0.x * src1.y - src1.x * src0.y - * dst.w = 1 - */ - struct tgsi_full_src_register s0_xxxx = - scalar_src(&inst->Src[0], TGSI_SWIZZLE_X); - struct tgsi_full_src_register s0_yyyy = - scalar_src(&inst->Src[0], TGSI_SWIZZLE_Y); - struct tgsi_full_src_register s0_zzzz = - scalar_src(&inst->Src[0], TGSI_SWIZZLE_Z); - - struct tgsi_full_src_register s1_xxxx = - scalar_src(&inst->Src[1], TGSI_SWIZZLE_X); - struct tgsi_full_src_register s1_yyyy = - scalar_src(&inst->Src[1], TGSI_SWIZZLE_Y); - struct tgsi_full_src_register s1_zzzz = - scalar_src(&inst->Src[1], TGSI_SWIZZLE_Z); - - unsigned tmp1 = get_temp_index(emit); - struct tgsi_full_src_register tmp1_src = make_src_temp_reg(tmp1); - struct tgsi_full_dst_register tmp1_dst = make_dst_temp_reg(tmp1); - - unsigned tmp2 = get_temp_index(emit); - struct tgsi_full_src_register tmp2_src = make_src_temp_reg(tmp2); - struct tgsi_full_dst_register tmp2_dst = make_dst_temp_reg(tmp2); - struct tgsi_full_src_register neg_tmp2_src = negate_src(&tmp2_src); - - unsigned tmp3 = get_temp_index(emit); - struct tgsi_full_src_register tmp3_src = make_src_temp_reg(tmp3); - struct tgsi_full_dst_register tmp3_dst = make_dst_temp_reg(tmp3); - struct tgsi_full_dst_register tmp3_dst_x = - writemask_dst(&tmp3_dst, TGSI_WRITEMASK_X); - struct tgsi_full_dst_register tmp3_dst_y = - writemask_dst(&tmp3_dst, TGSI_WRITEMASK_Y); - struct tgsi_full_dst_register tmp3_dst_z = - writemask_dst(&tmp3_dst, TGSI_WRITEMASK_Z); - struct tgsi_full_dst_register tmp3_dst_w = - writemask_dst(&tmp3_dst, TGSI_WRITEMASK_W); - - /* Note: we put all the intermediate computations into tmp3 in case - * the XPD dest register is that same as one of the src regs (in which - * case we could clobber a src reg before we're done with it) . - * - * Note: we could get by with just one temp register instead of three - * since we're doing scalar operations and there's enough room in one - * temp for everything. - */ - - /* MUL tmp1, src0.y, src1.z */ - /* MUL tmp2, src1.y, src0.z */ - /* ADD tmp3.x, tmp1, -tmp2 */ - if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_X) { - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp1_dst, - &s0_yyyy, &s1_zzzz, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp2_dst, - &s1_yyyy, &s0_zzzz, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_ADD, &tmp3_dst_x, - &tmp1_src, &neg_tmp2_src, FALSE); - } - - /* MUL tmp1, src0.z, src1.x */ - /* MUL tmp2, src1.z, src0.x */ - /* ADD tmp3.y, tmp1, -tmp2 */ - if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Y) { - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp1_dst, &s0_zzzz, - &s1_xxxx, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp2_dst, &s1_zzzz, - &s0_xxxx, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_ADD, &tmp3_dst_y, - &tmp1_src, &neg_tmp2_src, FALSE); - } - - /* MUL tmp1, src0.x, src1.y */ - /* MUL tmp2, src1.x, src0.y */ - /* ADD tmp3.z, tmp1, -tmp2 */ - if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_Z) { - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp1_dst, &s0_xxxx, - &s1_yyyy, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_MUL, &tmp2_dst, &s1_xxxx, - &s0_yyyy, FALSE); - emit_instruction_op2(emit, VGPU10_OPCODE_ADD, &tmp3_dst_z, - &tmp1_src, &neg_tmp2_src, FALSE); - } - - /* MOV tmp3.w, 1.0 */ - if (inst->Dst[0].Register.WriteMask & TGSI_WRITEMASK_W) { - struct tgsi_full_src_register one = - make_immediate_reg_float(emit, 1.0f); - - emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &tmp3_dst_w, &one, FALSE); - } - - /* MOV dst, tmp3 */ - emit_instruction_op1(emit, VGPU10_OPCODE_MOV, &inst->Dst[0], &tmp3_src, - inst->Instruction.Saturate); - - - free_temp_indexes(emit); - - return TRUE; -} - - /** * Emit code for TGSI_OPCODE_TXD (explicit derivatives) */ @@ -5742,8 +5631,6 @@ emit_vgpu10_instruction(struct svga_shader_emitter_v10 *emit, return emit_txq(emit, inst); case TGSI_OPCODE_UIF: return emit_if(emit, inst); - case TGSI_OPCODE_XPD: - return emit_xpd(emit, inst); case TGSI_OPCODE_UMUL_HI: case TGSI_OPCODE_IMUL_HI: case TGSI_OPCODE_UDIV: |