From cccbb7f595c274b2d7020b0b1b06844da00082ba Mon Sep 17 00:00:00 2001 From: lioncash Date: Thu, 15 Dec 2022 17:59:53 +0000 Subject: [PATCH] OpcodeDispatcher: Handle VPMOVSXWD --- .../Interface/Core/OpcodeDispatcher.cpp | 1 + .../Core/OpcodeDispatcher/Vector.cpp | 2 ++ .../Interface/Core/X86Tables/VEXTables.cpp | 2 +- unittests/ASM/VEX/vpmovsxwd.asm | 33 +++++++++++++++++++ 4 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 unittests/ASM/VEX/vpmovsxwd.asm diff --git a/External/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp b/External/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp index 39f6df2e3..a9327e67e 100644 --- a/External/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp +++ b/External/FEXCore/Source/Interface/Core/OpcodeDispatcher.cpp @@ -5962,6 +5962,7 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() { {OPD(2, 0b01, 0x20), 1, &OpDispatchBuilder::AVXExtendVectorElements<1, 2, true>}, {OPD(2, 0b01, 0x21), 1, &OpDispatchBuilder::AVXExtendVectorElements<1, 4, true>}, {OPD(2, 0b01, 0x22), 1, &OpDispatchBuilder::AVXExtendVectorElements<1, 8, true>}, + {OPD(2, 0b01, 0x23), 1, &OpDispatchBuilder::AVXExtendVectorElements<2, 4, true>}, {OPD(2, 0b01, 0x29), 1, &OpDispatchBuilder::AVXVectorALUOp}, {OPD(2, 0b01, 0x2A), 1, &OpDispatchBuilder::VMOVVectorNTOp}, diff --git a/External/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp b/External/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp index d539fc2b5..50909a238 100644 --- a/External/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp +++ b/External/FEXCore/Source/Interface/Core/OpcodeDispatcher/Vector.cpp @@ -2706,6 +2706,8 @@ template void OpDispatchBuilder::AVXExtendVectorElements<1, 4, true>(OpcodeArgs); template void OpDispatchBuilder::AVXExtendVectorElements<1, 8, true>(OpcodeArgs); +template +void OpDispatchBuilder::AVXExtendVectorElements<2, 4, true>(OpcodeArgs); OrderedNode* OpDispatchBuilder::VectorRoundImpl(OpcodeArgs, size_t ElementSize, OrderedNode *Src, uint64_t Mode) { diff --git a/External/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp b/External/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp index affde2029..3ae366d73 100644 --- a/External/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp +++ b/External/FEXCore/Source/Interface/Core/X86Tables/VEXTables.cpp @@ -292,7 +292,7 @@ void InitializeVEXTables() { {OPD(2, 0b01, 0x20), 1, X86InstInfo{"VPMOVSXBW", TYPE_INST, GenFlagsSizes(SIZE_128BIT, SIZE_64BIT) | FLAGS_MODRM | FLAGS_XMM_FLAGS, 0, nullptr}}, {OPD(2, 0b01, 0x21), 1, X86InstInfo{"VPMOVSXBD", TYPE_INST, GenFlagsSizes(SIZE_128BIT, SIZE_32BIT) | FLAGS_MODRM | FLAGS_XMM_FLAGS, 0, nullptr}}, {OPD(2, 0b01, 0x22), 1, X86InstInfo{"VPMOVSXBQ", TYPE_INST, GenFlagsSizes(SIZE_128BIT, SIZE_16BIT) | FLAGS_MODRM | FLAGS_XMM_FLAGS, 0, nullptr}}, - {OPD(2, 0b01, 0x23), 1, X86InstInfo{"VPMOVSXWD", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}}, + {OPD(2, 0b01, 0x23), 1, X86InstInfo{"VPMOVSXWD", TYPE_INST, GenFlagsSizes(SIZE_128BIT, SIZE_64BIT) | FLAGS_MODRM | FLAGS_XMM_FLAGS, 0, nullptr}}, {OPD(2, 0b01, 0x24), 1, X86InstInfo{"VPMOVSXWQ", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}}, {OPD(2, 0b01, 0x25), 1, X86InstInfo{"VPMOVSXDQ", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}}, diff --git a/unittests/ASM/VEX/vpmovsxwd.asm b/unittests/ASM/VEX/vpmovsxwd.asm new file mode 100644 index 000000000..a2f06c636 --- /dev/null +++ b/unittests/ASM/VEX/vpmovsxwd.asm @@ -0,0 +1,33 @@ +%ifdef CONFIG +{ + "HostFeatures": ["AVX"], + "RegData": { + "XMM0": ["0x4142434485868788", "0x5152535455565758", "0x4142434485868788", "0x5152535455565758"], + "XMM1": ["0xFFFF8586FFFF8788", "0x0000414200004344", "0x0000000000000000", "0x0000000000000000"], + "XMM2": ["0xFFFF8586FFFF8788", "0x0000414200004344", "0x0000555600005758", "0x0000515200005354"], + "XMM3": ["0xFFFF8586FFFF8788", "0x0000414200004344", "0x0000000000000000", "0x0000000000000000"], + "XMM4": ["0xFFFF8586FFFF8788", "0x0000414200004344", "0x0000555600005758", "0x0000515200005354"] + } +} +%endif + +lea rdx, [rel .data] + +vmovapd ymm0, [rdx] + +; Memory operands +vpmovsxwd xmm1, [rdx] +vpmovsxwd ymm2, [rdx] + +; Register only +vpmovsxwd xmm3, xmm0 +vpmovsxwd ymm4, xmm0 + +hlt + +align 32 +.data: +dq 0x4142434485868788 +dq 0x5152535455565758 +dq 0x4142434485868788 +dq 0x5152535455565758