i965: Fix assertions about register types for INT DIV in brw_math.
authorKenneth Graunke <kenneth@whitecape.org>
Thu, 29 Sep 2011 00:37:51 +0000 (17:37 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 3 Oct 2011 00:01:02 +0000 (17:01 -0700)
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@whitecape.org>
Tested-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_eu_emit.c

index f9f8d49a0d0b4f78b4430ef238e19069966990a3..52ed21b15beb59dc8ac7671095e23cc97ddafa11 100644 (file)
@@ -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);
    }