From: Eric Anholt Date: Wed, 12 Nov 2014 22:23:59 +0000 (-0800) Subject: gallium: Drop the unused CND opcode. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=365a4a3f9a80d1b7a6d030d2921578dfc5c899c6;p=mesa.git gallium: Drop the unused CND opcode. Nothing in the tree generates it. Reviewed-by: Jose Fonseca --- diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c index d0f1a7caf7f..9cb42b237b7 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_action.c @@ -1057,24 +1057,6 @@ ucmp_emit_cpu( cond, emit_data->args[1], emit_data->args[2]); } - -/* TGSI_OPCODE_CND (CPU Only) */ -static void -cnd_emit_cpu( - const struct lp_build_tgsi_action * action, - struct lp_build_tgsi_context * bld_base, - struct lp_build_emit_data * emit_data) -{ - LLVMValueRef half, tmp; - half = lp_build_const_vec(bld_base->base.gallivm, bld_base->base.type, 0.5); - tmp = lp_build_cmp(&bld_base->base, PIPE_FUNC_GREATER, - emit_data->args[2], half); - emit_data->output[emit_data->chan] = lp_build_select(&bld_base->base, - tmp, - emit_data->args[0], - emit_data->args[1]); -} - /* TGSI_OPCODE_COS (CPU Only) */ static void cos_emit_cpu( @@ -1821,7 +1803,6 @@ lp_set_default_actions_cpu( bld_base->op_actions[TGSI_OPCODE_ARL].emit = arl_emit_cpu; bld_base->op_actions[TGSI_OPCODE_ARR].emit = arr_emit_cpu; bld_base->op_actions[TGSI_OPCODE_CEIL].emit = ceil_emit_cpu; - bld_base->op_actions[TGSI_OPCODE_CND].emit = cnd_emit_cpu; bld_base->op_actions[TGSI_OPCODE_COS].emit = cos_emit_cpu; bld_base->op_actions[TGSI_OPCODE_CMP].emit = cmp_emit_cpu; bld_base->op_actions[TGSI_OPCODE_DIV].emit = div_emit_cpu; diff --git a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c index 9e468f91282..2ef5db1e69e 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_tgsi_aos.c @@ -620,15 +620,6 @@ lp_emit_instruction_aos( dst0 = lp_build_add(&bld->bld_base.base, tmp0, src2); break; - case TGSI_OPCODE_CND: - src0 = lp_build_emit_fetch(&bld->bld_base, inst, 0, LP_CHAN_ALL); - src1 = lp_build_emit_fetch(&bld->bld_base, inst, 1, LP_CHAN_ALL); - src2 = lp_build_emit_fetch(&bld->bld_base, inst, 2, LP_CHAN_ALL); - tmp1 = lp_build_const_vec(bld->bld_base.base.gallivm, bld->bld_base.base.type, 0.5); - tmp0 = lp_build_cmp(&bld->bld_base.base, PIPE_FUNC_GREATER, src2, tmp1); - dst0 = lp_build_select(&bld->bld_base.base, tmp0, src0, src1); - break; - case TGSI_OPCODE_DP2A: return FALSE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index ec1374aa876..834568b9104 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -136,18 +136,6 @@ micro_cmp(union tgsi_exec_channel *dst, dst->f[3] = src0->f[3] < 0.0f ? src1->f[3] : src2->f[3]; } -static void -micro_cnd(union tgsi_exec_channel *dst, - const union tgsi_exec_channel *src0, - const union tgsi_exec_channel *src1, - const union tgsi_exec_channel *src2) -{ - dst->f[0] = src2->f[0] > 0.5f ? src0->f[0] : src1->f[0]; - dst->f[1] = src2->f[1] > 0.5f ? src0->f[1] : src1->f[1]; - dst->f[2] = src2->f[2] > 0.5f ? src0->f[2] : src1->f[2]; - dst->f[3] = src2->f[3] > 0.5f ? src0->f[3] : src1->f[3]; -} - static void micro_cos(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) @@ -3603,10 +3591,6 @@ exec_instruction( exec_vector_trinary(mach, inst, micro_lrp, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; - case TGSI_OPCODE_CND: - exec_vector_trinary(mach, inst, micro_cnd, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); - break; - case TGSI_OPCODE_SQRT: exec_scalar_unary(mach, inst, micro_sqrt, TGSI_EXEC_DATA_FLOAT, TGSI_EXEC_DATA_FLOAT); break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 2ec2853ea44..c90d24c79de 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -56,7 +56,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 1, 3, 0, 0, 0, 0, COMP, "MAD", TGSI_OPCODE_MAD }, { 1, 2, 0, 0, 0, 0, COMP, "SUB", TGSI_OPCODE_SUB }, { 1, 3, 0, 0, 0, 0, COMP, "LRP", TGSI_OPCODE_LRP }, - { 1, 3, 0, 0, 0, 0, COMP, "CND", TGSI_OPCODE_CND }, + { 0, 0, 0, 0, 0, 0, NONE, "", 19 }, /* removed */ { 1, 1, 0, 0, 0, 0, REPL, "SQRT", TGSI_OPCODE_SQRT }, { 1, 3, 0, 0, 0, 0, REPL, "DP2A", TGSI_OPCODE_DP2A }, { 0, 0, 0, 0, 0, 0, NONE, "", 22 }, /* removed */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index b8bdba956e5..147d9894828 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -75,7 +75,6 @@ OP12(SGE) OP13(MAD) OP12(SUB) OP13(LRP) -OP13(CND) OP11(SQRT) OP13(DP2A) OP11(FRC) diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 66cb1674840..d572ff03d78 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -193,7 +193,6 @@ tgsi_util_get_inst_usage_mask(const struct tgsi_full_instruction *inst, case TGSI_OPCODE_MAD: case TGSI_OPCODE_SUB: case TGSI_OPCODE_LRP: - case TGSI_OPCODE_CND: case TGSI_OPCODE_FRC: case TGSI_OPCODE_CEIL: case TGSI_OPCODE_CLAMP: diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst index d4bf9ccaeec..3f29e326cd6 100644 --- a/src/gallium/docs/source/tgsi.rst +++ b/src/gallium/docs/source/tgsi.rst @@ -272,19 +272,6 @@ This instruction replicates its result. dst.w = src0.w \times src1.w + (1 - src0.w) \times src2.w -.. opcode:: CND - Condition - -.. math:: - - dst.x = (src2.x > 0.5) ? src0.x : src1.x - - dst.y = (src2.y > 0.5) ? src0.y : src1.y - - dst.z = (src2.z > 0.5) ? src0.z : src1.z - - dst.w = (src2.w > 0.5) ? src0.w : src1.w - - .. opcode:: DP2A - 2-component Dot Product And Add .. math:: diff --git a/src/gallium/drivers/ilo/shader/toy_tgsi.c b/src/gallium/drivers/ilo/shader/toy_tgsi.c index 5938de48598..57501eac337 100644 --- a/src/gallium/drivers/ilo/shader/toy_tgsi.c +++ b/src/gallium/drivers/ilo/shader/toy_tgsi.c @@ -568,21 +568,6 @@ aos_LRP(struct toy_compiler *tc, tc_MAC(tc, dst[0], src[0], src[1], tsrc_from(tmp)); } -static void -aos_CND(struct toy_compiler *tc, - const struct tgsi_full_instruction *tgsi_inst, - struct toy_dst *dst, - struct toy_src *src) -{ - struct toy_inst *inst; - - assert(!"CND untested"); - - tc_CMP(tc, tdst_null(), src[2], tsrc_imm_f(0.5f), GEN6_COND_G); - inst = tc_SEL(tc, dst[0], src[0], src[1], GEN6_COND_NONE); - inst->pred_ctrl = GEN6_PREDCTRL_NORMAL; -} - static void aos_DP2A(struct toy_compiler *tc, const struct tgsi_full_instruction *tgsi_inst, @@ -795,7 +780,6 @@ static const toy_tgsi_translate aos_translate_table[TGSI_OPCODE_LAST] = { [TGSI_OPCODE_MAD] = aos_simple, [TGSI_OPCODE_SUB] = aos_simple, [TGSI_OPCODE_LRP] = aos_LRP, - [TGSI_OPCODE_CND] = aos_CND, [TGSI_OPCODE_SQRT] = aos_simple, [TGSI_OPCODE_DP2A] = aos_DP2A, [TGSI_OPCODE_FRC] = aos_simple, @@ -1339,7 +1323,6 @@ static const toy_tgsi_translate soa_translate_table[TGSI_OPCODE_LAST] = { [TGSI_OPCODE_MAD] = soa_per_channel, [TGSI_OPCODE_SUB] = soa_per_channel, [TGSI_OPCODE_LRP] = soa_per_channel, - [TGSI_OPCODE_CND] = soa_per_channel, [TGSI_OPCODE_SQRT] = soa_scalar_replicate, [TGSI_OPCODE_DP2A] = soa_dot_product, [TGSI_OPCODE_FRC] = soa_per_channel, diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index a7a741e6abf..b82cb3e2684 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -51,7 +51,6 @@ static unsigned translate_opcode(unsigned opcode) case TGSI_OPCODE_MAD: return RC_OPCODE_MAD; case TGSI_OPCODE_SUB: return RC_OPCODE_SUB; case TGSI_OPCODE_LRP: return RC_OPCODE_LRP; - case TGSI_OPCODE_CND: return RC_OPCODE_CND; /* case TGSI_OPCODE_DP2A: return RC_OPCODE_DP2A; */ case TGSI_OPCODE_FRC: return RC_OPCODE_FRC; case TGSI_OPCODE_CLAMP: return RC_OPCODE_CLAMP; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 2e74d5963d4..7a2609a2c1d 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -7207,7 +7207,7 @@ static struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[] = { {TGSI_OPCODE_MAD, 1, ALU_OP3_MULADD, tgsi_op3}, {TGSI_OPCODE_SUB, 0, ALU_OP2_ADD, tgsi_op2}, {TGSI_OPCODE_LRP, 0, ALU_OP0_NOP, tgsi_lrp}, - {TGSI_OPCODE_CND, 0, ALU_OP0_NOP, tgsi_unsupported}, + {19, 0, ALU_OP0_NOP, tgsi_unsupported}, {TGSI_OPCODE_SQRT, 0, ALU_OP1_SQRT_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_DP2A, 0, ALU_OP0_NOP, tgsi_unsupported}, {22, 0, ALU_OP0_NOP, tgsi_unsupported}, @@ -7406,7 +7406,7 @@ static struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] = { {TGSI_OPCODE_MAD, 1, ALU_OP3_MULADD, tgsi_op3}, {TGSI_OPCODE_SUB, 0, ALU_OP2_ADD, tgsi_op2}, {TGSI_OPCODE_LRP, 0, ALU_OP0_NOP, tgsi_lrp}, - {TGSI_OPCODE_CND, 0, ALU_OP0_NOP, tgsi_unsupported}, + {19, 0, ALU_OP0_NOP, tgsi_unsupported}, {TGSI_OPCODE_SQRT, 0, ALU_OP1_SQRT_IEEE, tgsi_trans_srcx_replicate}, {TGSI_OPCODE_DP2A, 0, ALU_OP0_NOP, tgsi_unsupported}, {22, 0, ALU_OP0_NOP, tgsi_unsupported}, @@ -7605,7 +7605,7 @@ static struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] = { {TGSI_OPCODE_MAD, 1, ALU_OP3_MULADD, tgsi_op3}, {TGSI_OPCODE_SUB, 0, ALU_OP2_ADD, tgsi_op2}, {TGSI_OPCODE_LRP, 0, ALU_OP0_NOP, tgsi_lrp}, - {TGSI_OPCODE_CND, 0, ALU_OP0_NOP, tgsi_unsupported}, + {19, 0, ALU_OP0_NOP, tgsi_unsupported}, {TGSI_OPCODE_SQRT, 0, ALU_OP1_SQRT_IEEE, cayman_emit_float_instr}, {TGSI_OPCODE_DP2A, 0, ALU_OP0_NOP, tgsi_unsupported}, {22, 0, ALU_OP0_NOP, tgsi_unsupported}, diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 52a4216e51b..98f0670f592 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -303,7 +303,7 @@ struct tgsi_property_data { #define TGSI_OPCODE_MAD 16 #define TGSI_OPCODE_SUB 17 #define TGSI_OPCODE_LRP 18 -#define TGSI_OPCODE_CND 19 + /* gap */ #define TGSI_OPCODE_SQRT 20 #define TGSI_OPCODE_DP2A 21 /* gap */