diff --git a/source2/Compiler/Cosmos.Compiler.Assembler.X86/Cosmos.Compiler.Assembler.X86.csproj b/source2/Compiler/Cosmos.Compiler.Assembler.X86/Cosmos.Compiler.Assembler.X86.csproj
index dd3a7051e..7c4a22a92 100644
--- a/source2/Compiler/Cosmos.Compiler.Assembler.X86/Cosmos.Compiler.Assembler.X86.csproj
+++ b/source2/Compiler/Cosmos.Compiler.Assembler.X86/Cosmos.Compiler.Assembler.X86.csproj
@@ -126,9 +126,11 @@
+
+
@@ -212,7 +214,7 @@
-
+
@@ -258,7 +260,6 @@
-
diff --git a/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE2/ConvertSD2SI.cs b/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE2/ConvertSD2SI.cs
new file mode 100644
index 000000000..41194d2ec
--- /dev/null
+++ b/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE2/ConvertSD2SI.cs
@@ -0,0 +1,7 @@
+namespace Cosmos.Compiler.Assembler.X86.SSE
+{
+ [OpCode("CVTSD2SI")]
+ public class ConvertSD2SI : InstructionWithDestinationAndSource
+ {
+ }
+}
\ No newline at end of file
diff --git a/source2/Compiler/Cosmos.Compiler.Assembler.X86/x87/IntStoreWithTrunc.cs b/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE3/IntStoreWithTrunc.cs
similarity index 100%
rename from source2/Compiler/Cosmos.Compiler.Assembler.X86/x87/IntStoreWithTrunc.cs
rename to source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE3/IntStoreWithTrunc.cs
diff --git a/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE3/MoveDoubleAndDupplicate.cs b/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE3/MoveDoubleAndDupplicate.cs
new file mode 100644
index 000000000..12fb5d5b2
--- /dev/null
+++ b/source2/Compiler/Cosmos.Compiler.Assembler.X86/SSE3/MoveDoubleAndDupplicate.cs
@@ -0,0 +1,7 @@
+namespace Cosmos.Compiler.Assembler.X86.SSE
+{
+ [OpCode("MOVDDUP")]
+ public class MoveDoubleAndDupplicate : InstructionWithDestinationAndSource
+ {
+ }
+}
\ No newline at end of file
diff --git a/source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Conv_I4.cs b/source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Conv_I4.cs
index fec00027c..2756a134e 100644
--- a/source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Conv_I4.cs
+++ b/source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Conv_I4.cs
@@ -17,12 +17,7 @@ namespace Cosmos.IL2CPU.X86.IL
public override void Execute( MethodInfo aMethod, ILOpCode aOpCode )
{
var xSource = Assembler.Stack.Pop();
- if (xSource.IsFloat)
- {
- new CPUx86.SSE.MoveSS { SourceReg = CPUx86.Registers.ESP, DestinationReg = CPUx86.Registers.XMM0, SourceIsIndirect = true };
- new CPUx86.SSE.ConvertSS2SI { SourceReg = CPUx86.Registers.XMM0, DestinationReg = CPUx86.Registers.EAX };
- new CPUx86.Move { DestinationReg = CPUx86.Registers.ESP, SourceReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
- }
+
switch( xSource.Size )
{
@@ -30,10 +25,23 @@ namespace Cosmos.IL2CPU.X86.IL
case 2:
case 4:
{
+ if (xSource.IsFloat)
+ {
+ new CPUx86.SSE.MoveSS { DestinationReg = CPUx86.Registers.XMM0, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true };
+ new CPUx86.SSE.ConvertSS2SI { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.XMM0 };
+ new CPUx86.Move { DestinationReg = CPUx86.Registers.ESP, SourceReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
+ }
break;
}
case 8:
{
+ if (xSource.IsFloat)
+ {
+ new CPUx86.SSE.MoveDoubleAndDupplicate { DestinationReg = CPUx86.Registers.XMM0, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true };
+ new CPUx86.SSE.ConvertSD2SI { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.XMM0 };
+ new CPUx86.Move { DestinationReg = CPUx86.Registers.ESP, SourceReg = CPUx86.Registers.EAX, DestinationIsIndirect = true };
+ }
+
new CPUx86.Pop { DestinationReg = CPUx86.Registers.EAX };
new CPUx86.Add { DestinationReg = CPUx86.Registers.ESP, SourceValue = 4 };
new CPUx86.Push { DestinationReg = CPUx86.Registers.EAX };