Previously, when the instruction had 3 operands, this would cause
possible corruption because of writing to sdwa->sel[2].
This was noticed thanks to GCC 10's -Wstringop-overflow warning.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6436>
}
for (unsigned i = 0; i < instr->operands.size(); i++) {
+ /* SDWA only uses operands 0 and 1. */
+ if (i >= 2)
+ break;
+
switch (instr->operands[i].bytes()) {
case 1:
sdwa->sel[i] = sdwa_ubyte;