i965/vec4: Add support for the MAC instruction.
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Fri, 28 Mar 2014 13:28:30 +0000 (15:28 +0200)
committerMatt Turner <mattst88@gmail.com>
Thu, 17 Apr 2014 05:46:45 +0000 (22:46 -0700)
This allows us to generate the MAC (multiply-accumulate) instruction,
which can be used to implement some expressions in fewer instructions
than doing a series of MUL and ADDs.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
src/mesa/drivers/dri/i965/brw_eu.h
src/mesa/drivers/dri/i965/brw_vec4_generator.cpp
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index 5df6bb7d499035690a6e6a738b127bccf79ad0f1..f10ad50e9c30cf6b5170a3a35a061c2654739bdc 100644 (file)
@@ -183,6 +183,7 @@ ALU1(FBL)
 ALU1(CBIT)
 ALU2(ADDC)
 ALU2(SUBB)
+ALU2(MAC)
 
 ROUND(RNDZ)
 ROUND(RNDE)
index 5f85d315c7120ade392e3afac6abc5cfbc32c002..bcacde92dd1b179a587252ff9d7c3973c7050b7b 100644 (file)
@@ -1081,6 +1081,9 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
       assert(brw->gen >= 7);
       brw_SUBB(p, dst, src[0], src[1]);
       break;
+   case BRW_OPCODE_MAC:
+      brw_MAC(p, dst, src[0], src[1]);
+      break;
 
    case BRW_OPCODE_BFE:
       assert(brw->gen >= 7);
index 3a764424df8f7c11fd61c055ac37a7074b56e05b..059dc73adcc5ae09a9c6db2782585939f58c498c 100644 (file)
@@ -175,6 +175,7 @@ ALU1(CBIT)
 ALU3(MAD)
 ALU2_ACC(ADDC)
 ALU2_ACC(SUBB)
+ALU2(MAC)
 
 /** Gen4 predicated IF. */
 vec4_instruction *