summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-12-29 20:33:12 -0800
committerMatt Turner <[email protected]>2015-01-23 17:57:39 -0800
commiteed7223243c35bba092dc0b26e592f6af1ba3fd7 (patch)
treeffcc8c1e1d0bddddfdbefaee5fb48d60c6f1cc84
parent215b081c2ac5d7a9d1e6a46a52633997f8ae3576 (diff)
i965/fs: Add a pass to fixup 3-src instructions that have a null dest.
3-src instructions can only have GRF/MRF destinations. It's really difficult to deal with that restriction in dead code elimination (that wants to give instructions null destinations to show that their result isn't used) while allowing 3-src instructions to have conditional mod, so don't, and just give then a destination before register allocation. Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.cpp17
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs.h1
2 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 786e4e02d15..96be396cdd3 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -3606,6 +3606,21 @@ fs_visitor::optimize()
lower_uniform_pull_constant_loads();
}
+/**
+ * Three source instruction must have a GRF/MRF destination register.
+ * ARF NULL is not allowed. Fix that up by allocating a temporary GRF.
+ */
+void
+fs_visitor::fixup_3src_null_dest()
+{
+ foreach_block_and_inst_safe (block, fs_inst, inst, cfg) {
+ if (inst->is_3src() && inst->dst.is_null()) {
+ inst->dst = fs_reg(GRF, virtual_grf_alloc(dispatch_width / 8),
+ inst->dst.type);
+ }
+ }
+}
+
void
fs_visitor::allocate_registers()
{
@@ -3703,6 +3718,7 @@ fs_visitor::run_vs()
assign_curb_setup();
assign_vs_urb_setup();
+ fixup_3src_null_dest();
allocate_registers();
return !failed;
@@ -3781,6 +3797,7 @@ fs_visitor::run_fs()
assign_curb_setup();
assign_urb_setup();
+ fixup_3src_null_dest();
allocate_registers();
if (failed)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 419fe48f1aa..b0eb701888d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -424,6 +424,7 @@ public:
void setup_payload_gen4();
void setup_payload_gen6();
void setup_vs_payload();
+ void fixup_3src_null_dest();
void assign_curb_setup();
void calculate_urb_setup();
void assign_urb_setup();