Mesa (master): i965: Add helper function to find out the signedness of a register type.

Francisco Jerez currojerez at kemper.freedesktop.org
Wed Feb 19 15:57:29 UTC 2014


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

Author: Francisco Jerez <currojerez at riseup.net>
Date:   Sat Nov 23 12:08:00 2013 -0800

i965: Add helper function to find out the signedness of a register type.

Reviewed-by: Paul Berry <stereotype441 at gmail.com>

---

 src/mesa/drivers/dri/i965/brw_reg.h |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 143c5ce..f497366 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -182,6 +182,34 @@ type_sz(unsigned type)
    }
 }
 
+static inline bool
+type_is_signed(unsigned type)
+{
+   switch(type) {
+   case BRW_REGISTER_TYPE_D:
+   case BRW_REGISTER_TYPE_W:
+   case BRW_REGISTER_TYPE_F:
+   case BRW_REGISTER_TYPE_B:
+   case BRW_REGISTER_TYPE_V:
+   case BRW_REGISTER_TYPE_VF:
+   case BRW_REGISTER_TYPE_DF:
+   case BRW_REGISTER_TYPE_HF:
+   case BRW_REGISTER_TYPE_Q:
+      return true;
+
+   case BRW_REGISTER_TYPE_UD:
+   case BRW_REGISTER_TYPE_UW:
+   case BRW_REGISTER_TYPE_UB:
+   case BRW_REGISTER_TYPE_UV:
+   case BRW_REGISTER_TYPE_UQ:
+      return false;
+
+   default:
+      assert(!"Unreachable.");
+      return false;
+   }
+}
+
 /**
  * Construct a brw_reg.
  * \param file      one of the BRW_x_REGISTER_FILE values




More information about the mesa-commit mailing list