i965/fs: Add support for the MAC instruction.
authorJuha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Fri, 28 Mar 2014 13:28:32 +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_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_generator.cpp

index 075857f742561cc574bbc3129045d731884b7ab9..c550c412229cc64d0850c6ef98792505e0a78fa5 100644 (file)
@@ -196,6 +196,7 @@ ALU3(MAD)
 ALU2_ACC(ADDC)
 ALU2_ACC(SUBB)
 ALU2(SEL)
+ALU2(MAC)
 
 /** Gen4 predicated IF. */
 fs_inst *
index 1cf35b40ad22d0270ad6e744a6d7a99f631ee849..c6b4aae4087d370afcf27f416cf23ef43f8156e7 100644 (file)
@@ -1545,6 +1545,9 @@ fs_generator::generate_code(exec_list *instructions, FILE *dump_file)
          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);