summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2013-09-17 21:34:45 -0700
committerMatt Turner <[email protected]>2013-10-07 10:43:19 -0700
commitc4e6569fc838d712253e355f32ee40671a86579e (patch)
treed517f58105ea2c9492c767da9d31a3a19682602d /src/mesa
parent85154241d63c3b984f001384767898b0742f9d02 (diff)
i965: Generate code for ir_binop_imul_high.
v2: Make accumulator's type match the type of the operation. Noticed by Ken. Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp1
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp10
-rw-r--r--src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp7
3 files changed, 18 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index 8cbe1c9bc99..5024bed5cb2 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -233,6 +233,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
case ir_binop_add:
case ir_binop_sub:
case ir_binop_mul:
+ case ir_binop_imul_high:
case ir_binop_div:
case ir_binop_carry:
case ir_binop_borrow:
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 1ecd8987516..15cfaa7e34a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -442,6 +442,16 @@ fs_visitor::visit(ir_expression *ir)
emit(MUL(this->result, op[0], op[1]));
}
break;
+ case ir_binop_imul_high: {
+ if (brw->gen >= 7 && dispatch_width == 16)
+ fail("16-wide explicit accumulator operands unsupported\n");
+
+ struct brw_reg acc = retype(brw_acc_reg(), this->result.type);
+
+ emit(MUL(acc, op[0], op[1]));
+ emit(MACH(this->result, op[0], op[1]));
+ break;
+ }
case ir_binop_div:
/* Floating point should be lowered by DIV_TO_MUL_RCP in the compiler. */
assert(ir->type->is_integer());
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index be160b9df74..0cf8277e4d0 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -1368,6 +1368,13 @@ vec4_visitor::visit(ir_expression *ir)
emit(MUL(result_dst, op[0], op[1]));
}
break;
+ case ir_binop_imul_high: {
+ struct brw_reg acc = retype(brw_acc_reg(), result_dst.type);
+
+ emit(MUL(acc, op[0], op[1]));
+ emit(MACH(result_dst, op[0], op[1]));
+ break;
+ }
case ir_binop_div:
/* Floating point should be lowered by DIV_TO_MUL_RCP in the compiler. */
assert(ir->type->is_integer());