[Mesa-dev] [PATCH 2/3] intel/compiler: add a region_match() helper

Iago Toral Quiroga itoral at igalia.com
Tue May 15 11:05:20 UTC 2018


This checks whether two register regions are an exact match.
---
 src/intel/compiler/brw_ir_fs.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/intel/compiler/brw_ir_fs.h b/src/intel/compiler/brw_ir_fs.h
index f06a33c516d..cad333b6b6d 100644
--- a/src/intel/compiler/brw_ir_fs.h
+++ b/src/intel/compiler/brw_ir_fs.h
@@ -239,6 +239,19 @@ region_contained_in(const fs_reg &r, unsigned dr, const fs_reg &s, unsigned ds)
           reg_offset(r) + dr <= reg_offset(s) + ds;
 }
 
+/**
+ * Check that the register region given by r [r.offset, r.offset + dr[
+ * is exactly the same as the the register region given by s
+ * [s.offset, s.offset + ds[
+ */
+static inline bool
+region_match(const fs_reg &r, unsigned dr, const fs_reg &s, unsigned ds)
+{
+   return reg_space(r) == reg_space(s) &&
+          reg_offset(r) == reg_offset(s) &&
+          reg_offset(r) + dr == reg_offset(s) + ds;
+}
+
 /**
  * Return whether the given register region is n-periodic, i.e. whether the
  * original region remains invariant after shifting it by \p n scalar
-- 
2.14.1



More information about the mesa-dev mailing list