[Mesa-dev] [PATCH 5/6] Get rid of tgsi_last_channel() wherever possible, rename lasti → last_chan
Constantine Charlamov
Hi-Angel at yandex.ru
Sun Feb 26 20:31:48 UTC 2017
From: Hi-Angel <Hi-Angel at yandex.ru>
The diff might be confusing: the assignment of last_chan and comparison with
last_chan are actually in different cycles.
Signed-off-by: Constantine Charlamov <Hi-Angel at yandex.ru>
---
src/gallium/drivers/r600/r600_shader.c | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 972e013aef..3616de572b 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -2673,7 +2673,7 @@ static int r600_store_tcs_output(struct r600_shader_ctx *ctx)
{
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
const struct tgsi_full_dst_register *dst = &inst->Dst[0];
- int chan_index, r, lasti;
+ int chan_index, r;
int temp_reg = r600_get_temp(ctx);
struct r600_bytecode_alu alu;
unsigned write_mask = dst->Register.WriteMask;
@@ -2692,8 +2692,7 @@ static int r600_store_tcs_output(struct r600_shader_ctx *ctx)
return r;
/* LDS write */
- lasti = tgsi_last_channel(write_mask);
- for (chan_index = 1; chan_index <= lasti; chan_index++) {
+ for (chan_index = 1; chan_index < TGSI_NUM_CHANNELS; chan_index++) {
if(!TGSI_IS_DST0_CHANNEL_ENABLED(inst, chan_index))
continue;
r = single_alu_op2(ctx, ALU_OP2_ADD_INT,
@@ -4277,10 +4276,11 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx)
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
int chan_index, j, k, r;
struct r600_bytecode_alu alu;
- int lasti = tgsi_last_channel(inst->Dst[0].Register.WriteMask);
+ int last_chan;
int t1 = ctx->temp_reg;
TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, k) {
+ last_chan = k;
TGSI_FOR_EACH_CHANNEL(chan_index) {
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ctx->inst_info->op;
@@ -4305,7 +4305,7 @@ static int cayman_mul_int_instr(struct r600_shader_ctx *ctx)
alu.src[0].chan = chan_index;
tgsi_dst(ctx, &inst->Dst[0], chan_index, &alu.dst);
alu.dst.write = 1;
- if (chan_index == lasti)
+ if (chan_index == last_chan)
alu.last = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
@@ -4321,7 +4321,7 @@ static int cayman_mul_double_instr(struct r600_shader_ctx *ctx)
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
int chan_index, j, k, r;
struct r600_bytecode_alu alu;
- int lasti = tgsi_last_channel(inst->Dst[0].Register.WriteMask);
+ int last_chan;
int t1 = ctx->temp_reg;
/* t1 would get overwritten below if we actually tried to
@@ -4332,6 +4332,8 @@ static int cayman_mul_double_instr(struct r600_shader_ctx *ctx)
k = inst->Dst[0].Register.WriteMask == TGSI_WRITEMASK_XY ? 0 : 1;
TGSI_FOR_EACH_CHANNEL (chan_index) {
+ if (TGSI_IS_DST0_CHANNEL_ENABLED(inst, chan_index))
+ last_chan = chan_index;
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
alu.op = ctx->inst_info->op;
for (j = 0; j < inst->Instruction.NumSrcRegs; j++) {
@@ -4354,7 +4356,7 @@ static int cayman_mul_double_instr(struct r600_shader_ctx *ctx)
alu.src[0].chan = chan_index;
tgsi_dst(ctx, &inst->Dst[0], chan_index, &alu.dst);
alu.dst.write = 1;
- if (chan_index == lasti)
+ if (chan_index == last_chan)
alu.last = 1;
r = r600_bytecode_add_alu(ctx->bc, &alu);
if (r)
@@ -8795,10 +8797,11 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
struct tgsi_full_instruction *inst = &ctx->parse.FullToken.FullInstruction;
struct r600_bytecode_alu alu;
int chan_index, j, k, r;
- int lasti = tgsi_last_channel(inst->Dst[0].Register.WriteMask);
+ int last_chan;
/* src0 * src1 */
TGSI_FOR_EACH_DST0_ENABLED_CHANNEL(inst, chan_index) {
+ last_chan = chan_index;
if (ctx->bc->chip_class == CAYMAN) {
for (j = 0 ; j < 4; j++) {
memset(&alu, 0, sizeof(struct r600_bytecode_alu));
@@ -8846,7 +8849,7 @@ static int tgsi_umad(struct r600_shader_ctx *ctx)
alu.src[0].chan = chan_index;
r600_bytecode_src(&alu.src[1], &ctx->src[2], chan_index);
- if (chan_index == lasti) {
+ if (chan_index == last_chan) {
alu.last = 1;
}
r = r600_bytecode_add_alu(ctx->bc, &alu);
--
2.11.1
More information about the mesa-dev
mailing list