From da676eab93e7dad30b574b4eb4cffd4df952e819 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Wed, 1 Aug 2012 22:52:52 +0200 Subject: [PATCH] r600g: Add support for predicates Signed-off-by: Tom Stellard --- src/gallium/drivers/r600/r600_asm.c | 12 +++++++----- src/gallium/drivers/r600/r600_asm.h | 4 +++- src/gallium/drivers/r600/r600_shader.c | 8 +++++--- src/gallium/drivers/r600/r700_asm.c | 5 +++-- 4 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c index 2341bec4412..0cca829f2ca 100644 --- a/src/gallium/drivers/r600/r600_asm.c +++ b/src/gallium/drivers/r600/r600_asm.c @@ -1424,7 +1424,7 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc, const struct r600_bytec if (bc->cf_last->inst == BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU) && type == BC_INST(bc, V_SQ_CF_ALU_WORD1_SQ_CF_INST_ALU_PUSH_BEFORE)) { LIST_FOR_EACH_ENTRY(lalu, &bc->cf_last->alu, list) { - if (lalu->predicate) { + if (lalu->execute_mask) { bc->force_add_cf = 1; break; } @@ -1755,6 +1755,7 @@ static int r600_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecod S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | S_SQ_ALU_WORD0_INDEX_MODE(alu->index_mode) | + S_SQ_ALU_WORD0_PRED_SEL(alu->pred_sel) | S_SQ_ALU_WORD0_LAST(alu->last); if (alu->is_op3) { @@ -1779,8 +1780,8 @@ static int r600_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecod S_SQ_ALU_WORD1_OP2_OMOD(alu->omod) | S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) | S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) | - S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) | - S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate); + S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->execute_mask) | + S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->update_pred); } return 0; } @@ -2467,6 +2468,7 @@ void r600_bytecode_dump(struct r600_bytecode *bc) fprintf(stderr, "CHAN:%d ", alu->src[1].chan); fprintf(stderr, "NEG:%d ", alu->src[1].neg); fprintf(stderr, "IM:%d) ", alu->index_mode); + fprintf(stderr, "PRED_SEL:%d ", alu->pred_sel); fprintf(stderr, "LAST:%d)\n", alu->last); id++; fprintf(stderr, "%04d %08X %c ", id, bc->bytecode[id], alu->last ? '*' : ' '); @@ -2486,8 +2488,8 @@ void r600_bytecode_dump(struct r600_bytecode *bc) fprintf(stderr, "SRC1_ABS:%d ", alu->src[1].abs); fprintf(stderr, "WRITE_MASK:%d ", alu->dst.write); fprintf(stderr, "OMOD:%d ", alu->omod); - fprintf(stderr, "EXECUTE_MASK:%d ", alu->predicate); - fprintf(stderr, "UPDATE_PRED:%d\n", alu->predicate); + fprintf(stderr, "EXECUTE_MASK:%d ", alu->execute_mask); + fprintf(stderr, "UPDATE_PRED:%d\n", alu->update_pred); } id++; diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h index a8a157b79e4..87e751adc78 100644 --- a/src/gallium/drivers/r600/r600_asm.h +++ b/src/gallium/drivers/r600/r600_asm.h @@ -53,7 +53,9 @@ struct r600_bytecode_alu { unsigned inst; unsigned last; unsigned is_op3; - unsigned predicate; + unsigned execute_mask; + unsigned update_pred; + unsigned pred_sel; unsigned bank_swizzle; unsigned bank_swizzle_force; unsigned omod; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ed95f4cdff3..dfaff832e76 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -310,7 +310,7 @@ static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx, alu.inst = inst0 | (inst1 << 8); alu.last = bytes[bytes_read++]; alu.is_op3 = bytes[bytes_read++]; - alu.predicate = bytes[bytes_read++]; + alu.pred_sel = bytes[bytes_read++]; alu.bank_swizzle = bytes[bytes_read++]; alu.bank_swizzle_force = bytes[bytes_read++]; alu.omod = bytes[bytes_read++]; @@ -330,7 +330,8 @@ static void llvm_if(struct r600_shader_ctx *ctx, struct r600_bytecode_alu * alu, unsigned pred_inst) { alu->inst = pred_inst; - alu->predicate = 1; + alu->execute_mask = 1; + alu->update_pred = 1; alu->dst.write = 0; alu->src[1].sel = V_SQ_ALU_SRC_0; alu->src[1].chan = 0; @@ -4854,7 +4855,8 @@ static int emit_logic_pred(struct r600_shader_ctx *ctx, int opcode) memset(&alu, 0, sizeof(struct r600_bytecode_alu)); alu.inst = opcode; - alu.predicate = 1; + alu.execute_mask = 1; + alu.update_pred = 1; alu.dst.sel = ctx->temp_reg; alu.dst.write = 1; diff --git a/src/gallium/drivers/r600/r700_asm.c b/src/gallium/drivers/r600/r700_asm.c index ffa179fbf82..ea37c63525f 100644 --- a/src/gallium/drivers/r600/r700_asm.c +++ b/src/gallium/drivers/r600/r700_asm.c @@ -43,6 +43,7 @@ int r700_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu * S_SQ_ALU_WORD0_SRC1_REL(alu->src[1].rel) | S_SQ_ALU_WORD0_SRC1_CHAN(alu->src[1].chan) | S_SQ_ALU_WORD0_SRC1_NEG(alu->src[1].neg) | + S_SQ_ALU_WORD0_PRED_SEL(alu->pred_sel) | S_SQ_ALU_WORD0_LAST(alu->last); /* don't replace gpr by pv or ps for destination register */ @@ -68,8 +69,8 @@ int r700_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu * S_SQ_ALU_WORD1_OP2_OMOD(alu->omod) | S_SQ_ALU_WORD1_OP2_ALU_INST(alu->inst) | S_SQ_ALU_WORD1_BANK_SWIZZLE(alu->bank_swizzle) | - S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->predicate) | - S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->predicate); + S_SQ_ALU_WORD1_OP2_UPDATE_EXECUTE_MASK(alu->execute_mask) | + S_SQ_ALU_WORD1_OP2_UPDATE_PRED(alu->update_pred); } return 0; } -- 2.30.2