mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-01-09 23:30:37 +00:00
OpcodeDispatcher: Handle VINSERTF128
This commit is contained in:
parent
f3d0fa6f60
commit
fe7c6da1e2
@ -5982,6 +5982,9 @@ void OpDispatchBuilder::InstallHostSpecificOpcodeHandlers() {
|
||||
{OPD(3, 0b01, 0x00), 1, &OpDispatchBuilder::VPERMQOp},
|
||||
{OPD(3, 0b01, 0x01), 1, &OpDispatchBuilder::VPERMQOp},
|
||||
{OPD(3, 0b01, 0x06), 1, &OpDispatchBuilder::VPERM2Op},
|
||||
|
||||
{OPD(3, 0b01, 0x18), 1, &OpDispatchBuilder::VINSERTOp},
|
||||
|
||||
{OPD(3, 0b01, 0x46), 1, &OpDispatchBuilder::VPERM2Op},
|
||||
};
|
||||
#undef OPD
|
||||
|
@ -418,6 +418,8 @@ public:
|
||||
template <size_t ElementSize>
|
||||
void VHADDPOp(OpcodeArgs);
|
||||
|
||||
void VINSERTOp(OpcodeArgs);
|
||||
|
||||
void VMOVAPS_VMOVAPD_Op(OpcodeArgs);
|
||||
void VMOVUPS_VMOVUPD_Op(OpcodeArgs);
|
||||
|
||||
|
@ -2939,6 +2939,19 @@ void OpDispatchBuilder::MPSADBWOp(OpcodeArgs) {
|
||||
StoreResult(FPRClass, Op, Result, -1);
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::VINSERTOp(OpcodeArgs) {
|
||||
const auto DstSize = GetDstSize(Op);
|
||||
OrderedNode *Src1 = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags, -1);
|
||||
OrderedNode *Src2 = LoadSource_WithOpSize(FPRClass, Op, Op->Src[1], 16, Op->Flags, -1);
|
||||
|
||||
LOGMAN_THROW_A_FMT(Op->Src[2].IsLiteral(), "Src2 needs to be literal here");
|
||||
const auto Selector = Op->Src[2].Data.Literal.Value & 1;
|
||||
|
||||
OrderedNode *Result = _VInsElement(DstSize, 16, Selector, 0, Src1, Src2);
|
||||
|
||||
StoreResult(FPRClass, Op, Result, -1);
|
||||
}
|
||||
|
||||
void OpDispatchBuilder::VPERM2Op(OpcodeArgs) {
|
||||
const auto DstSize = GetDstSize(Op);
|
||||
OrderedNode *Src1 = LoadSource(FPRClass, Op, Op->Src[0], Op->Flags, -1);
|
||||
|
@ -427,7 +427,7 @@ void InitializeVEXTables() {
|
||||
{OPD(3, 0b01, 0x16), 1, X86InstInfo{"VPEXTRD", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}},
|
||||
{OPD(3, 0b01, 0x17), 1, X86InstInfo{"VEXTRACTPS", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}},
|
||||
|
||||
{OPD(3, 0b01, 0x18), 1, X86InstInfo{"VINSERTF128", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}},
|
||||
{OPD(3, 0b01, 0x18), 1, X86InstInfo{"VINSERTF128", TYPE_INST, GenFlagsSameSize(SIZE_256BIT) | FLAGS_MODRM | FLAGS_VEX_1ST_SRC | FLAGS_XMM_FLAGS, 1, nullptr}},
|
||||
{OPD(3, 0b01, 0x19), 1, X86InstInfo{"VEXTRACTF128", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}},
|
||||
{OPD(3, 0b01, 0x1D), 1, X86InstInfo{"VCVTPS2PH", TYPE_UNDEC, FLAGS_NONE, 0, nullptr}},
|
||||
|
||||
|
43
unittests/ASM/VEX/vinsertf128.asm
Normal file
43
unittests/ASM/VEX/vinsertf128.asm
Normal file
@ -0,0 +1,43 @@
|
||||
%ifdef CONFIG
|
||||
{
|
||||
"HostFeatures": ["AVX"],
|
||||
"RegData": {
|
||||
"XMM0": ["0x3FF0000000000000", "0xEEEEEEEEEEEEEEEE", "0xFFFFFFFFFFFFFFFF", "0xAAAAAAAAAAAAAAAA"],
|
||||
"XMM1": ["0xBBBBBBBBBBBBBBBB", "0xDDDDDDDDDDDDDDDD", "0xCCCCCCCCCCCCCCCC", "0x9999999999999999"],
|
||||
"XMM2": ["0x3FF0000000000000", "0xEEEEEEEEEEEEEEEE", "0xBBBBBBBBBBBBBBBB", "0xDDDDDDDDDDDDDDDD"],
|
||||
"XMM3": ["0x3FF0000000000000", "0xEEEEEEEEEEEEEEEE", "0xBBBBBBBBBBBBBBBB", "0xDDDDDDDDDDDDDDDD"],
|
||||
"XMM4": ["0xBBBBBBBBBBBBBBBB", "0xDDDDDDDDDDDDDDDD", "0xFFFFFFFFFFFFFFFF", "0xAAAAAAAAAAAAAAAA"],
|
||||
"XMM5": ["0xBBBBBBBBBBBBBBBB", "0xDDDDDDDDDDDDDDDD", "0xFFFFFFFFFFFFFFFF", "0xAAAAAAAAAAAAAAAA"]
|
||||
},
|
||||
"MemoryRegions": {
|
||||
"0x100000000": "4096"
|
||||
}
|
||||
}
|
||||
%endif
|
||||
|
||||
lea rdx, [rel .data]
|
||||
|
||||
vmovapd ymm0, [rdx]
|
||||
vmovapd ymm1, [rdx + 32]
|
||||
|
||||
; Insert into upper lane
|
||||
vinsertf128 ymm2, ymm0, xmm1, 1
|
||||
vinsertf128 ymm3, ymm0, [rdx + 32], 1
|
||||
|
||||
; Insert into lower lane
|
||||
vinsertf128 ymm4, ymm0, xmm1, 0
|
||||
vinsertf128 ymm5, ymm0, [rdx + 32], 0
|
||||
|
||||
hlt
|
||||
|
||||
align 32
|
||||
.data:
|
||||
dq 0x3FF0000000000000
|
||||
dq 0xEEEEEEEEEEEEEEEE
|
||||
dq 0xFFFFFFFFFFFFFFFF
|
||||
dq 0xAAAAAAAAAAAAAAAA
|
||||
|
||||
dq 0xBBBBBBBBBBBBBBBB
|
||||
dq 0xDDDDDDDDDDDDDDDD
|
||||
dq 0xCCCCCCCCCCCCCCCC
|
||||
dq 0x9999999999999999
|
Loading…
Reference in New Issue
Block a user