i965: Generate code for ir_binop_imul_high.
authorMatt Turner <mattst88@gmail.com>
Wed, 18 Sep 2013 04:34:45 +0000 (21:34 -0700)
committerMatt Turner <mattst88@gmail.com>
Mon, 7 Oct 2013 17:43:19 +0000 (10:43 -0700)
v2: Make accumulator's type match the type of the operation. Noticed by
    Ken.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 8cbe1c9bc99f83c3aca70e88bb19020b187be699..5024bed5cb20855e57d3901c2188ffb019c5de00 100644 (file)
@@ -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:
index 1ecd89875162efe40d4e15c003810498d088bc5d..15cfaa7e34a06244e23d2b74f387b001df4e0e03 100644 (file)
@@ -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());
index be160b9df747c72673d50c64443dac002d22252d..0cf8277e4d0fd6c0333b02060a0ae0fc7e5504bf 100644 (file)
@@ -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());