mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-28 05:46:56 +01:00
graphics: support SDWA arithmetic right shifts
This commit is contained in:
@@ -16,7 +16,7 @@ enum class Vop2SdwaProfile {
|
|||||||
Float16,
|
Float16,
|
||||||
IntegerFullDestination,
|
IntegerFullDestination,
|
||||||
IntegerPartialDestination,
|
IntegerPartialDestination,
|
||||||
ReverseLogicalRight,
|
ReverseRightShift,
|
||||||
ReverseLogicalLeft,
|
ReverseLogicalLeft,
|
||||||
Bitwise,
|
Bitwise,
|
||||||
Count,
|
Count,
|
||||||
@@ -44,9 +44,9 @@ constexpr Vop2OpcodeInfo VOP2_OPCODE_LIST[] = {
|
|||||||
{0x13u, Opcode::VMinU32, Vop2SdwaProfile::IntegerPartialDestination},
|
{0x13u, Opcode::VMinU32, Vop2SdwaProfile::IntegerPartialDestination},
|
||||||
{0x14u, Opcode::VMaxU32, Vop2SdwaProfile::IntegerFullDestination},
|
{0x14u, Opcode::VMaxU32, Vop2SdwaProfile::IntegerFullDestination},
|
||||||
{0x15u, Opcode::VLshrB32},
|
{0x15u, Opcode::VLshrB32},
|
||||||
{0x16u, Opcode::VLshrrevB32, Vop2SdwaProfile::ReverseLogicalRight},
|
{0x16u, Opcode::VLshrrevB32, Vop2SdwaProfile::ReverseRightShift},
|
||||||
{0x17u, Opcode::VAshrI32},
|
{0x17u, Opcode::VAshrI32},
|
||||||
{0x18u, Opcode::VAshrrevI32},
|
{0x18u, Opcode::VAshrrevI32, Vop2SdwaProfile::ReverseRightShift},
|
||||||
{0x19u, Opcode::VLshlB32},
|
{0x19u, Opcode::VLshlB32},
|
||||||
{0x1au, Opcode::VLshlrevB32, Vop2SdwaProfile::ReverseLogicalLeft},
|
{0x1au, Opcode::VLshlrevB32, Vop2SdwaProfile::ReverseLogicalLeft},
|
||||||
{0x1bu, Opcode::VAndB32, Vop2SdwaProfile::Bitwise},
|
{0x1bu, Opcode::VAndB32, Vop2SdwaProfile::Bitwise},
|
||||||
|
|||||||
@@ -11759,6 +11759,32 @@ TestCase Vop2SdwaAddNcCapturedHighWordDestination() {
|
|||||||
return test;
|
return test;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TestCase Vop2SdwaAshrrevCapturedWord0SignExtends() {
|
||||||
|
using O = ShaderOpcode;
|
||||||
|
|
||||||
|
std::vector<u32> code;
|
||||||
|
AppendBufferLoadDword(&code, 1, 30);
|
||||||
|
code.push_back(0x303202f9u);
|
||||||
|
code.push_back(
|
||||||
|
0x0c860686u); // v_ashrrev_i32 v25, 6, sign_extend(v1.word0)
|
||||||
|
AppendStoreVgpr(&code, 25, 1);
|
||||||
|
AppendEnd(&code);
|
||||||
|
|
||||||
|
TestCase test;
|
||||||
|
test.name = "Vop2SdwaAshrrevCapturedWord0SignExtends";
|
||||||
|
test.code = std::move(code);
|
||||||
|
test.initial = {0xabcd8000u, 0};
|
||||||
|
test.expected = {0xabcd8000u, 0xfffffe00u};
|
||||||
|
test.opcodes = {O::BufferLoadDword, O::VAshrrevI32, O::VMovB32,
|
||||||
|
O::BufferStoreDword, O::SEndpgm};
|
||||||
|
test.decoded_counts = {
|
||||||
|
{"v_ashrrev_i32 v25, 6, v1.sdwa(sel=4,sext=1)", 1}};
|
||||||
|
test.ir_counts = {{" = BitFieldSExtract ", 1},
|
||||||
|
{" = ShiftRightArithmetic32 ", 1}};
|
||||||
|
test.required_spirv = {"OpBitFieldSExtract", "OpShiftRightArithmetic"};
|
||||||
|
return test;
|
||||||
|
}
|
||||||
|
|
||||||
TestCase Vop2SdwaSubNcPreservesByteAndWordDestinations() {
|
TestCase Vop2SdwaSubNcPreservesByteAndWordDestinations() {
|
||||||
using O = ShaderOpcode;
|
using O = ShaderOpcode;
|
||||||
|
|
||||||
@@ -17539,6 +17565,7 @@ std::vector<TestCase> MakeCases() {
|
|||||||
AddCase(VectorIntegerOps);
|
AddCase(VectorIntegerOps);
|
||||||
AddCase(Vop2SdwaSubNcExactByte2Destination);
|
AddCase(Vop2SdwaSubNcExactByte2Destination);
|
||||||
AddCase(Vop2SdwaAddNcCapturedHighWordDestination);
|
AddCase(Vop2SdwaAddNcCapturedHighWordDestination);
|
||||||
|
AddCase(Vop2SdwaAshrrevCapturedWord0SignExtends);
|
||||||
AddCase(Vop2SdwaSubNcPreservesByteAndWordDestinations);
|
AddCase(Vop2SdwaSubNcPreservesByteAndWordDestinations);
|
||||||
AddCase(Vop2SdwaMinU32PreservesWordDestination);
|
AddCase(Vop2SdwaMinU32PreservesWordDestination);
|
||||||
AddCase(VectorShiftCountsMaskLowBits);
|
AddCase(VectorShiftCountsMaskLowBits);
|
||||||
@@ -20980,6 +21007,11 @@ int main(int argc, char **argv) {
|
|||||||
RunCase(&vulkan, VectorAlignByteUsesFiveBitByteOffset());
|
RunCase(&vulkan, VectorAlignByteUsesFiveBitByteOffset());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (argc == 2 && std::strcmp(argv[1], "--sdwa-ashr-only") == 0) {
|
||||||
|
VulkanHarness vulkan;
|
||||||
|
RunCase(&vulkan, Vop2SdwaAshrrevCapturedWord0SignExtends());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
if (argc == 2 && std::strcmp(argv[1], "--sff1-b64-only") == 0) {
|
if (argc == 2 && std::strcmp(argv[1], "--sff1-b64-only") == 0) {
|
||||||
VulkanHarness vulkan;
|
VulkanHarness vulkan;
|
||||||
RunCase(&vulkan, ScalarBitfieldPack());
|
RunCase(&vulkan, ScalarBitfieldPack());
|
||||||
|
|||||||
Reference in New Issue
Block a user