[6203] CRIS: Speedup btst by using a helper.
Revision: 6203
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6203 Author: edgar_igl Date: 2009-01-07 13:11:22 +0000 (Wed, 07 Jan 2009)
Log Message:
-----------
CRIS: Speedup btst by using a helper.
Signed-off-by Edgar E. Iglesias <[email protected]>
Modified Paths:
--------------
trunk/target-cris/helper.h
trunk/target-cris/op_helper.c
trunk/target-cris/translate.c
Modified: trunk/target-cris/helper.h
===================================================================
target-cris/helper.h +2 -0
@@ -10,6 +10,8 @@ DEF_HELPER_2(movl_sreg_reg, void, i32, i32) DEF_HELPER_2(movl_reg_sreg, void, i32, i32) +DEF_HELPER_FLAGS_3 (btst,TCG_CALL_PURE , i32, i32, i32, i32); + DEF_HELPER_0(evaluate_flags_muls, void) DEF_HELPER_0(evaluate_flags_mulu, void)DEF_HELPER_0 (evaluate_flags_mcp, void)
Modified: trunk/target-cris/op_helper.c
===================================================================
target-cris/op_helper.c +26 -0
@@ -243,6 +243,32 @@ env->pregs[PR_CCS ] |=M_FLAG ; } +uint32_t helper_btst (uint32_t t0,uint32_t t1,uint32_t ccs) +{ +/* FIXME: clean this up. */ + +/* des ref: +The N flag is set according to the selected bit in the dest reg. +The Z flag is set if the selected bit and all bits to the right are +zero. +The X flag is cleared. +Other flags are left untouched. +The destination reg is not affected.*/ +unsigned int fz, sbit, bset, mask, masked_t0; + + sbit = t1 &31 ; + bset = !!(t0 & (1 << sbit)); + mask = sbit ==31 ?-1 : (1 << (sbit +1 )) -1 ; + masked_t0 = t0 & mask; + fz = !(masked_t0 | bset); + +/* Clear the X, N and Z flags. */ + ccs = ccs & ~(X_FLAG |N_FLAG |Z_FLAG ); +/* Set the N and Z flags accordingly. */ + ccs |= (bset <<3 ) | (fz <<2 ); +return ccs; +} +static void evaluate_flags_writeback (uint32_t flags) {unsigned int x, z, mask;
Modified: trunk/target-cris/translate.c
===================================================================
target-cris/translate.c +11 -74
126 lines not on this page · raw message