aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2016-04-25 17:35:52 -0700
committerFrancisco Jerez <[email protected]>2016-05-27 23:22:09 -0700
commit9dcb8ff6a11e7071ab660cf53194783b93c8b8bf (patch)
tree7d9f4249f97b1598ee1f7768845e71a2d4edf5f6 /src/mesa
parentbb89beb26bafb69e23a91e14c62b10f40c4790f8 (diff)
i965: Define brw_int_type() helper.
Intended as a (partial) inverse of type_sz(). Will be useful in the next commit and some other SIMD32 generator changes I have queued up. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_reg.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index b0ef94e96d0..bd7ea1ba7bc 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -305,6 +305,26 @@ type_sz(unsigned type)
}
/**
+ * Return an integer type of the requested size and signedness.
+ */
+static inline enum brw_reg_type
+brw_int_type(unsigned sz, bool is_signed)
+{
+ switch (sz) {
+ case 1:
+ return (is_signed ? BRW_REGISTER_TYPE_B : BRW_REGISTER_TYPE_UB);
+ case 2:
+ return (is_signed ? BRW_REGISTER_TYPE_W : BRW_REGISTER_TYPE_UW);
+ case 4:
+ return (is_signed ? BRW_REGISTER_TYPE_D : BRW_REGISTER_TYPE_UD);
+ case 8:
+ return (is_signed ? BRW_REGISTER_TYPE_Q : BRW_REGISTER_TYPE_UQ);
+ default:
+ unreachable("Not reached.");
+ }
+}
+
+/**
* Construct a brw_reg.
* \param file one of the BRW_x_REGISTER_FILE values
* \param nr register number/index