mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-27 23:00:09 +01:00
Previously this could access more elements than it needs to. In the case where we pass in a 128-bit vector and perform a 128-bit operation, only two doubles should be handled, but in this case will actually try and handle four double elements. Consider converting doubles within a vector into floats: e.g. _Vector_FToF(16, 4, Src, 8) 16 is our OpSize 4 is our DestElementSize Src is our input vector 8 is the SrcElementSize (OpSize << 1) / Op->SrcElementSize becomes: (16 << 1) / 8 -> 32 / 8 -> 4 What we actually want it 2 here, we're indexing 128-bit vectors out of its bounds (not a problem now, since we assume up to 256-bit in the interpreter). Similarly with 256-bit vectors _Vector_FToF(32, 4, Src, 8) would become: 64 / 8 -> 8 where we actually want 4, since we only have 4 64-bit elements in a 256-bit vector. This corrects this in the interpreter by just special-casing the 64-bit calculation.