Mesa (staging/21.3): r300: Fix mis-optimization turning -1 - x into 1 - x.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Dec 24 12:37:24 UTC 2021
Module: Mesa
Branch: staging/21.3
Commit: 7b85174438c42ec5db406b9e19fc99c1f2e30ed0
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7b85174438c42ec5db406b9e19fc99c1f2e30ed0
Author: Emma Anholt <emma at anholt.net>
Date: Mon Dec 6 14:03:37 2021 -0800
r300: Fix mis-optimization turning -1 - x into 1 - x.
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14092>
(cherry picked from commit 65e343dda38a00b10715731e02938df776ef0000)
---
.pick_status.json | 2 +-
src/gallium/drivers/r300/compiler/radeon_optimize.c | 7 ++++---
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index fa3a546ced4..e38139811f2 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -4720,7 +4720,7 @@
"description": "r300: Fix mis-optimization turning -1 - x into 1 - x.",
"nominated": true,
"nomination_type": 0,
- "resolution": 0,
+ "resolution": 1,
"main_sha": null,
"because_sha": null
},
diff --git a/src/gallium/drivers/r300/compiler/radeon_optimize.c b/src/gallium/drivers/r300/compiler/radeon_optimize.c
index 5e3503b2129..64f3fc1300c 100644
--- a/src/gallium/drivers/r300/compiler/radeon_optimize.c
+++ b/src/gallium/drivers/r300/compiler/radeon_optimize.c
@@ -653,11 +653,12 @@ static int peephole_add_presub_inv(
/* XXX It would be nice to use is_src_uniform_constant here, but that
* function only works if the register's file is RC_FILE_NONE */
for(i = 0; i < 4; i++ ) {
+ if (!(inst_add->U.I.DstReg.WriteMask & (1 << i)))
+ continue;
+
swz = GET_SWZ(inst_add->U.I.SrcReg[0].Swizzle, i);
- if(((1 << i) & inst_add->U.I.DstReg.WriteMask)
- && swz != RC_SWIZZLE_ONE) {
+ if (swz != RC_SWIZZLE_ONE || inst_add->U.I.SrcReg[0].Negate & (1 << i))
return 0;
- }
}
/* Check src1. */
More information about the mesa-commit
mailing list