aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFrancisco Jerez <[email protected]>2016-05-17 17:45:41 -0700
committerFrancisco Jerez <[email protected]>2016-05-27 23:19:20 -0700
commit168163f5f08ac1c0f3e3af20d0b2ac3391d358ab (patch)
tree8cab2978b6f453dcd65bc7ed5887e892cb5edd6b /src
parentb736e78ddbafc8f3d45ab110cef618c1514e9c64 (diff)
i965/fs: Generalize is_uniform() to is_periodic().
This will be useful in the SIMD lowering pass. Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_ir_fs.h31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_ir_fs.h b/src/mesa/drivers/dri/i965/brw_ir_fs.h
index e8f1d5353da..9c39a05f4ce 100644
--- a/src/mesa/drivers/dri/i965/brw_ir_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_ir_fs.h
@@ -146,10 +146,39 @@ component(fs_reg reg, unsigned idx)
return reg;
}
+/**
+ * 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.
+ */
+static inline bool
+is_periodic(const fs_reg &reg, unsigned n)
+{
+ if (reg.file == BAD_FILE || reg.is_null()) {
+ return true;
+
+ } else if (reg.file == IMM) {
+ const unsigned period = (reg.type == BRW_REGISTER_TYPE_UV ||
+ reg.type == BRW_REGISTER_TYPE_V ? 8 :
+ reg.type == BRW_REGISTER_TYPE_VF ? 4 :
+ 1);
+ return n % period == 0;
+
+ } else if (reg.file == ARF || reg.file == FIXED_GRF) {
+ const unsigned period = (reg.hstride == 0 && reg.vstride == 0 ? 1 :
+ reg.vstride == 0 ? 1 << reg.width :
+ ~0);
+ return n % period == 0;
+
+ } else {
+ return reg.stride == 0;
+ }
+}
+
static inline bool
is_uniform(const fs_reg &reg)
{
- return (reg.stride == 0 || reg.is_null());
+ return is_periodic(reg, 1);
}
/**