diff options
author | Matt Turner <[email protected]> | 2016-02-22 10:25:38 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2016-02-25 10:51:04 -0800 |
commit | 1567da1e2820d4c1a6c14f4598ad3addba6bc788 (patch) | |
tree | b348940bf767e42a62ba87248a54fbd434e3f9ec /src | |
parent | 3da789f1e9e3eb027bcfdb9d9170e7b37160b5b9 (diff) |
i965/fs: Don't CSE negated multiplies with saturation.
It's not correct to CSE these multiplies
mul.sat dst1, -a, b
mul.sat dst2, a, b
by emitting a negated MOV from dst1 to dst2:
mul.sat dst1, -a, b
mov dst2, -dst1
Take 2.0*2.0 for example. The first multiply would produce 0.0 and the
second would produce 1.0.
Fixes bad generated code in 18 to 22 shaders:
instructions in affected programs: 432 -> 464 (7.41%)
helped: 4
HURT: 18
Cc: [email protected]
Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_cse.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp index cde6566c05c..0e743de7faf 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp @@ -139,6 +139,8 @@ operands_match(const fs_inst *a, const fs_inst *b, bool *negate) ys[1].f = ys1_imm; *negate = (xs0_negate != xs1_negate) != (ys0_negate != ys1_negate); + if (*negate && (a->saturate || b->saturate)) + return false; return ret; } else if (!a->is_commutative()) { bool match = true; |