aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2014-04-28 10:30:50 -0700
committerMatt Turner <[email protected]>2014-04-30 11:41:29 -0700
commit9565392031d96e21ebe21dbf7f2ef55958c674db (patch)
tree11b24ca35fa2c06b618f7d0bee00bfab0c411da5 /src
parent1e50bc9ee170b6a4c212c4fd8e019beb43a99603 (diff)
i965/vec4: Remove 'mul_arg' from try_emit_mad().
Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.h b/src/mesa/drivers/dri/i965/brw_vec4.h
index b3549a5c845..ebe707f147d 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.h
+++ b/src/mesa/drivers/dri/i965/brw_vec4.h
@@ -591,7 +591,7 @@ public:
int base_offset);
bool try_emit_sat(ir_expression *ir);
- bool try_emit_mad(ir_expression *ir, int mul_arg);
+ bool try_emit_mad(ir_expression *ir);
void resolve_ud_negate(src_reg *reg);
src_reg get_timestamp();
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 8fa0aee996b..7bad81c476e 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1090,7 +1090,7 @@ vec4_visitor::try_emit_sat(ir_expression *ir)
}
bool
-vec4_visitor::try_emit_mad(ir_expression *ir, int mul_arg)
+vec4_visitor::try_emit_mad(ir_expression *ir)
{
/* 3-src instructions were introduced in gen6. */
if (brw->gen < 6)
@@ -1100,11 +1100,16 @@ vec4_visitor::try_emit_mad(ir_expression *ir, int mul_arg)
if (ir->type->base_type != GLSL_TYPE_FLOAT)
return false;
- ir_rvalue *nonmul = ir->operands[1 - mul_arg];
- ir_expression *mul = ir->operands[mul_arg]->as_expression();
+ ir_rvalue *nonmul = ir->operands[1];
+ ir_expression *mul = ir->operands[0]->as_expression();
- if (!mul || mul->operation != ir_binop_mul)
- return false;
+ if (!mul || mul->operation != ir_binop_mul) {
+ nonmul = ir->operands[0];
+ mul = ir->operands[1]->as_expression();
+
+ if (!mul || mul->operation != ir_binop_mul)
+ return false;
+ }
nonmul->accept(this);
src_reg src0 = fix_3src_operand(this->result);
@@ -1189,7 +1194,7 @@ vec4_visitor::visit(ir_expression *ir)
return;
if (ir->operation == ir_binop_add) {
- if (try_emit_mad(ir, 0) || try_emit_mad(ir, 1))
+ if (try_emit_mad(ir))
return;
}