[Mesa-dev] [PATCH 3/3] i965: Emit MUL with a negated src for neg(mul(...)).

Ben Widawsky ben at bwidawsk.net
Thu Feb 26 11:04:11 PST 2015


On Mon, Feb 23, 2015 at 09:38:42AM -0800, Matt Turner wrote:
> On Sun, Feb 22, 2015 at 2:23 PM, Ben Widawsky <ben at bwidawsk.net> wrote:
> > On Wed, Feb 11, 2015 at 02:54:51PM -0800, Matt Turner wrote:
> >> total instructions in shared programs: 5932832 -> 5932736 (-0.00%)
> >> instructions in affected programs:     8184 -> 8088 (-1.17%)
> >> helped:                                52
> >> HURT:                                  14
> >> GAINED:                                1
> >> ---
> >>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   | 14 ++++++++++++++
> >>  src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 19 +++++++++++++++++++
> >>  2 files changed, 33 insertions(+)
> >>
> >> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> >> index b628bff..17849c7 100644
> >> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> >> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
> >> @@ -630,6 +630,20 @@ fs_visitor::visit(ir_expression *ir)
> >>
> >>     /* Deal with the real oddball stuff first */
> >>     switch (ir->operation) {
> >> +   case ir_unop_neg: {
> >> +      if (!ir->type->is_float())
> >> +         break;
> >> +
> >
> > Perhaps obvious to some, but why is this only for floats?
> 
> Good question -- that's because we have to emit the MUL/MACH sequence
> for integers and I didn't want to think about the argument ordering
> changes and things like that. I guess we could apply this to cases
> where we've got a 16-bit immediate, but I'm not sure it's worth it.

Reviewed-by: Ben Widawsky <ben at bwidawsk.net>


More information about the mesa-dev mailing list