Mesa (master): i965: Fix assertions about register types for INT DIV in brw_math.

Kenneth Graunke kwg at kemper.freedesktop.org
Sun Oct 2 17:02:36 PDT 2011


Module: Mesa
Branch: master
Commit: ee2bf3a4b6b37287e6d150d3dd6742b7fa4f8215
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ee2bf3a4b6b37287e6d150d3dd6742b7fa4f8215

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Wed Sep 28 17:37:51 2011 -0700

i965: Fix assertions about register types for INT DIV in brw_math.

BRW_MATH_FUNCTION_REMAINDER was missing.  Also, it seems worthwhile to
assert that INT DIV's arguments are signed/unsigned integers.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Tested-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_eu_emit.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c
index f9f8d49..52ed21b 100644
--- a/src/mesa/drivers/dri/i965/brw_eu_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c
@@ -1478,8 +1478,11 @@ void brw_math( struct brw_compile *p,
       assert(!src.negate);
       assert(!src.abs);
 
-      if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT &&
-	  function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+      if (function == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT ||
+	  function == BRW_MATH_FUNCTION_INT_DIV_REMAINDER ||
+	  function == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+	 assert(src.type != BRW_REGISTER_TYPE_F);
+      } else {
 	 assert(src.type == BRW_REGISTER_TYPE_F);
       }
 
@@ -1538,8 +1541,12 @@ void brw_math2(struct brw_compile *p,
    assert(src0.hstride == BRW_HORIZONTAL_STRIDE_1);
    assert(src1.hstride == BRW_HORIZONTAL_STRIDE_1);
 
-   if (function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT &&
-       function != BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+   if (function == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT ||
+       function == BRW_MATH_FUNCTION_INT_DIV_REMAINDER ||
+       function == BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER) {
+      assert(src0.type != BRW_REGISTER_TYPE_F);
+      assert(src1.type != BRW_REGISTER_TYPE_F);
+   } else {
       assert(src0.type == BRW_REGISTER_TYPE_F);
       assert(src1.type == BRW_REGISTER_TYPE_F);
    }



More information about the mesa-commit mailing list