mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-11-14 17:26:38 +00:00
Add Sse2 fallback to Vector{Extract|Insert}Single methods on the CPU (#193)
This commit is contained in:
parent
bc26aa558a
commit
4c7c21634e
1 changed files with 23 additions and 0 deletions
|
@ -422,6 +422,15 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
return Sse41.Extract(Vector, Index);
|
return Sse41.Extract(Vector, Index);
|
||||||
}
|
}
|
||||||
|
else if (Sse2.IsSupported)
|
||||||
|
{
|
||||||
|
Vector128<ushort> ShortVector = Sse.StaticCast<float, ushort>(Vector);
|
||||||
|
|
||||||
|
int Low = Sse2.Extract(ShortVector, (byte)(Index * 2 + 0));
|
||||||
|
int High = Sse2.Extract(ShortVector, (byte)(Index * 2 + 1));
|
||||||
|
|
||||||
|
return BitConverter.Int32BitsToSingle(Low | (High << 16));
|
||||||
|
}
|
||||||
|
|
||||||
throw new PlatformNotSupportedException();
|
throw new PlatformNotSupportedException();
|
||||||
}
|
}
|
||||||
|
@ -509,6 +518,20 @@ namespace ChocolArm64.Instruction
|
||||||
{
|
{
|
||||||
return Sse41.Insert(Vector, Value, (byte)(Index << 4));
|
return Sse41.Insert(Vector, Value, (byte)(Index << 4));
|
||||||
}
|
}
|
||||||
|
else if (Sse2.IsSupported)
|
||||||
|
{
|
||||||
|
int IntValue = BitConverter.SingleToInt32Bits(Value);
|
||||||
|
|
||||||
|
ushort Low = (ushort)(IntValue >> 0);
|
||||||
|
ushort High = (ushort)(IntValue >> 16);
|
||||||
|
|
||||||
|
Vector128<ushort> ShortVector = Sse.StaticCast<float, ushort>(Vector);
|
||||||
|
|
||||||
|
ShortVector = Sse2.Insert(ShortVector, Low, (byte)(Index * 2 + 0));
|
||||||
|
ShortVector = Sse2.Insert(ShortVector, High, (byte)(Index * 2 + 1));
|
||||||
|
|
||||||
|
return Sse.StaticCast<ushort, float>(ShortVector);
|
||||||
|
}
|
||||||
|
|
||||||
throw new PlatformNotSupportedException();
|
throw new PlatformNotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue