mirror of
https://github.com/boykopovar/AnyPS5.git
synced 2026-11-07 13:39:55 +00:00
fix(shader): map the GCN VOP3 forms of the VOP2 and VOPC instructions the GCN tables already map
GcnTables::Vop3 lacked the VOP3 encodings of v_cmp_tru_f32/f64, every v_cmps_* and v_subb_u32/v_subbrev_u32, although GcnTables::Vopc and GcnTables::Vop2 map their e32 forms, so a PS4 shader using them in VOP3 form threw "GCN VOP3 opcode N ... is not implemented". Add the 36 pairs following the VOP3 layout the decoder already uses (VOPC op, 0x100 + VOP2 op), mapped to the same RDNA opcodes as the e32 tables.
This commit is contained in:
1 parent
26fa1212b8
commit
40dd6df60d
2 files changed
+31
-5
No files matched your search
@@ -31,11 +31,32 @@ void SetregImmKeepsItsLiteral() {
|
||||
Check(Decode(movk).wordCount == 1u, "s_movk_i32 took a literal word");
|
||||
}
|
||||
|
||||
void Vop3FormsOfMappedVop2AndVopcDecode() {
|
||||
const std::array<std::uint32_t, 3> subb{0xd2520401u, 0x001a0702u, 0xbf810000u};
|
||||
const auto borrow = Decode(subb);
|
||||
Check(borrow.op == RdnaOpcode::VSubCoCiU32, "VOP3 v_subb_u32 did not decode as v_sub_co_ci_u32");
|
||||
Check(borrow.wordCount == 2u, "VOP3 v_subb_u32 is not two words");
|
||||
Check(borrow.destination.kind == RdnaOperandKind::VectorRegister && borrow.destination.reg == 1u, "VOP3 v_subb_u32 lost its vector destination");
|
||||
Check(borrow.destination2.kind == RdnaOperandKind::ScalarRegister && borrow.destination2.reg == 4u, "VOP3 v_subb_u32 lost its borrow-out SGPR pair");
|
||||
Check(borrow.source2.kind == RdnaOperandKind::ScalarRegister && borrow.source2.reg == 6u, "VOP3 v_subb_u32 lost its borrow-in SGPR pair");
|
||||
const std::array<std::uint32_t, 3> subbrev{0xd2540401u, 0x001a0702u, 0xbf810000u};
|
||||
Check(Decode(subbrev).op == RdnaOpcode::VSubrevCoCiU32, "VOP3 v_subbrev_u32 did not decode as v_subrev_co_ci_u32");
|
||||
const std::array<std::uint32_t, 3> truF32{0xd01e0004u, 0x00020300u, 0xbf810000u};
|
||||
const auto always = Decode(truF32);
|
||||
Check(always.op == RdnaOpcode::VCmpTruF32, "VOP3 v_cmp_tru_f32 did not decode as its RDNA opcode");
|
||||
Check(always.destination.kind == RdnaOperandKind::ScalarRegister && always.destination.reg == 4u, "VOP3 v_cmp_tru_f32 lost its scalar destination");
|
||||
const std::array<std::uint32_t, 3> cmpsLtF32{0xd0820004u, 0x00020300u, 0xbf810000u};
|
||||
Check(Decode(cmpsLtF32).op == RdnaOpcode::VCmpLtF32, "VOP3 v_cmps_lt_f32 did not decode as v_cmp_lt_f32");
|
||||
const std::array<std::uint32_t, 3> cmpsTruF64{0xd0de0004u, 0x00020500u, 0xbf810000u};
|
||||
Check(Decode(cmpsTruF64).op == RdnaOpcode::VCmpTruF64, "VOP3 v_cmps_tru_f64 did not decode as v_cmp_tru_f64");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
int main() {
|
||||
try {
|
||||
SetregImmKeepsItsLiteral();
|
||||
Vop3FormsOfMappedVop2AndVopcDecode();
|
||||
} catch (const std::exception& error) {
|
||||
std::fprintf(stderr, "%s\n", error.what());
|
||||
return 1;
|
||||
|
||||
@@ -94,15 +94,20 @@ inline constexpr std::array<std::pair<std::uint16_t, std::uint16_t>, 216> Vopc{{
|
||||
{0xf0, 0xf0}, {0xf1, 0xf1}, {0xf2, 0xf2}, {0xf3, 0xf3}, {0xf4, 0xf4}, {0xf5, 0xf5}, {0xf6, 0xf6}, {0xf7, 0xf7},
|
||||
}};
|
||||
|
||||
inline constexpr std::array<std::pair<std::uint16_t, std::uint16_t>, 324> Vop3{{
|
||||
inline constexpr std::array<std::pair<std::uint16_t, std::uint16_t>, 360> Vop3{{
|
||||
{0x0, 0x0}, {0x1, 0x1}, {0x2, 0x2}, {0x3, 0x3}, {0x4, 0x4}, {0x5, 0x5}, {0x6, 0x6}, {0x7, 0x7},
|
||||
{0x8, 0x8}, {0x9, 0x9}, {0xa, 0xa}, {0xb, 0xb}, {0xc, 0xc}, {0xd, 0xd}, {0xe, 0xe}, {0x10, 0x10},
|
||||
{0x8, 0x8}, {0x9, 0x9}, {0xa, 0xa}, {0xb, 0xb}, {0xc, 0xc}, {0xd, 0xd}, {0xe, 0xe}, {0xf, 0xf}, {0x10, 0x10},
|
||||
{0x11, 0x11}, {0x12, 0x12}, {0x13, 0x13}, {0x14, 0x14}, {0x15, 0x15}, {0x16, 0x16}, {0x17, 0x17}, {0x18, 0x18},
|
||||
{0x19, 0x19}, {0x1a, 0x1a}, {0x1b, 0x1b}, {0x1c, 0x1c}, {0x1d, 0x1d}, {0x1e, 0x1e}, {0x20, 0x20}, {0x21, 0x21},
|
||||
{0x22, 0x22}, {0x23, 0x23}, {0x24, 0x24}, {0x25, 0x25}, {0x26, 0x26}, {0x27, 0x27}, {0x28, 0x28}, {0x29, 0x29},
|
||||
{0x2a, 0x2a}, {0x2b, 0x2b}, {0x2c, 0x2c}, {0x2d, 0x2d}, {0x2e, 0x2e}, {0x30, 0x30}, {0x31, 0x31}, {0x32, 0x32},
|
||||
{0x2a, 0x2a}, {0x2b, 0x2b}, {0x2c, 0x2c}, {0x2d, 0x2d}, {0x2e, 0x2e}, {0x2f, 0x2f}, {0x30, 0x30}, {0x31, 0x31}, {0x32, 0x32},
|
||||
{0x33, 0x33}, {0x34, 0x34}, {0x35, 0x35}, {0x36, 0x36}, {0x37, 0x37}, {0x38, 0x38}, {0x39, 0x39}, {0x3a, 0x3a},
|
||||
{0x3b, 0x3b}, {0x3c, 0x3c}, {0x3d, 0x3d}, {0x3e, 0x3e}, {0x80, 0x80}, {0x81, 0x81}, {0x82, 0x82}, {0x83, 0x83},
|
||||
{0x3b, 0x3b}, {0x3c, 0x3c}, {0x3d, 0x3d}, {0x3e, 0x3e},
|
||||
{0x40, 0x0}, {0x41, 0x1}, {0x42, 0x2}, {0x43, 0x3}, {0x44, 0x4}, {0x45, 0x5}, {0x46, 0x6}, {0x47, 0x7},
|
||||
{0x48, 0x8}, {0x49, 0x9}, {0x4a, 0xa}, {0x4b, 0xb}, {0x4c, 0xc}, {0x4d, 0xd}, {0x4e, 0xe}, {0x4f, 0xf},
|
||||
{0x60, 0x20}, {0x61, 0x21}, {0x62, 0x22}, {0x63, 0x23}, {0x64, 0x24}, {0x65, 0x25}, {0x66, 0x26}, {0x67, 0x27},
|
||||
{0x68, 0x28}, {0x69, 0x29}, {0x6a, 0x2a}, {0x6b, 0x2b}, {0x6c, 0x2c}, {0x6d, 0x2d}, {0x6e, 0x2e}, {0x6f, 0x2f},
|
||||
{0x80, 0x80}, {0x81, 0x81}, {0x82, 0x82}, {0x83, 0x83},
|
||||
{0x84, 0x84}, {0x85, 0x85}, {0x86, 0x86}, {0x87, 0x87}, {0x88, 0x88}, {0x89, 0x89}, {0x8a, 0x8a}, {0x8b, 0x8b},
|
||||
{0x8c, 0x8c}, {0x8d, 0x8d}, {0x8e, 0x8e}, {0x90, 0x90}, {0x91, 0x91}, {0x92, 0x92}, {0x93, 0x93}, {0x94, 0x94},
|
||||
{0x95, 0x95}, {0x96, 0x96}, {0x97, 0x97}, {0x98, 0x98}, {0xa0, 0xa0}, {0xa1, 0xa1}, {0xa2, 0xa2}, {0xa3, 0xa3},
|
||||
@@ -117,7 +122,7 @@ inline constexpr std::array<std::pair<std::uint16_t, std::uint16_t>, 324> Vop3{{
|
||||
{0x104, 0x104}, {0x105, 0x105}, {0x106, 0x106}, {0x107, 0x107}, {0x108, 0x108}, {0x109, 0x109}, {0x10a, 0x10a}, {0x10b, 0x10b},
|
||||
{0x10c, 0x10c}, {0x10f, 0x10f}, {0x110, 0x110}, {0x111, 0x111}, {0x112, 0x112}, {0x113, 0x113}, {0x114, 0x114}, {0x116, 0x116},
|
||||
{0x118, 0x118}, {0x11a, 0x11a}, {0x11b, 0x11b}, {0x11c, 0x11c}, {0x11d, 0x11d}, {0x11e, 0x363}, {0x11f, 0x11f}, {0x120, 0x120},
|
||||
{0x121, 0x121}, {0x122, 0x364}, {0x123, 0x365}, {0x124, 0x366}, {0x125, 0x30f}, {0x126, 0x310}, {0x127, 0x319}, {0x128, 0x128},
|
||||
{0x121, 0x121}, {0x122, 0x364}, {0x123, 0x365}, {0x124, 0x366}, {0x125, 0x30f}, {0x126, 0x310}, {0x127, 0x319}, {0x128, 0x128}, {0x129, 0x129}, {0x12a, 0x12a},
|
||||
{0x12b, 0x362}, {0x12d, 0x368}, {0x12e, 0x369}, {0x12f, 0x12f}, {0x130, 0x36a}, {0x131, 0x36b}, {0x132, 0x132}, {0x133, 0x133},
|
||||
{0x134, 0x134}, {0x135, 0x135}, {0x139, 0x139}, {0x13a, 0x13a}, {0x13b, 0x13b}, {0x140, 0x140}, {0x141, 0x141}, {0x142, 0x142},
|
||||
{0x143, 0x143}, {0x144, 0x144}, {0x145, 0x145}, {0x146, 0x146}, {0x147, 0x147}, {0x148, 0x148}, {0x149, 0x149}, {0x14a, 0x14a},
|
||||
|
||||
Reference in new issue
Block a user