aco: rewrite SDWA selector

This commit introduces a new struct SubdwordSel
in order to ease and clean up the usage of SDWA
selections. This includes removing the distinction
between register-allocated and fixed SDWA selections.
Instead, SDWA selections can now also access the high
bits of subdword variables. Alignment and sizes are
validated accordingly. Size, offset and sign_extend
can be evaluated via helper methods.

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12640>
This commit is contained in:
Daniel Schürmann
2021-08-30 17:58:36 +02:00
parent cc4682ed47
commit 9e3ff06c38
11 changed files with 164 additions and 187 deletions

View File

@@ -276,24 +276,12 @@ convert_to_SDWA(chip_class chip, aco_ptr<Instruction>& instr)
if (i >= 2)
break;
switch (instr->operands[i].bytes()) {
case 1: sdwa.sel[i] = sdwa_ubyte; break;
case 2: sdwa.sel[i] = sdwa_uword; break;
case 4: sdwa.sel[i] = sdwa_udword; break;
}
}
switch (instr->definitions[0].bytes()) {
case 1:
sdwa.dst_sel = sdwa_ubyte;
sdwa.dst_preserve = true;
break;
case 2:
sdwa.dst_sel = sdwa_uword;
sdwa.dst_preserve = true;
break;
case 4: sdwa.dst_sel = sdwa_udword; break;
sdwa.sel[i] = SubdwordSel(instr->operands[i].bytes(), 0, false);
}
sdwa.dst_sel = SubdwordSel(instr->definitions[0].bytes(), 0, false);
sdwa.dst_preserve = sdwa.dst_sel.size() < 4;
if (instr->definitions[0].getTemp().type() == RegType::sgpr && chip == GFX8)
instr->definitions[0].setFixed(vcc);
if (instr->definitions.size() >= 2)