[+] Bgt works with 64-bit values now.

This commit is contained in:
LostTheBlack_cp 2008-04-17 22:29:21 +00:00
parent 45377fd9e6
commit 492fcb6189

View file

@ -27,26 +27,30 @@ namespace Indy.IL2CPU.IL.X86 {
if (xStackContent.Size > 8) { if (xStackContent.Size > 8) {
throw new Exception("StackSize>8 not supported"); throw new Exception("StackSize>8 not supported");
} }
new CPUx86.Pop(CPUx86.Registers.EAX); if (xStackContent.Size > 4)
if (xStackContent.Size > 4) { {
throw new NotImplementedException("long comprasion is not implemented"); //target label is then value1 >= value2
new CPUx86.Add("esp", "4"); new CPUx86.Pop(CPUx86.Registers.EAX);
} new CPUx86.Pop(CPUx86.Registers.EDX);
new CPUx86.Compare(CPUx86.Registers.EAX, CPUx86.Registers.AtESP); //value2: EDX:EAX
new CPUx86.JumpIfGreater(LabelTrue); new CPUx86.Pop("ebx");
new CPUx86.JumpAlways(LabelFalse); new CPUx86.Pop("ecx");
new CPU.Label(LabelTrue); //value1: ECX:EBX
new CPUx86.Add(CPUx86.Registers.ESP, "4"); new CPUx86.Sub("ebx", "eax");
if (xStackContent.Size > 4) { new CPUx86.SubWithCarry("ecx", "edx");
throw new NotImplementedException("long comprasion is not implemented"); //result = value2 - value1
new CPUx86.Add("esp", "4"); new CPUx86.JumpOnGreater(TargetLabel);
} }else
new CPUx86.JumpAlways(TargetLabel); {
new CPU.Label(LabelFalse); new CPUx86.Pop(CPUx86.Registers.EAX);
new CPUx86.Add(CPUx86.Registers.ESP, "4"); new CPUx86.Compare(CPUx86.Registers.EAX, CPUx86.Registers.AtESP);
if (xStackContent.Size > 4) { new CPUx86.JumpIfGreater(LabelTrue);
throw new NotImplementedException("long comprasion is not implemented"); new CPUx86.JumpAlways(LabelFalse);
new CPUx86.Add("esp", "4"); new CPU.Label(LabelTrue);
new CPUx86.Add(CPUx86.Registers.ESP, "4");
new CPUx86.JumpAlways(TargetLabel);
new CPU.Label(LabelFalse);
new CPUx86.Add(CPUx86.Registers.ESP, "4");
} }
} }
} }