Mesa (master): i965/fs: Handle explicit flag destinations in flags_written ()
Matt Turner
mattst88 at kemper.freedesktop.org
Fri Jul 21 00:03:33 UTC 2017
Module: Mesa
Branch: master
Commit: 93dc736f4e5b71fbc99a02dc355e1d77daee415b
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=93dc736f4e5b71fbc99a02dc355e1d77daee415b
Author: Francisco Jerez <currojerez at riseup.net>
Date: Tue Jun 20 22:38:48 2017 -0700
i965/fs: Handle explicit flag destinations in flags_written()
The implementations of the ARB_shader_group_vote intrinsics will
explicitly write the flag as the destination register.
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/intel/compiler/brw_fs.cpp | 23 +++++++++++++++++++----
1 file changed, 19 insertions(+), 4 deletions(-)
diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index ab9e95524c..f3bb3835d9 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -857,6 +857,24 @@ namespace {
const unsigned end = start + inst->exec_size;
return ((1 << DIV_ROUND_UP(end, 8)) - 1) & ~((1 << (start / 8)) - 1);
}
+
+ unsigned
+ bit_mask(unsigned n)
+ {
+ return (n >= CHAR_BIT * sizeof(bit_mask(n)) ? ~0u : (1u << n) - 1);
+ }
+
+ unsigned
+ flag_mask(const fs_reg &r, unsigned sz)
+ {
+ if (r.file == ARF) {
+ const unsigned start = (r.nr - BRW_ARF_FLAG) * 4 + r.subnr;
+ const unsigned end = start + sz;
+ return bit_mask(end) & ~bit_mask(start);
+ } else {
+ return 0;
+ }
+ }
}
unsigned
@@ -882,16 +900,13 @@ fs_inst::flags_read(const gen_device_info *devinfo) const
unsigned
fs_inst::flags_written() const
{
- /* XXX - This doesn't consider explicit uses of the flag register as
- * destination region.
- */
if ((conditional_mod && (opcode != BRW_OPCODE_SEL &&
opcode != BRW_OPCODE_IF &&
opcode != BRW_OPCODE_WHILE)) ||
opcode == FS_OPCODE_MOV_DISPATCH_TO_FLAGS) {
return flag_mask(this);
} else {
- return 0;
+ return flag_mask(dst, size_written);
}
}
More information about the mesa-commit
mailing list