From 09747066714a341b85907c474f18a0d05bbc7071 Mon Sep 17 00:00:00 2001 From: Juha-Pekka Heikkila Date: Fri, 28 Mar 2014 15:28:30 +0200 Subject: [PATCH] i965/vec4: Add support for the MAC instruction. 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 Reviewed-by: Matt Turner Signed-off-by: Juha-Pekka Heikkila --- src/mesa/drivers/dri/i965/brw_eu.h | 1 + src/mesa/drivers/dri/i965/brw_vec4_generator.cpp | 3 +++ src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 5df6bb7d499..f10ad50e9c3 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -183,6 +183,7 @@ ALU1(FBL) ALU1(CBIT) ALU2(ADDC) ALU2(SUBB) +ALU2(MAC) ROUND(RNDZ) ROUND(RNDE) diff --git a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp index 5f85d315c71..bcacde92dd1 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_generator.cpp @@ -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); diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp index 3a764424df8..059dc73adcc 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp @@ -175,6 +175,7 @@ ALU1(CBIT) ALU3(MAD) ALU2_ACC(ADDC) ALU2_ACC(SUBB) +ALU2(MAC) /** Gen4 predicated IF. */ vec4_instruction * -- 2.30.2