diff options
author | Marek Olšák <[email protected]> | 2017-08-19 22:00:02 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2017-08-22 13:29:47 +0200 |
commit | 3e2ff8fade879cedfdff0e180a6996df1223a823 (patch) | |
tree | c6601d72e5f5ba13264f7355fef41558ed65cbf3 /src/gallium/drivers | |
parent | 86e6f7a73bdbced24e10fb80fdcba591e0568120 (diff) |
gallium: remove TGSI opcode DPH
use DP4 or DP3 + ADD.
Reviewed-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/etnaviv/etnaviv_compiler.c | 28 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_fpc_optimize.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/i915/i915_fpc_translate.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 8 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/r300/r300_tgsi_to_rc.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/r600/r600_shader.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_insn.c | 36 | ||||
-rw-r--r-- | src/gallium/drivers/svga/svga_tgsi_vgpu10.c | 36 |
10 files changed, 3 insertions, 139 deletions
diff --git a/src/gallium/drivers/etnaviv/etnaviv_compiler.c b/src/gallium/drivers/etnaviv/etnaviv_compiler.c index 88f204cacaa..3ccb7373817 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_compiler.c +++ b/src/gallium/drivers/etnaviv/etnaviv_compiler.c @@ -1664,33 +1664,6 @@ trans_lg2(const struct instr_translater *t, struct etna_compile *c, } static void -trans_dph(const struct instr_translater *t, struct etna_compile *c, - const struct tgsi_full_instruction *inst, struct etna_inst_src *src) -{ - /* - DP3 tmp.xyzw, src0.xyzw, src1,xyzw, void - ADD dst.xyzw, tmp.xyzw, void, src1.wwww - */ - struct etna_native_reg temp = etna_compile_get_inner_temp(c); - struct etna_inst ins[2] = { }; - - ins[0].opcode = INST_OPCODE_DP3; - ins[0].dst = etna_native_to_dst(temp, INST_COMPS_X | INST_COMPS_Y | - INST_COMPS_Z | INST_COMPS_W); - ins[0].src[0] = src[0]; - ins[0].src[1] = src[1]; - - ins[1].opcode = INST_OPCODE_ADD; - ins[1].sat = inst->Instruction.Saturate; - ins[1].dst = convert_dst(c, &inst->Dst[0]); - ins[1].src[0] = etna_native_to_src(temp, INST_SWIZ_IDENTITY); - ins[1].src[2] = swizzle(src[1], SWIZZLE(W, W, W, W)); - - emit_inst(c, &ins[0]); - emit_inst(c, &ins[1]); -} - -static void trans_sampler(const struct instr_translater *t, struct etna_compile *c, const struct tgsi_full_instruction *inst, struct etna_inst_src *src) @@ -1833,7 +1806,6 @@ static const struct instr_translater translaters[TGSI_OPCODE_LAST] = { INSTR(LRP, trans_lrp), INSTR(LIT, trans_lit), INSTR(SSG, trans_ssg), - INSTR(DPH, trans_dph), INSTR(SIN, trans_trig), INSTR(COS, trans_trig), diff --git a/src/gallium/drivers/i915/i915_fpc_optimize.c b/src/gallium/drivers/i915/i915_fpc_optimize.c index 5f2a8760478..da06e16bf0e 100644 --- a/src/gallium/drivers/i915/i915_fpc_optimize.c +++ b/src/gallium/drivers/i915/i915_fpc_optimize.c @@ -85,7 +85,6 @@ static const struct { [ TGSI_OPCODE_DP2 ] = { false, true, TGSI_SWIZZLE_ONE, 1, 2 }, [ TGSI_OPCODE_DP3 ] = { false, true, TGSI_SWIZZLE_ONE, 1, 2 }, [ TGSI_OPCODE_DP4 ] = { false, true, TGSI_SWIZZLE_ONE, 1, 2 }, - [ TGSI_OPCODE_DPH ] = { false, false, 0, 1, 2 }, [ TGSI_OPCODE_DST ] = { false, false, 0, 1, 2 }, [ TGSI_OPCODE_END ] = { false, false, 0, 0, 0 }, [ TGSI_OPCODE_EX2 ] = { false, false, 0, 1, 1 }, diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 241c92dd28a..22a42eeeab4 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -604,17 +604,6 @@ i915_translate_instruction(struct i915_fp_compile *p, emit_simple_arith(p, inst, A0_DP4, 2, fs); break; - case TGSI_OPCODE_DPH: - src0 = src_vector(p, &inst->Src[0], fs); - src1 = src_vector(p, &inst->Src[1], fs); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->Dst[0]), - get_result_flags(inst), 0, - swizzle(src0, X, Y, Z, ONE), src1, 0); - break; - case TGSI_OPCODE_DST: src0 = src_vector(p, &inst->Src[0], fs); src1 = src_vector(p, &inst->Src[1], fs); diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp index 23c7d106e39..c06e74e2f81 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp @@ -277,7 +277,6 @@ unsigned int Instruction::srcMask(unsigned int s) const case TGSI_OPCODE_DP3: return 0x7; case TGSI_OPCODE_DP4: - case TGSI_OPCODE_DPH: case TGSI_OPCODE_KILL_IF: /* WriteMask ignored */ return 0xf; case TGSI_OPCODE_DST: @@ -3321,13 +3320,6 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn) FOR_EACH_DST_ENABLED_CHANNEL(0, c, tgsi) mkMov(dst0[c], val0); break; - case TGSI_OPCODE_DPH: - val0 = buildDot(3); - src1 = fetchSrc(1, 3); - mkOp2(OP_ADD, TYPE_F32, val0, val0, src1); - FOR_EACH_DST_ENABLED_CHANNEL(0, c, tgsi) - mkMov(dst0[c], val0); - break; case TGSI_OPCODE_DST: if (dst0[0]) loadImm(dst0[0], 1.0f); diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c index 278a8a4a430..a3ed5c6526b 100644 --- a/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c +++ b/src/gallium/drivers/nouveau/nv30/nvfx_fragprog.c @@ -591,11 +591,6 @@ nvfx_fragprog_parse_instruction(struct nvfx_fpc *fpc, case TGSI_OPCODE_DP4: nvfx_fp_emit(fpc, arith(sat, DP4, dst, mask, src[0], src[1], none)); break; - case TGSI_OPCODE_DPH: - tmp = nvfx_src(temp(fpc)); - nvfx_fp_emit(fpc, arith(0, DP3, tmp.reg, NVFX_FP_MASK_X, src[0], src[1], none)); - nvfx_fp_emit(fpc, arith(sat, ADD, dst, mask, swz(tmp, X, X, X, X), swz(src[1], W, W, W, W), none)); - break; case TGSI_OPCODE_DST: nvfx_fp_emit(fpc, arith(sat, DST, dst, mask, src[0], src[1], none)); break; diff --git a/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c b/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c index bec9975de9d..8ba3d5a0500 100644 --- a/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c +++ b/src/gallium/drivers/nouveau/nv30/nvfx_vertprog.c @@ -588,9 +588,6 @@ nvfx_vertprog_parse_instruction(struct nvfx_vpc *vpc, case TGSI_OPCODE_DP4: nvfx_vp_emit(vpc, arith(sat, VEC, DP4, dst, mask, src[0], src[1], none)); break; - case TGSI_OPCODE_DPH: - nvfx_vp_emit(vpc, arith(sat, VEC, DPH, dst, mask, src[0], src[1], none)); - break; case TGSI_OPCODE_DST: nvfx_vp_emit(vpc, arith(sat, VEC, DST, dst, mask, src[0], src[1], none)); break; diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index cc0ac4810e8..78af1242b4f 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -58,7 +58,6 @@ static unsigned translate_opcode(unsigned opcode) case TGSI_OPCODE_LG2: return RC_OPCODE_LG2; case TGSI_OPCODE_POW: return RC_OPCODE_POW; case TGSI_OPCODE_XPD: return RC_OPCODE_XPD; - case TGSI_OPCODE_DPH: return RC_OPCODE_DPH; case TGSI_OPCODE_COS: return RC_OPCODE_COS; case TGSI_OPCODE_DDX: return RC_OPCODE_DDX; case TGSI_OPCODE_DDY: return RC_OPCODE_DDY; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index d3728fb61de..fd76c93de88 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -6617,13 +6617,6 @@ static int tgsi_dp(struct r600_shader_ctx *ctx) alu.src[0].chan = alu.src[1].chan = 0; } break; - case TGSI_OPCODE_DPH: - if (i == 3) { - alu.src[0].sel = V_SQ_ALU_SRC_1; - alu.src[0].chan = 0; - alu.src[0].neg = 0; - } - break; default: break; } @@ -9103,7 +9096,7 @@ static const struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] [32] = { ALU_OP0_NOP, tgsi_unsupported}, [33] = { ALU_OP0_NOP, tgsi_unsupported}, [34] = { ALU_OP0_NOP, tgsi_unsupported}, - [TGSI_OPCODE_DPH] = { ALU_OP2_DOT4_IEEE, tgsi_dp}, + [35] = { ALU_OP0_NOP, tgsi_unsupported}, [TGSI_OPCODE_COS] = { ALU_OP1_COS, tgsi_trig}, [TGSI_OPCODE_DDX] = { FETCH_OP_GET_GRADIENTS_H, tgsi_tex}, [TGSI_OPCODE_DDY] = { FETCH_OP_GET_GRADIENTS_V, tgsi_tex}, @@ -9301,7 +9294,7 @@ static const struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = [32] = { ALU_OP0_NOP, tgsi_unsupported}, [33] = { ALU_OP0_NOP, tgsi_unsupported}, [34] = { ALU_OP0_NOP, tgsi_unsupported}, - [TGSI_OPCODE_DPH] = { ALU_OP2_DOT4_IEEE, tgsi_dp}, + [35] = { ALU_OP0_NOP, tgsi_unsupported}, [TGSI_OPCODE_COS] = { ALU_OP1_COS, tgsi_trig}, [TGSI_OPCODE_DDX] = { FETCH_OP_GET_GRADIENTS_H, tgsi_tex}, [TGSI_OPCODE_DDY] = { FETCH_OP_GET_GRADIENTS_V, tgsi_tex}, @@ -9524,7 +9517,7 @@ static const struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] = [32] = { ALU_OP0_NOP, tgsi_unsupported}, [33] = { ALU_OP0_NOP, tgsi_unsupported}, [34] = { ALU_OP0_NOP, tgsi_unsupported}, - [TGSI_OPCODE_DPH] = { ALU_OP2_DOT4_IEEE, tgsi_dp}, + [35] = { ALU_OP0_NOP, tgsi_unsupported}, [TGSI_OPCODE_COS] = { ALU_OP1_COS, cayman_trig}, [TGSI_OPCODE_DDX] = { FETCH_OP_GET_GRADIENTS_H, tgsi_tex}, [TGSI_OPCODE_DDY] = { FETCH_OP_GET_GRADIENTS_V, tgsi_tex}, diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index dd29f74a2a7..928330ce147 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -1237,39 +1237,6 @@ emit_dp2(struct svga_shader_emitter *emit, /** - * Translate the following TGSI DPH instruction. - * DPH DST, SRC1, SRC2 - * To the following SVGA3D instruction sequence. - * DP3 TMP, SRC1, SRC2 - * ADD DST, TMP, SRC2.wwww - */ -static boolean -emit_dph(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] ); - struct src_register src1 = - translate_src_register(emit, &insn->Src[1]); - SVGA3dShaderDestToken temp = get_temp( emit ); - - /* DP3 TMP, SRC1, SRC2 */ - if (!submit_op2( emit, inst_token( SVGA3DOP_DP3 ), temp, src0, src1 )) - return FALSE; - - src1 = scalar(src1, TGSI_SWIZZLE_W); - - /* ADD DST, TMP, SRC2.wwww */ - if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, - src( temp ), src1 )) - return FALSE; - - return TRUE; -} - - -/** * Sine / Cosine helper function. */ static boolean @@ -2924,9 +2891,6 @@ svga_emit_instruction(struct svga_shader_emitter *emit, case TGSI_OPCODE_DP2: return emit_dp2( emit, insn ); - case TGSI_OPCODE_DPH: - return emit_dph( emit, insn ); - case TGSI_OPCODE_COS: return emit_cos( emit, insn ); diff --git a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c index 56afd497d74..e57e78d11a5 100644 --- a/src/gallium/drivers/svga/svga_tgsi_vgpu10.c +++ b/src/gallium/drivers/svga/svga_tgsi_vgpu10.c @@ -3578,40 +3578,6 @@ emit_cmp(struct svga_shader_emitter_v10 *emit, /** - * Emit code for TGSI_OPCODE_DPH instruction. - */ -static boolean -emit_dph(struct svga_shader_emitter_v10 *emit, - const struct tgsi_full_instruction *inst) -{ - /* - * DP3 tmp, s0, s1 - * ADD dst, tmp, s1.wwww - */ - - struct tgsi_full_src_register s1_wwww = - swizzle_src(&inst->Src[1], TGSI_SWIZZLE_W, TGSI_SWIZZLE_W, - TGSI_SWIZZLE_W, TGSI_SWIZZLE_W); - - unsigned tmp = get_temp_index(emit); - struct tgsi_full_src_register tmp_src = make_src_temp_reg(tmp); - struct tgsi_full_dst_register tmp_dst = make_dst_temp_reg(tmp); - - /* DP3 tmp, s0, s1 */ - emit_instruction_op2(emit, VGPU10_OPCODE_DP3, &tmp_dst, &inst->Src[0], - &inst->Src[1], FALSE); - - /* ADD dst, tmp, s1.wwww */ - emit_instruction_op2(emit, VGPU10_OPCODE_ADD, &inst->Dst[0], &tmp_src, - &s1_wwww, inst->Instruction.Saturate); - - free_temp_indexes(emit); - - return TRUE; -} - - -/** * Emit code for TGSI_OPCODE_DST instruction. */ static boolean @@ -5712,8 +5678,6 @@ emit_vgpu10_instruction(struct svga_shader_emitter_v10 *emit, return emit_cmp(emit, inst); case TGSI_OPCODE_COS: return emit_sincos(emit, inst); - case TGSI_OPCODE_DPH: - return emit_dph(emit, inst); case TGSI_OPCODE_DST: return emit_dst(emit, inst); case TGSI_OPCODE_EX2: |