aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-01-30 18:24:20 -0800
committerMatt Turner <[email protected]>2015-02-10 17:48:15 -0800
commitfff0b2eab507527395d34c145b19cfa39dc0a44c (patch)
tree93089b8fc5954af0e7849181938db15d558e0cad /src/mesa
parent3d581f99963dea7e93a2f8fd819410da02c1cb7f (diff)
i965/vec4: Emit MADs from (x + abs(y * z)).
Same as commit 3654b6d4 to the fs backend. total instructions in shared programs: 5945788 -> 5945787 (-0.00%) instructions in affected programs: 36 -> 35 (-2.78%) helped: 1 Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 2a988d0a0c6..c4c134f3d27 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1161,8 +1161,11 @@ vec4_visitor::try_emit_mad(ir_expression *ir)
ir_rvalue *nonmul = ir->operands[1];
ir_expression *mul = ir->operands[0]->as_expression();
- bool mul_negate = false;
- if (mul && mul->operation == ir_unop_neg) {
+ bool mul_negate = false, mul_abs = false;
+ if (mul && mul->operation == ir_unop_abs) {
+ mul = mul->operands[0]->as_expression();
+ mul_abs = true;
+ } else if (mul && mul->operation == ir_unop_neg) {
mul = mul->operands[0]->as_expression();
mul_negate = true;
}
@@ -1171,7 +1174,10 @@ vec4_visitor::try_emit_mad(ir_expression *ir)
nonmul = ir->operands[0];
mul = ir->operands[1]->as_expression();
- if (mul && mul->operation == ir_unop_neg) {
+ if (mul && mul->operation == ir_unop_abs) {
+ mul = mul->operands[0]->as_expression();
+ mul_abs = true;
+ } else if (mul && mul->operation == ir_unop_neg) {
mul = mul->operands[0]->as_expression();
mul_negate = true;
}
@@ -1186,9 +1192,15 @@ vec4_visitor::try_emit_mad(ir_expression *ir)
mul->operands[0]->accept(this);
src_reg src1 = fix_3src_operand(this->result);
src1.negate ^= mul_negate;
+ src1.abs = mul_abs;
+ if (mul_abs)
+ src1.negate = false;
mul->operands[1]->accept(this);
src_reg src2 = fix_3src_operand(this->result);
+ src2.abs = mul_abs;
+ if (mul_abs)
+ src2.negate = false;
this->result = src_reg(this, ir->type);
emit(BRW_OPCODE_MAD, dst_reg(this->result), src0, src1, src2);