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 <b...@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

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to