BITSCAN lazy flags evaluation optimization
This commit is contained in:
parent
1a55835155
commit
aa00d33640
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: bit.cc,v 1.42 2007-11-25 20:22:06 sshwarts Exp $
|
||||
// $Id: bit.cc,v 1.43 2007-11-29 21:52:16 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -276,7 +276,8 @@ void BX_CPU_C::BSF_GwEw(bxInstruction_c *i)
|
||||
op2_16 >>= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_16(op1_16, BX_INSTR_BITSCAN16);
|
||||
SET_FLAGS_OSZAPC_LOGIC_16(op1_16);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_16BIT_REG(i->nnn(), op1_16);
|
||||
@ -307,7 +308,8 @@ void BX_CPU_C::BSF_GdEd(bxInstruction_c *i)
|
||||
op2_32 >>= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_32(op1_32, BX_INSTR_BITSCAN32);
|
||||
SET_FLAGS_OSZAPC_LOGIC_32(op1_32);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
|
||||
@ -339,7 +341,8 @@ void BX_CPU_C::BSF_GqEq(bxInstruction_c *i)
|
||||
op2_64 >>= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_64(op1_64, BX_INSTR_BITSCAN64);
|
||||
SET_FLAGS_OSZAPC_LOGIC_64(op1_64);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_64BIT_REG(i->nnn(), op1_64);
|
||||
@ -370,7 +373,8 @@ void BX_CPU_C::BSR_GwEw(bxInstruction_c *i)
|
||||
op2_16 <<= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_16(op1_16, BX_INSTR_BITSCAN16);
|
||||
SET_FLAGS_OSZAPC_LOGIC_16(op1_16);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_16BIT_REG(i->nnn(), op1_16);
|
||||
@ -401,7 +405,8 @@ void BX_CPU_C::BSR_GdEd(bxInstruction_c *i)
|
||||
op2_32 <<= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_32(op1_32, BX_INSTR_BITSCAN32);
|
||||
SET_FLAGS_OSZAPC_LOGIC_32(op1_32);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_32BIT_REGZ(i->nnn(), op1_32);
|
||||
@ -433,7 +438,8 @@ void BX_CPU_C::BSR_GqEq(bxInstruction_c *i)
|
||||
op2_64 <<= 1;
|
||||
}
|
||||
|
||||
SET_FLAGS_OSZAPC_RESULT_64(op1_64, BX_INSTR_BITSCAN64);
|
||||
SET_FLAGS_OSZAPC_LOGIC_64(op1_64);
|
||||
clear_ZF();
|
||||
|
||||
/* now write result back to destination */
|
||||
BX_WRITE_64BIT_REG(i->nnn(), op1_64);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: lazy_flags.cc,v 1.37 2007-11-29 21:45:10 sshwarts Exp $
|
||||
// $Id: lazy_flags.cc,v 1.38 2007-11-29 21:52:16 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -161,11 +161,8 @@ bx_bool BX_CPU_C::get_CFLazy(void)
|
||||
case BX_INSTR_LOGIC8:
|
||||
case BX_INSTR_LOGIC16:
|
||||
case BX_INSTR_LOGIC32:
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
#if BX_SUPPORT_X86_64
|
||||
case BX_INSTR_LOGIC64:
|
||||
case BX_INSTR_BITSCAN64:
|
||||
#endif
|
||||
cf = 0;
|
||||
break;
|
||||
@ -366,11 +363,8 @@ bx_bool BX_CPU_C::get_AFLazy(void)
|
||||
case BX_INSTR_LOGIC8:
|
||||
case BX_INSTR_LOGIC16:
|
||||
case BX_INSTR_LOGIC32:
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
#if BX_SUPPORT_X86_64
|
||||
case BX_INSTR_LOGIC64:
|
||||
case BX_INSTR_BITSCAN64:
|
||||
case BX_INSTR_SAR64:
|
||||
case BX_INSTR_SHR64:
|
||||
case BX_INSTR_SHRD64:
|
||||
@ -521,13 +515,6 @@ bx_bool BX_CPU_C::get_ZFLazy(void)
|
||||
zf = (BX_CPU_THIS_PTR oszapc.result_64 == 0);
|
||||
break;
|
||||
#endif
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
#if BX_SUPPORT_X86_64
|
||||
case BX_INSTR_BITSCAN64:
|
||||
#endif
|
||||
zf = 0;
|
||||
break;
|
||||
default:
|
||||
zf = 0;
|
||||
BX_PANIC(("get_ZF: OSZAPC: unknown instr"));
|
||||
@ -606,7 +593,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
|
||||
case BX_INSTR_SHR16:
|
||||
case BX_INSTR_SHRD16:
|
||||
case BX_INSTR_SHL16:
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_IMUL16:
|
||||
case BX_INSTR_MUL16:
|
||||
sf = (BX_CPU_THIS_PTR oszapc.result_16 >= 0x8000);
|
||||
@ -621,7 +607,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
|
||||
case BX_INSTR_SHR32:
|
||||
case BX_INSTR_SHRD32:
|
||||
case BX_INSTR_SHL32:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
case BX_INSTR_IMUL32:
|
||||
case BX_INSTR_MUL32:
|
||||
sf = (BX_CPU_THIS_PTR oszapc.result_32 >= 0x80000000);
|
||||
@ -637,7 +622,6 @@ bx_bool BX_CPU_C::get_SFLazy(void)
|
||||
case BX_INSTR_SHR64:
|
||||
case BX_INSTR_SHRD64:
|
||||
case BX_INSTR_SHL64:
|
||||
case BX_INSTR_BITSCAN64:
|
||||
case BX_INSTR_IMUL64:
|
||||
case BX_INSTR_MUL64:
|
||||
sf = (BX_CPU_THIS_PTR oszapc.result_64 >= BX_CONST64(0x8000000000000000));
|
||||
@ -777,14 +761,11 @@ bx_bool BX_CPU_C::get_OFLazy(void)
|
||||
case BX_INSTR_LOGIC8:
|
||||
case BX_INSTR_LOGIC16:
|
||||
case BX_INSTR_LOGIC32:
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
case BX_INSTR_SAR8:
|
||||
case BX_INSTR_SAR16:
|
||||
case BX_INSTR_SAR32:
|
||||
#if BX_SUPPORT_X86_64
|
||||
case BX_INSTR_LOGIC64:
|
||||
case BX_INSTR_BITSCAN64:
|
||||
case BX_INSTR_SAR64:
|
||||
#endif
|
||||
of = 0;
|
||||
@ -998,7 +979,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
|
||||
case BX_INSTR_SHR16:
|
||||
case BX_INSTR_SHRD16:
|
||||
case BX_INSTR_SHL16:
|
||||
case BX_INSTR_BITSCAN16:
|
||||
case BX_INSTR_IMUL16:
|
||||
case BX_INSTR_MUL16:
|
||||
pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.result_16];
|
||||
@ -1013,7 +993,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
|
||||
case BX_INSTR_SHR32:
|
||||
case BX_INSTR_SHRD32:
|
||||
case BX_INSTR_SHL32:
|
||||
case BX_INSTR_BITSCAN32:
|
||||
case BX_INSTR_IMUL32:
|
||||
case BX_INSTR_MUL32:
|
||||
pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.result_32];
|
||||
@ -1029,7 +1008,6 @@ bx_bool BX_CPU_C::get_PFLazy(void)
|
||||
case BX_INSTR_SHR64:
|
||||
case BX_INSTR_SHRD64:
|
||||
case BX_INSTR_SHL64:
|
||||
case BX_INSTR_BITSCAN64:
|
||||
case BX_INSTR_IMUL64:
|
||||
case BX_INSTR_MUL64:
|
||||
pf = bx_parity_lookup[(Bit8u) BX_CPU_THIS_PTR oszapc.result_64];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: lazy_flags.h,v 1.24 2007-11-20 17:15:33 sshwarts Exp $
|
||||
// $Id: lazy_flags.h,v 1.25 2007-11-29 21:52:16 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -79,10 +79,10 @@
|
||||
#define BX_INSTR_LOGIC32 31
|
||||
#define BX_INSTR_LOGIC64 32
|
||||
|
||||
// BX_INSTR_BITSCAN8 not exists, leave number for alignment
|
||||
#define BX_INSTR_BITSCAN16 34
|
||||
#define BX_INSTR_BITSCAN32 35
|
||||
#define BX_INSTR_BITSCAN64 36
|
||||
// BX_INSTR_SHRD8 not exists, leave number for alignment
|
||||
#define BX_INSTR_SHRD16 34
|
||||
#define BX_INSTR_SHRD32 35
|
||||
#define BX_INSTR_SHRD64 36
|
||||
|
||||
#define BX_INSTR_SHL8 37
|
||||
#define BX_INSTR_SHL16 38
|
||||
@ -109,12 +109,6 @@
|
||||
#define BX_INSTR_IMUL32 55
|
||||
#define BX_INSTR_IMUL64 56
|
||||
|
||||
// BX_INSTR_SHRD8 not exists, leave number for alignment
|
||||
#define BX_INSTR_SHRD16 58
|
||||
#define BX_INSTR_SHRD32 59
|
||||
#define BX_INSTR_SHRD64 60
|
||||
|
||||
|
||||
#define BX_LF_INDEX_OSZAPC 1
|
||||
#define BX_LF_INDEX_OSZAP 2
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user