r300: fix generation of invalid swizzles in regalloc

rc_adjust_channels is inteded for moving the swizzles to a new channels
when rewriting the writemask of an instruction. However for readers one
needs to keep the swizzles in the old channels but rather convert to the
new values, so use the proper helper rc_rewrite_swizzle.

With the new swizzle fixed, we should properly detect that it would be
invalid and thus we can select the proper register class to prevent the
writemask rewrite in the regalloc.

Documentation was added to rc_adjust_channels to make it more clear what
it actually does.

Fixes a bunch of dEQP tests.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7521
Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Reviewed-by: Filip Gawin <filip@gawin.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19158>
(cherry picked from commit 1e9e561811)

Conflicts:
	src/gallium/drivers/r300/ci/r300-r480-fails.txt
This commit is contained in:
Pavel Ondračka
2022-10-19 10:23:11 +02:00
committed by Dylan Baker
parent ddd9bba400
commit 6a2d462191
3 changed files with 11 additions and 4 deletions

View File

@@ -7888,7 +7888,7 @@
"description": "r300: fix generation of invalid swizzles in regalloc",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View File

@@ -142,8 +142,15 @@ static unsigned int srcs_need_rewrite(const struct rc_opcode_info * info)
}
/**
* @return A swizzle the results from converting old_swizzle using
* conversion_swizzle
* This function moves the old swizzles to new channels using the values
* in the conversion swizzle. For example if the instruction writemask is
* changed from x to y, then conversion_swizzle should be y___ and this
* function will adjust the old argument swizzles (of the same instruction)
* to the new channels, so x___ will become _x__, etc...
*
* @param old_swizzle The swizzle to change
* @param conversion_swizzle Describes the conversion to perform on the swizzle
* @return A new swizzle
*/
unsigned int rc_adjust_channels(
unsigned int old_swizzle,

View File

@@ -390,7 +390,7 @@ static enum rc_reg_class variable_get_class(
can_change_writemask = 0;
break;
}
new_swizzle = rc_adjust_channels(
new_swizzle = rc_rewrite_swizzle(
old_swizzle, conversion_swizzle);
if (!r300_swizzle_is_native_basic(
new_swizzle)) {