From fafc04a59e7e6030376d38532926c6d45dbcb91f Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 21 Oct 2024 09:34:59 -0700 Subject: [PATCH] OpcodeDispatcher/AVX128: Fixes glibc allocation --- .../Core/OpcodeDispatcher/AVX_128.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/FEXCore/Source/Interface/Core/OpcodeDispatcher/AVX_128.cpp b/FEXCore/Source/Interface/Core/OpcodeDispatcher/AVX_128.cpp index cca2f08c0b..ecd621bc3d 100644 --- a/FEXCore/Source/Interface/Core/OpcodeDispatcher/AVX_128.cpp +++ b/FEXCore/Source/Interface/Core/OpcodeDispatcher/AVX_128.cpp @@ -1874,11 +1874,23 @@ void OpDispatchBuilder::AVX128_VPERMQ(OpcodeArgs) { void OpDispatchBuilder::AVX128_VPSHUFW(OpcodeArgs, bool Low) { auto Shuffle = Op->Src[1].Literal(); - AVX128_VectorUnaryImpl(Op, GetSrcSize(Op), OpSize::i16Bit, [this, Shuffle, Low](size_t _, Ref Src) { - const auto IndexedVectorConstant = Low ? FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_PSHUFLW : - FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_PSHUFHW; + struct DataPacking { + OpDispatchBuilder* This; + uint8_t Shuffle; + bool Low; + }; + + DataPacking Pack { + .This = this, + .Shuffle = static_cast(Shuffle), + .Low = Low, + }; + + AVX128_VectorUnaryImpl(Op, GetSrcSize(Op), OpSize::i16Bit, [Pack](size_t _, Ref Src) { + const auto IndexedVectorConstant = Pack.Low ? FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_PSHUFLW : + FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_PSHUFHW; - return PShufWLane(OpSize::i128Bit, IndexedVectorConstant, Low, Src, Shuffle); + return Pack.This->PShufWLane(OpSize::i128Bit, IndexedVectorConstant, Pack.Low, Src, Pack.Shuffle); }); }