summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2012-10-03 13:23:05 -0700
committerEric Anholt <[email protected]>2012-10-17 12:24:00 -0700
commit54679fcbcae7a2d41cb439e52e386bd811a291b4 (patch)
treee0bce67791fa46e6cf751e97653c8235249ae91b
parent7abfb67dc42ec3a96443ed025807267646c56e86 (diff)
i965: Share the predicate field between FS and VS.
Note that BRW_PREDICATE_NONE is 0 and BRW_PREDICATE_NORMAL is 1, so that's a lot like the true/false we had in the FS before. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_cfg.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp16
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_cse.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_emit.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_fp.cpp10
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp2
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp4
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp14
-rw-r--r--src/mesa/drivers/dri/i965/brw_shader.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h2
13 files changed, 32 insertions, 33 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_cfg.cpp b/src/mesa/drivers/dri/i965/brw_cfg.cpp
index 539cb084d4e..8382764ce34 100644
--- a/src/mesa/drivers/dri/i965/brw_cfg.cpp
+++ b/src/mesa/drivers/dri/i965/brw_cfg.cpp
@@ -171,7 +171,7 @@ cfg_t::cfg_t(fs_visitor *v)
next = new_block();
next->start = (fs_inst *)inst->next;
- if (inst->predicated)
+ if (inst->predicate)
cur->add_successor(mem_ctx, next);
set_next_block(next);
@@ -182,7 +182,7 @@ cfg_t::cfg_t(fs_visitor *v)
next = new_block();
next->start = (fs_inst *)inst->next;
- if (inst->predicated)
+ if (inst->predicate)
cur->add_successor(mem_ctx, next);
set_next_block(next);
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 42393106c72..56cb447fafe 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -141,7 +141,7 @@ fs_inst::equals(fs_inst *inst)
src[1].equals(inst->src[1]) &&
src[2].equals(inst->src[2]) &&
saturate == inst->saturate &&
- predicated == inst->predicated &&
+ predicate == inst->predicate &&
conditional_mod == inst->conditional_mod &&
mlen == inst->mlen &&
base_mrf == inst->base_mrf &&
@@ -736,7 +736,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
emit(FS_OPCODE_MOV_DISPATCH_TO_FLAGS, attr);
fs_inst *inst = emit_linterp(attr, fs_reg(interp),
interpolation_mode, false);
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
inst->predicate_inverse = true;
}
if (intel->gen < 6) {
@@ -1351,7 +1351,7 @@ fs_visitor::register_coalesce_2()
fs_inst *inst = (fs_inst *)node;
if (inst->opcode != BRW_OPCODE_MOV ||
- inst->predicated ||
+ inst->predicate ||
inst->saturate ||
inst->src[0].file != GRF ||
inst->src[0].negate ||
@@ -1431,7 +1431,7 @@ fs_visitor::register_coalesce()
continue;
if (inst->opcode != BRW_OPCODE_MOV ||
- inst->predicated ||
+ inst->predicate ||
inst->saturate ||
inst->dst.file != GRF || (inst->src[0].file != GRF &&
inst->src[0].file != UNIFORM)||
@@ -1532,7 +1532,7 @@ fs_visitor::compute_to_mrf()
next_ip++;
if (inst->opcode != BRW_OPCODE_MOV ||
- inst->predicated ||
+ inst->predicate ||
inst->dst.file != MRF || inst->src[0].file != GRF ||
inst->dst.type != inst->src[0].type ||
inst->src[0].abs || inst->src[0].negate || inst->src[0].smear != -1)
@@ -1581,7 +1581,7 @@ fs_visitor::compute_to_mrf()
* that writes that reg, but it would require smarter
* tracking to delay the rewriting until complete success.
*/
- if (scan_inst->predicated)
+ if (scan_inst->predicate)
break;
/* If it's half of register setup and not the same half as
@@ -1758,7 +1758,7 @@ fs_visitor::remove_duplicate_mrf_writes()
if (inst->opcode == BRW_OPCODE_MOV &&
inst->dst.file == MRF &&
inst->src[0].file == GRF &&
- !inst->predicated) {
+ !inst->predicate) {
last_mrf_move[inst->dst.reg] = inst;
}
}
@@ -1788,7 +1788,7 @@ fs_visitor::get_instruction_generating_reg(fs_inst *start,
fs_reg reg)
{
if (end == start ||
- end->predicated ||
+ end->predicate ||
end->force_uncompressed ||
end->force_sechalf ||
!reg.equals(end->dst)) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 87cbbe22538..392b6120f67 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -158,8 +158,6 @@ public:
fs_reg dst;
fs_reg src[3];
bool saturate;
- bool predicated;
- bool predicate_inverse;
int conditional_mod; /**< BRW_CONDITIONAL_* */
int mlen; /**< SEND message length */
diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 7ab1c5113aa..1275e697097 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -253,7 +253,7 @@ fs_visitor::opt_copy_propagate_local(void *mem_ctx, bblock_t *block)
inst->src[0].file == IMM) &&
inst->src[0].type == inst->dst.type &&
!inst->saturate &&
- !inst->predicated &&
+ !inst->predicate &&
!inst->force_uncompressed &&
!inst->force_sechalf &&
inst->src[0].smear == -1) {
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index a231868c0b9..49584334c0c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -92,7 +92,7 @@ fs_visitor::opt_cse_local(bblock_t *block, exec_list *aeb)
inst = (fs_inst *) inst->next) {
/* Skip some cases. */
- if (is_expression(inst) && !inst->predicated && inst->mlen == 0 &&
+ if (is_expression(inst) && !inst->predicate && inst->mlen == 0 &&
!inst->force_uncompressed && !inst->force_sechalf &&
!inst->conditional_mod)
{
diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index 55c36ca69a7..54e614fb1f4 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -803,7 +803,7 @@ fs_visitor::generate_code()
dst = brw_reg_from_fs_reg(&inst->dst);
brw_set_conditionalmod(p, inst->conditional_mod);
- brw_set_predicate_control(p, inst->predicated);
+ brw_set_predicate_control(p, inst->predicate);
brw_set_predicate_inverse(p, inst->predicate_inverse);
brw_set_saturate(p, inst->saturate);
diff --git a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
index 080435b5114..c0a88105e81 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_fp.cpp
@@ -93,7 +93,7 @@ fs_visitor::emit_fp_sop(uint32_t conditional_mod,
inst->conditional_mod = conditional_mod;
inst = emit(BRW_OPCODE_SEL, regoffset(dst, i), one, fs_reg(0.0f));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
}
}
@@ -177,7 +177,7 @@ fs_visitor::emit_fragment_program_code()
inst = emit(BRW_OPCODE_SEL, regoffset(dst, i),
regoffset(src[1], i), regoffset(src[2], i));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
}
break;
@@ -261,7 +261,7 @@ fs_visitor::emit_fragment_program_code()
inst->conditional_mod = BRW_CONDITIONAL_L;
inst = emit(BRW_OPCODE_IF);
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
emit(FS_OPCODE_DISCARD);
emit(BRW_OPCODE_ENDIF);
}
@@ -300,7 +300,7 @@ fs_visitor::emit_fragment_program_code()
if (fpi->DstReg.WriteMask & WRITEMASK_Y) {
emit(BRW_OPCODE_MOV, regoffset(dst, 1), regoffset(src[0], 0));
inst = emit(BRW_OPCODE_MOV, regoffset(dst, 1), fs_reg(0.0f));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
if (fpi->DstReg.WriteMask & WRITEMASK_Z) {
@@ -308,7 +308,7 @@ fs_visitor::emit_fragment_program_code()
regoffset(src[0], 1), regoffset(src[0], 3));
inst = emit(BRW_OPCODE_MOV, regoffset(dst, 2), fs_reg(0.0f));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
index f41d6332dd0..b0065145d1d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_live_variables.cpp
@@ -78,7 +78,7 @@ fs_live_variables::setup_def_use()
*/
if (inst->dst.file == GRF &&
inst->regs_written() == v->virtual_grf_sizes[inst->dst.reg] &&
- !inst->predicated &&
+ !inst->predicate &&
!inst->force_uncompressed &&
!inst->force_sechalf) {
int reg = inst->dst.reg;
diff --git a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
index 37c8917b339..5fb3db94ecc 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_reg_allocate.cpp
@@ -408,7 +408,7 @@ fs_visitor::spill_reg(int spill_reg)
* inst->regs_written(), then we need to unspill the destination
* since we write back out all of the regs_written().
*/
- if (inst->predicated || inst->force_uncompressed || inst->force_sechalf) {
+ if (inst->predicate || inst->force_uncompressed || inst->force_sechalf) {
fs_reg unspill_reg = inst->dst;
for (int chan = 0; chan < inst->regs_written(); chan++) {
emit_unspill(inst, unspill_reg,
diff --git a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
index c8eeb41f470..11e985880f5 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_schedule_instructions.cpp
@@ -298,7 +298,7 @@ instruction_scheduler::calculate_deps()
add_dep(last_mrf_write[inst->base_mrf + i], n);
}
- if (inst->predicated) {
+ if (inst->predicate) {
assert(last_conditional_mod);
add_dep(last_conditional_mod, n);
}
@@ -382,7 +382,7 @@ instruction_scheduler::calculate_deps()
add_dep(n, last_mrf_write[inst->base_mrf + i], 2);
}
- if (inst->predicated) {
+ if (inst->predicate) {
add_dep(n, last_conditional_mod);
}
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index e5f28b6aded..2dd212a8de8 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -191,7 +191,7 @@ fs_visitor::emit_minmax(uint32_t conditionalmod, fs_reg dst,
inst->conditional_mod = conditionalmod;
inst = emit(BRW_OPCODE_SEL, dst, src0, src1);
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
}
@@ -329,12 +329,12 @@ fs_visitor::visit(ir_expression *ir)
inst = emit(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f));
inst->conditional_mod = BRW_CONDITIONAL_G;
inst = emit(BRW_OPCODE_MOV, this->result, fs_reg(1.0f));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
inst = emit(BRW_OPCODE_CMP, reg_null_f, op[0], fs_reg(0.0f));
inst->conditional_mod = BRW_CONDITIONAL_L;
inst = emit(BRW_OPCODE_MOV, this->result, fs_reg(-1.0f));
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
break;
case ir_unop_rcp:
@@ -623,7 +623,7 @@ fs_visitor::emit_assignment_writes(fs_reg &l, fs_reg &r,
if (predicated || !l.equals(r)) {
fs_inst *inst = emit(BRW_OPCODE_MOV, l, r);
- inst->predicated = predicated;
+ inst->predicate = predicated ? BRW_PREDICATE_NORMAL : BRW_PREDICATE_NONE;
}
l.reg_offset++;
@@ -724,7 +724,7 @@ fs_visitor::visit(ir_assignment *ir)
if (ir->write_mask & (1 << i)) {
inst = emit(BRW_OPCODE_MOV, l, r);
if (ir->condition)
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
r.reg_offset++;
}
l.reg_offset++;
@@ -1673,7 +1673,7 @@ fs_visitor::visit(ir_if *ir)
emit_bool_to_cond_code(ir->condition);
inst = emit(BRW_OPCODE_IF);
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
foreach_list(node, &ir->then_instructions) {
@@ -1730,7 +1730,7 @@ fs_visitor::visit(ir_loop *ir)
inst->conditional_mod = brw_conditional_for_comparison(ir->cmp);
inst = emit(BRW_OPCODE_BREAK);
- inst->predicated = true;
+ inst->predicate = BRW_PREDICATE_NORMAL;
}
foreach_list(node, &ir->body_instructions) {
diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
index da2b7387f81..0abc6671134 100644
--- a/src/mesa/drivers/dri/i965/brw_shader.h
+++ b/src/mesa/drivers/dri/i965/brw_shader.h
@@ -30,6 +30,9 @@
class backend_instruction : public exec_node {
public:
enum opcode opcode; /* BRW_OPCODE_* or FS_OPCODE_* */
+
+ uint32_t predicate;
+ bool predicate_inverse;
};
class backend_visitor : public ir_visitor {
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index 8ab8431af53..bad6f20edda 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -171,8 +171,6 @@ public:
src_reg src[3];
bool saturate;
- bool predicate_inverse;
- uint32_t predicate;
int conditional_mod; /**< BRW_CONDITIONAL_* */