shader: decode RDNA2 bit-reverse SDWA source selectors

Co-authored-by: TheCruZ <thecruzwtf@gmail.com>
This commit is contained in:
nmzik
2026-10-04 01:59:45 +04:00
parent ec3e48cdde
commit d890bb190c
3 changed files with 55 additions and 0 deletions
+22
View File
@@ -3579,6 +3579,27 @@ void TestNewShaderRecompilerCapturedVop1SdwaByteConvert() {
"V_CVT_F16_U16 accepted unimplemented SDWA byte sign extension");
}
void TestNewShaderRecompilerVop1SdwaBfrev() {
using namespace ShaderRecompiler::Decoder;
const uint32_t captured[] = {0x7e0070f9u, 0x00040600u};
Instruction decoded;
DecodeInstruction(captured, 0, decoded);
Check(decoded.opcode == Opcode::V_BFREV_B32 && decoded.word_count == 2 &&
decoded.dst.kind == OperandKind::Vgpr && decoded.dst.reg == 0 &&
decoded.dst.sdwa_sel == 6 && decoded.src0.kind == OperandKind::Vgpr &&
decoded.src0.reg == 0 && decoded.src0.sdwa_sel == 4 &&
!decoded.src0.sdwa_sext,
"captured V_BFREV_B32 SDWA source metadata is incorrect");
for (const uint32_t modifier : {0x00070600u, 0x00140600u, 0x00240600u,
0x00042600u, 0x00044600u, 0x00040400u,
0x00041e00u}) {
const uint32_t invalid[] = {captured[0], modifier};
DecodeInstruction(invalid, 0, decoded);
Check(decoded.word_count == 2 && decoded.opcode == Opcode::UNSUPPORTED,
"V_BFREV_B32 SDWA accepted unsupported selectors or modifiers");
}
}
void TestNewShaderRecompilerVop1SdwaNotDestination() {
auto options = MakeCompileOptions(ShaderType::Pixel);
@@ -14546,6 +14567,7 @@ int main() {
TestNewShaderRecompilerDsReadWrite2Translation();
TestNewShaderRecompilerDsWideAndAtomicTranslation();
TestNewShaderRecompilerCapturedVop1SdwaByteConvert();
TestNewShaderRecompilerVop1SdwaBfrev();
TestNewShaderRecompilerVop1SdwaNotDestination();
TestNewShaderRecompilerScalarMemoryBindingDomains();
// Opcode semantics and optimized SPIR-V are exercised by