On Monday, January 19, 2015 03:31:07 PM Matt Turner wrote: > 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. > --- > src/mesa/drivers/dri/i965/brw_fs.cpp | 14 ++++++++++++++ > src/mesa/drivers/dri/i965/brw_fs.h | 1 + > 2 files changed, 15 insertions(+) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp > b/src/mesa/drivers/dri/i965/brw_fs.cpp > index 35639de..73d722e 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp > @@ -3605,6 +3605,18 @@ fs_visitor::optimize() > } >
Doxygen comments above functions are nice: /** * Three source instruction must have a GRF/MRF destination register. * ARF NULL is not allowed. Fix that up by allocating a temporary GRF. */ With that added, this gets Reviewed-by: Kenneth Graunke <kenn...@whitecape.org> (I think you could drop the comment in the function, but either way's fine) > 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()) { > + /* 3-src instructions can only have GRF/MRF destination. */ > + inst->dst = fs_reg(GRF, virtual_grf_alloc(dispatch_width / 8), > + inst->dst.type); > + } > + } > +} > + > +void > fs_visitor::allocate_registers() > { > bool allocated_without_spills; > @@ -3701,6 +3713,7 @@ fs_visitor::run_vs() > assign_curb_setup(); > assign_vs_urb_setup(); > > + fixup_3src_null_dest(); > allocate_registers(); > > return !failed; > @@ -3780,6 +3793,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 2aa58eb..9c125a6 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs.h > +++ b/src/mesa/drivers/dri/i965/brw_fs.h > @@ -423,6 +423,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(); >
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev