Mesa (master): intel/fs: Handle OR source modifiers in algebraic optimization

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Mar 1 20:44:23 UTC 2019


Module: Mesa
Branch: master
Commit: fb3ca9109cba6d814c2e3843e256b298cfd73661
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fb3ca9109cba6d814c2e3843e256b298cfd73661

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Dec 12 18:14:34 2018 -0800

intel/fs: Handle OR source modifiers in algebraic optimization

Found by inspection.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/intel/compiler/brw_fs.cpp | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/intel/compiler/brw_fs.cpp b/src/intel/compiler/brw_fs.cpp
index 470c02145f6..c4c800c6c22 100644
--- a/src/intel/compiler/brw_fs.cpp
+++ b/src/intel/compiler/brw_fs.cpp
@@ -2596,7 +2596,16 @@ fs_visitor::opt_algebraic()
       case BRW_OPCODE_OR:
          if (inst->src[0].equals(inst->src[1]) ||
              inst->src[1].is_zero()) {
-            inst->opcode = BRW_OPCODE_MOV;
+            /* On Gen8+, the OR instruction can have a source modifier that
+             * performs logical not on the operand.  Cases of 'OR r0, ~r1, 0'
+             * or 'OR r0, ~r1, ~r1' should become a NOT instead of a MOV.
+             */
+            if (inst->src[0].negate) {
+               inst->opcode = BRW_OPCODE_NOT;
+               inst->src[0].negate = false;
+            } else {
+               inst->opcode = BRW_OPCODE_MOV;
+            }
             inst->src[1] = reg_undef;
             progress = true;
             break;




More information about the mesa-commit mailing list