diff --git a/ARMeilleure/CodeGen/X86/CodeGenerator.cs b/ARMeilleure/CodeGen/X86/CodeGenerator.cs index e217a6658..5c9fcd890 100644 --- a/ARMeilleure/CodeGen/X86/CodeGenerator.cs +++ b/ARMeilleure/CodeGen/X86/CodeGenerator.cs @@ -1148,62 +1148,52 @@ namespace ARMeilleure.CodeGen.X86 byte index = src2.AsByte(); + Debug.Assert(index < OperandType.V128.GetSizeInBytes() / dest.Type.GetSizeInBytes()); + if (dest.Type == OperandType.I32) { - Debug.Assert(index < 4); - - if (HardwareCapabilities.SupportsSse41) + if (index == 0) + { + context.Assembler.Movd(dest, src1); + } + else if (HardwareCapabilities.SupportsSse41) { context.Assembler.Pextrd(dest, src1, index); } else { - if (index != 0) - { - int mask0 = 0b11_10_01_00; - int mask1 = 0b11_10_01_00; + int mask0 = 0b11_10_01_00; + int mask1 = 0b11_10_01_00; - mask0 = BitUtils.RotateRight(mask0, index * 2, 8); - mask1 = BitUtils.RotateRight(mask1, 8 - index * 2, 8); + mask0 = BitUtils.RotateRight(mask0, index * 2, 8); + mask1 = BitUtils.RotateRight(mask1, 8 - index * 2, 8); - context.Assembler.Pshufd(src1, src1, (byte)mask0); - context.Assembler.Movd (dest, src1); - context.Assembler.Pshufd(src1, src1, (byte)mask1); - } - else - { - context.Assembler.Movd(dest, src1); - } + context.Assembler.Pshufd(src1, src1, (byte)mask0); + context.Assembler.Movd (dest, src1); + context.Assembler.Pshufd(src1, src1, (byte)mask1); } } else if (dest.Type == OperandType.I64) { - Debug.Assert(index < 2); - - if (HardwareCapabilities.SupportsSse41) + if (index == 0) + { + context.Assembler.Movq(dest, src1); + } + else if (HardwareCapabilities.SupportsSse41) { context.Assembler.Pextrq(dest, src1, index); } else { - if (index != 0) - { - const byte mask = 0b01_00_11_10; + const byte mask = 0b01_00_11_10; - context.Assembler.Pshufd(src1, src1, mask); - context.Assembler.Movq (dest, src1); - context.Assembler.Pshufd(src1, src1, mask); - } - else - { - context.Assembler.Movq(dest, src1); - } + context.Assembler.Pshufd(src1, src1, mask); + context.Assembler.Movq (dest, src1); + context.Assembler.Pshufd(src1, src1, mask); } } else { - Debug.Assert(index < (dest.Type == OperandType.FP32 ? 4 : 2)); - // Floating-point types. if ((index >= 2 && dest.Type == OperandType.FP32) || (index == 1 && dest.Type == OperandType.FP64)) diff --git a/ARMeilleure/Translation/PTC/Ptc.cs b/ARMeilleure/Translation/PTC/Ptc.cs index ae92d4f39..1affa4279 100644 --- a/ARMeilleure/Translation/PTC/Ptc.cs +++ b/ARMeilleure/Translation/PTC/Ptc.cs @@ -20,7 +20,7 @@ namespace ARMeilleure.Translation.PTC { private const string HeaderMagic = "PTChd"; - private const int InternalVersion = 14; //! To be incremented manually for each change to the ARMeilleure project. + private const int InternalVersion = 17; //! To be incremented manually for each change to the ARMeilleure project. private const string BaseDir = "Ryujinx";