[Mesa-dev] [PATCH] intel/compiler: fix regs_equal for 64-bit integers
Iago Toral Quiroga
itoral at igalia.com
Mon Nov 26 13:09:06 UTC 2018
---
src/intel/compiler/brw_reg.h | 59 ++++++++++++++++++------------------
1 file changed, 29 insertions(+), 30 deletions(-)
diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h
index 46d66198a1..860c18e475 100644
--- a/src/intel/compiler/brw_reg.h
+++ b/src/intel/compiler/brw_reg.h
@@ -248,11 +248,38 @@ struct brw_reg {
};
};
+static inline unsigned
+type_sz(unsigned type)
+{
+ switch(type) {
+ case BRW_REGISTER_TYPE_UQ:
+ case BRW_REGISTER_TYPE_Q:
+ case BRW_REGISTER_TYPE_DF:
+ return 8;
+ case BRW_REGISTER_TYPE_UD:
+ case BRW_REGISTER_TYPE_D:
+ case BRW_REGISTER_TYPE_F:
+ case BRW_REGISTER_TYPE_VF:
+ return 4;
+ case BRW_REGISTER_TYPE_UW:
+ case BRW_REGISTER_TYPE_W:
+ case BRW_REGISTER_TYPE_UV:
+ case BRW_REGISTER_TYPE_V:
+ case BRW_REGISTER_TYPE_HF:
+ return 2;
+ case BRW_REGISTER_TYPE_UB:
+ case BRW_REGISTER_TYPE_B:
+ return 1;
+ default:
+ unreachable("not reached");
+ }
+}
+
static inline bool
brw_regs_equal(const struct brw_reg *a, const struct brw_reg *b)
{
- const bool df = a->type == BRW_REGISTER_TYPE_DF && a->file == IMM;
- return a->bits == b->bits && (df ? a->u64 == b->u64 : a->ud == b->ud);
+ const bool is_64bit = type_sz(a->type) == 8 && a->file == IMM;
+ return a->bits == b->bits && (is_64bit ? a->u64 == b->u64 : a->ud == b->ud);
}
static inline bool
@@ -311,34 +338,6 @@ struct brw_indirect {
unsigned pad:18;
};
-
-static inline unsigned
-type_sz(unsigned type)
-{
- switch(type) {
- case BRW_REGISTER_TYPE_UQ:
- case BRW_REGISTER_TYPE_Q:
- case BRW_REGISTER_TYPE_DF:
- return 8;
- case BRW_REGISTER_TYPE_UD:
- case BRW_REGISTER_TYPE_D:
- case BRW_REGISTER_TYPE_F:
- case BRW_REGISTER_TYPE_VF:
- return 4;
- case BRW_REGISTER_TYPE_UW:
- case BRW_REGISTER_TYPE_W:
- case BRW_REGISTER_TYPE_UV:
- case BRW_REGISTER_TYPE_V:
- case BRW_REGISTER_TYPE_HF:
- return 2;
- case BRW_REGISTER_TYPE_UB:
- case BRW_REGISTER_TYPE_B:
- return 1;
- default:
- unreachable("not reached");
- }
-}
-
static inline enum brw_reg_type
get_exec_type(const enum brw_reg_type type)
{
--
2.17.1
More information about the mesa-dev
mailing list