summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2017-11-20 14:24:57 -0800
committerMatt Turner <[email protected]>2017-11-21 10:13:07 -0800
commita05af1f7b8f82a38513bba31f9573cd62d82f18d (patch)
treef815cd34f187acfeccf06fff7816877faaf01e17 /src/intel
parentce221cbbcf25238771b9a59e06ce4995e08c091e (diff)
i965/fs: Handle negating immediates on MADs when propagating saturates
MADs don't take immediate sources, but we allow them in the IR since it simplifies a lot of things. I neglected to consider that case. Fixes: 4009a9ead490 ("i965/fs: Allow saturate propagation to propagate negations into MADs.") Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103616 Reported-and-Tested-by: Ruslan Kabatsayev <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/compiler/brw_fs_saturate_propagation.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/intel/compiler/brw_fs_saturate_propagation.cpp b/src/intel/compiler/brw_fs_saturate_propagation.cpp
index 1c97a507d8c..d6cfa79a618 100644
--- a/src/intel/compiler/brw_fs_saturate_propagation.cpp
+++ b/src/intel/compiler/brw_fs_saturate_propagation.cpp
@@ -88,8 +88,14 @@ opt_saturate_propagation_local(fs_visitor *v, bblock_t *block)
scan_inst->src[0].negate = !scan_inst->src[0].negate;
inst->src[0].negate = false;
} else if (scan_inst->opcode == BRW_OPCODE_MAD) {
- scan_inst->src[0].negate = !scan_inst->src[0].negate;
- scan_inst->src[1].negate = !scan_inst->src[1].negate;
+ for (int i = 0; i < 2; i++) {
+ if (scan_inst->src[i].file == IMM) {
+ brw_negate_immediate(scan_inst->src[i].type,
+ &scan_inst->src[i].as_brw_reg());
+ } else {
+ scan_inst->src[i].negate = !scan_inst->src[i].negate;
+ }
+ }
inst->src[0].negate = false;
} else if (scan_inst->opcode == BRW_OPCODE_ADD) {
if (scan_inst->src[1].file == IMM) {