diff options
author | Emma Anholt <emma@anholt.net> | 2021-12-06 14:03:37 -0800 |
---|---|---|
committer | Eric Engestrom <eric@engestrom.ch> | 2021-12-29 20:56:29 +0000 |
commit | d4bbc1261f4e6875cae840d9b468a8e7bc7a8177 (patch) | |
tree | 5ea771bc1b4199fa532b9b8a253d8acf0c0c259d | |
parent | 507ec2668843ab6619276b33fb96c3668d5ab957 (diff) |
r300: Fix mis-optimization turning -1 - x into 1 - x.
Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14092>
(cherry picked from commit 65e343dda38a00b10715731e02938df776ef0000)
-rw-r--r-- | .pick_status.json | 2 | ||||
-rw-r--r-- | 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 40758d63344..557f7d8e3b0 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5269,7 +5269,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. */ |