mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-20 19:07:01 +02:00
shader: classify native half values with shared operand decoding
This commit is contained in:
@@ -4894,6 +4894,46 @@ void TestNewShaderRecompilerCapturedVopcSdwaCmpxClass() {
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
}
|
||||
|
||||
void TestVopcCmpxClassF16Decoder() {
|
||||
using namespace ShaderRecompiler::Decoder;
|
||||
for (const uint32_t modifier : {0x86360000u, 0x86350002u}) {
|
||||
const uint32_t captured[] = {0x7d3f70f9u, modifier};
|
||||
Instruction decoded;
|
||||
DecodeInstruction(captured, 0, decoded);
|
||||
Check(decoded.opcode == Opcode::V_CMPX_CLASS_F16 && decoded.word_count == 2 &&
|
||||
decoded.dst.kind == OperandKind::ExecLo &&
|
||||
decoded.src0.kind == OperandKind::Vgpr &&
|
||||
decoded.src0.reg == (modifier == 0x86360000u ? 0u : 2u) &&
|
||||
decoded.src0.sdwa_sel == (modifier == 0x86360000u ? 6u : 5u) &&
|
||||
decoded.src0.absolute && decoded.src0.negate &&
|
||||
decoded.src1.kind == OperandKind::IntegerInlineConstant &&
|
||||
decoded.src1.value == 56 && decoded.src1.sdwa_sel == 6,
|
||||
"captured V_CMPX_CLASS_F16 SDWA fields are incorrect");
|
||||
const uint32_t shader[] = {captured[0], captured[1], EncodeSopp(0x01)};
|
||||
auto result = RecompileForTest(shader, MakeCompileOptions(ShaderType::Pixel));
|
||||
CheckSpirvBinaryValidates(result.spirv);
|
||||
}
|
||||
const uint32_t compact[] = {EncodeVopc(0x9f, 256, 1)};
|
||||
const uint32_t vop3[] = {EncodeVop3Word0(0x9f, 126),
|
||||
EncodeVop3Word1(256, 257, 0)};
|
||||
for (auto words : {std::span<const uint32_t>(compact),
|
||||
std::span<const uint32_t>(vop3)}) {
|
||||
Instruction decoded;
|
||||
DecodeInstruction(words, 0, decoded);
|
||||
Check(decoded.opcode == Opcode::V_CMPX_CLASS_F16 &&
|
||||
decoded.dst.kind == OperandKind::ExecLo && decoded.src0.reg == 0 &&
|
||||
decoded.src1.kind == OperandKind::Vgpr && decoded.src1.reg == 1,
|
||||
"compact/VOP3 V_CMPX_CLASS_F16 did not decode to an EXEC compare");
|
||||
}
|
||||
for (const uint32_t modifier : {0x86370000u, 0x87360000u}) {
|
||||
const uint32_t invalid[] = {0x7d3f70f9u, modifier};
|
||||
Instruction decoded;
|
||||
DecodeInstruction(invalid, 0, decoded);
|
||||
Check(decoded.opcode == Opcode::UNSUPPORTED && decoded.word_count == 2,
|
||||
"V_CMPX_CLASS_F16 accepted reserved SDWA selector 7");
|
||||
}
|
||||
}
|
||||
|
||||
void TestNewShaderRecompilerCapturedVopcSdwaCmpxLtU16() {
|
||||
using namespace ShaderRecompiler;
|
||||
|
||||
@@ -14830,6 +14870,7 @@ int main() {
|
||||
TestSopkCompareImmediateExtension();
|
||||
TestNativeStoreCompletion();
|
||||
TestNewShaderRecompilerCapturedVopcSdwaCmpxClass();
|
||||
TestVopcCmpxClassF16Decoder();
|
||||
TestNewShaderRecompilerCapturedVopcSdwaCmpxLtU16();
|
||||
TestNewShaderRecompilerIrLookupMissFailsExplicitly();
|
||||
TestNewShaderRecompilerRejectsDppOn64BitCompares();
|
||||
|
||||
Reference in New Issue
Block a user