summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2017-07-26 16:56:10 -0700
committerMatt Turner <mattst88@gmail.com>2017-08-21 14:05:23 -0700
commit3e379af492f0f4c05061b8251e7cf18ed438056c (patch)
tree03d23f696ec451d8807460e331a489fa85fd97a1
parentc1ac1a3d257460c2706e91ff933679d7c8889294 (diff)
i965: Index brw_hw_reg_type_to_size()'s table by logical type
I'll be transitioning everything to use the logical types. Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
-rw-r--r--src/intel/compiler/brw_reg_type.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/src/intel/compiler/brw_reg_type.c b/src/intel/compiler/brw_reg_type.c
index 7dbff8f08f2..1ba8f35e642 100644
--- a/src/intel/compiler/brw_reg_type.c
+++ b/src/intel/compiler/brw_reg_type.c
@@ -104,43 +104,23 @@ brw_hw_reg_type_to_size(const struct gen_device_info *devinfo,
enum brw_reg_file file,
unsigned hw_type)
{
- if (file == BRW_IMMEDIATE_VALUE) {
- static const int hw_sizes[] = {
- [0 ... 15] = -1,
- [BRW_HW_IMM_TYPE_UD] = 4,
- [BRW_HW_IMM_TYPE_D] = 4,
- [BRW_HW_IMM_TYPE_UW] = 2,
- [BRW_HW_IMM_TYPE_W] = 2,
- [BRW_HW_IMM_TYPE_UV] = 2,
- [BRW_HW_IMM_TYPE_VF] = 4,
- [BRW_HW_IMM_TYPE_V] = 2,
- [BRW_HW_IMM_TYPE_F] = 4,
- [GEN8_HW_IMM_TYPE_UQ] = 8,
- [GEN8_HW_IMM_TYPE_Q] = 8,
- [GEN8_HW_IMM_TYPE_DF] = 8,
- [GEN8_HW_IMM_TYPE_HF] = 2,
- };
- assert(hw_type < ARRAY_SIZE(hw_sizes));
- assert(hw_sizes[hw_type] != -1);
- return hw_sizes[hw_type];
- } else {
- /* Non-immediate registers */
- static const int hw_sizes[] = {
- [0 ... 15] = -1,
- [BRW_HW_REG_TYPE_UD] = 4,
- [BRW_HW_REG_TYPE_D] = 4,
- [BRW_HW_REG_TYPE_UW] = 2,
- [BRW_HW_REG_TYPE_W] = 2,
- [BRW_HW_REG_TYPE_UB] = 1,
- [BRW_HW_REG_TYPE_B] = 1,
- [GEN7_HW_REG_TYPE_DF] = 8,
- [BRW_HW_REG_TYPE_F] = 4,
- [GEN8_HW_REG_TYPE_UQ] = 8,
- [GEN8_HW_REG_TYPE_Q] = 8,
- [GEN8_HW_REG_TYPE_HF] = 2,
- };
- assert(hw_type < ARRAY_SIZE(hw_sizes));
- assert(hw_sizes[hw_type] != -1);
- return hw_sizes[hw_type];
- }
+ static const unsigned type_size[] = {
+ [BRW_REGISTER_TYPE_DF] = 8,
+ [BRW_REGISTER_TYPE_F] = 4,
+ [BRW_REGISTER_TYPE_HF] = 2,
+ [BRW_REGISTER_TYPE_VF] = 4,
+
+ [BRW_REGISTER_TYPE_Q] = 8,
+ [BRW_REGISTER_TYPE_UQ] = 8,
+ [BRW_REGISTER_TYPE_D] = 4,
+ [BRW_REGISTER_TYPE_UD] = 4,
+ [BRW_REGISTER_TYPE_W] = 2,
+ [BRW_REGISTER_TYPE_UW] = 2,
+ [BRW_REGISTER_TYPE_B] = 1,
+ [BRW_REGISTER_TYPE_UB] = 1,
+ [BRW_REGISTER_TYPE_V] = 2,
+ [BRW_REGISTER_TYPE_UV] = 2,
+ };
+ enum brw_reg_type type = brw_hw_type_to_reg_type(devinfo, file, hw_type);
+ return type_size[type];
}