[Mesa-dev] [PATCH 39/57] i965/fs: Move region_contained_in to the IR header and fix for non-VGRF files.

Francisco Jerez currojerez at riseup.net
Thu Sep 8 01:49:06 UTC 2016


Also changed the argument names since 'src' and 'dst' don't make that
much sense outside of the context of copy propagation.
---
 src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp | 14 --------------
 src/mesa/drivers/dri/i965/brw_ir_fs.h                 | 13 +++++++++++++
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
index 80ad4b4..e4e6816 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
@@ -332,20 +332,6 @@ can_take_stride(fs_inst *inst, unsigned arg, unsigned stride,
    return true;
 }
 
-/**
- * Check that the register region read by src [src.offset,
- * src.offset + size_read[ is fully contained inside the register
- * region written by dst [dst.offset, dst.offset + size_written[.
- */
-static inline bool
-region_contained_in(const fs_reg &src, unsigned size_read,
-                    const fs_reg &dst, unsigned size_written)
-{
-   return src.file == dst.file && src.nr == dst.nr &&
-          src.offset >= dst.offset &&
-          src.offset + size_read <= dst.offset + size_written;
-}
-
 bool
 fs_visitor::try_copy_propagate(fs_inst *inst, int arg, acp_entry *entry)
 {
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index e8e25b9..84d7d5e 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -229,6 +229,19 @@ regions_overlap(const fs_reg &r, unsigned dr, const fs_reg &s, unsigned ds)
 }
 
 /**
+ * Check that the register region given by r [r.offset, r.offset + dr[
+ * is fully contained inside the register region given by s
+ * [s.offset, s.offset + ds[.
+ */
+static inline bool
+region_contained_in(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
  * channels.
-- 
2.9.0



More information about the mesa-dev mailing list