Small code optimization

This commit is contained in:
Stanislav Shwartsman 2008-06-09 19:35:59 +00:00
parent 45c64ff16c
commit aff775bce4
2 changed files with 42 additions and 46 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode.cc,v 1.189 2008-05-02 22:47:07 sshwarts Exp $
// $Id: fetchdecode.cc,v 1.190 2008-06-09 19:35:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -2487,6 +2487,14 @@ fetch_b1:
ilen++;
switch (b1) {
case 0x0f: // 2-byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;
break;
}
return(0);
case 0x66: // OpSize
BX_INSTR_PREFIX(BX_CPU_ID, b1);
os_32 = !is_32;
@ -2569,14 +2577,6 @@ fetch_b1:
goto fetch_b1;
}
return(0);
case 0x0f: // 2-byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;
break;
}
return(0);
default:
break;
}
@ -2956,16 +2956,15 @@ modrm_done:
ia_opcode = Bx3DNowOpcodeInfo[i->modRMForm.Ib].IA;
#endif
i->execute = BxOpcodesTable[ia_opcode];
if (BX_NULL_SEG_REG(i->seg()))
i->setSeg(BX_SEG_REG_DS);
#if BX_SUPPORT_TRACE_CACHE
if ((attr & BxTraceEnd) ||
(i->execute == &BX_CPU_C::BxError)) i->setStopTraceAttr();
if ((attr & BxTraceEnd) || ia_opcode == BX_IA_ERROR)
i->setStopTraceAttr();
#endif
i->execute = BxOpcodesTable[ia_opcode];
i->setB1(b1);
i->setILen(ilen);

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: fetchdecode64.cc,v 1.198 2008-05-08 21:34:22 sshwarts Exp $
// $Id: fetchdecode64.cc,v 1.199 2008-06-09 19:35:59 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2001 MandrakeSoft S.A.
@ -3376,26 +3376,6 @@ fetch_b1:
ilen++;
switch (b1) {
case 0x66: // OpSize
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
if(!sse_prefix) sse_prefix = SSE_PREFIX_66;
if (!i->os64L()) {
i->setOs32B(0);
offset = 0;
}
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x67: // AddrSize
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
i->setAs64B(0);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x40:
case 0x41:
case 0x42:
@ -3418,6 +3398,14 @@ fetch_b1:
goto fetch_b1;
}
return(0);
case 0x0f: // 2 byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;
break;
}
return(0);
case 0xf2: // REPNE/REPNZ
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
@ -3436,6 +3424,24 @@ fetch_b1:
goto fetch_b1;
}
return(0);
case 0x66: // OpSize
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
if(!sse_prefix) sse_prefix = SSE_PREFIX_66;
i->setOs32B(0);
offset = 0;
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x67: // AddrSize
BX_INSTR_PREFIX(BX_CPU_ID, b1);
rex_prefix = 0;
i->setAs64B(0);
if (ilen < remain) {
goto fetch_b1;
}
return(0);
case 0x2e: // CS:
case 0x26: // ES:
case 0x36: // SS:
@ -3471,14 +3477,6 @@ fetch_b1:
goto fetch_b1;
}
return(0);
case 0x0f: // 2 byte escape
i->setOpcodeExtension();
if (ilen < remain) {
ilen++;
b1 = 0x100 | *iptr++;
break;
}
return(0);
default:
break;
}
@ -3864,16 +3862,15 @@ modrm_done:
ia_opcode = Bx3DNowOpcodeInfo[i->modRMForm.Ib].IA;
#endif
i->execute = BxOpcodesTable[ia_opcode];
if (BX_NULL_SEG_REG(i->seg()))
i->setSeg(BX_SEG_REG_DS);
#if BX_SUPPORT_TRACE_CACHE
if ((attr & BxTraceEnd) ||
(i->execute == &BX_CPU_C::BxError)) i->setStopTraceAttr();
if ((attr & BxTraceEnd) || ia_opcode == BX_IA_ERROR)
i->setStopTraceAttr();
#endif
i->execute = BxOpcodesTable[ia_opcode];
i->setB1(b1);
i->setILen(ilen);