[Mesa-dev] [PATCH 17/21] i965/fs: Add W*W mul shortcut

Ben Widawsky benjamin.widawsky at intel.com
Mon Dec 22 19:29:27 PST 2014


If we have any case where both operands can fit in 16b, a plain old mul with no
mach should be sufficient.

Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
---
 src/mesa/drivers/dri/i965/brw_fs.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 30b4e67..7c43280 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -1662,6 +1662,11 @@ fs_visitor::emit_mul_dw(fs_reg dst, fs_reg src0, fs_reg src1,
    if (brw->gen >= 8) {
       emit(MUL(dst, src0, src1));
       return;
+   } else if ((src0_u16 && src1_u16)) {
+      fs_reg s0 = fs_reg(retype(src0, BRW_REGISTER_TYPE_UW));
+      fs_reg s1 = fs_reg(retype(src0, BRW_REGISTER_TYPE_UW));
+      emit(MUL(dst, s0, s1));
+      return;
    }
 
    /* For integer multiplication, the MUL uses the low 16 bits of one of the
-- 
2.2.1



More information about the mesa-dev mailing list