Arm emulation tweak
This small patch reduces (on my machine) the call to new_tmp by 16 bytes, which may not sound much, but it's called so often that it makes a nice speed up of Arm emulation:
*** Otranslate.c 2009-08-18 16:52:42.000000000 +0100
--- translate.c 2009-08-18 16:53:17.000000000 +0100
***************
*** 105,120 ****
/* Allocate a temporary variable. */
static TCGv_i32 new_tmp(void)
{
- TCGv tmp;
if (num_temps == MAX_TEMPS)
abort();
if (GET_TCGV_I32(temps[num_temps]))
return temps[num_temps++];! tmp = tcg_temp_new_i32(); ! temps[num_temps++] = tmp; ! return tmp;
}
/* Release a temporary variable. */
--- 105,117 ----
/* Allocate a temporary variable. */
static TCGv_i32 new_tmp(void)
{
if (num_temps == MAX_TEMPS)
abort();
if (GET_TCGV_I32(temps[num_temps]))
return temps[num_temps++];! return temps[num_temps++] = tcg_temp_new_i32();
}
/* Release a temporary variable. */
Signature · 3 lines
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter. NJH Music, ICQ#20252325 [email protected] http://www.bandsman.co.uk
Quoted 11 lines · Nigel Horne
This small patch reduces (on my machine) the call to
new_tmpby 16 bytes, which may not sound much, but it's called so often that it makes a nice speed up of Arm emulation:if (GET_TCGV_I32(temps[num_temps])) return temps[num_temps++];! tmp = tcg_temp_new_i32(); ! temps[num_temps++] = tmp; ! return tmp;}
becomes
Quoted 5 lines
if (GET_TCGV_I32(temps[num_temps])) return temps[num_temps++];! return temps[num_temps++] =
tcg_temp_new_i32();
}
That's pretty tragic if GCC fails to compile them to identical code, assuming you had optimisation turned on.
Have you tried building with -Os, -O2 etc. to see if that makes a difference?
Which GCC version are you using?
-- Jamie
Quoted 24 lines · Jamie Lokier
Quoted 11 lines · Nigel Horne
This small patch reduces (on my machine) the call to
new_tmpby 16 bytes, which may not sound much, but it's called so often that it makes a nice speed up of Arm emulation:if (
GET_TCGV_I32(temps[num_temps]))
return temps[num_temps++];! tmp =
tcg_temp_new_i32();
! temps[num_temps++] = tmp;
! return tmp;
}becomes
Quoted 5 lines
if (
GET_TCGV_I32(temps[num_temps]))
return temps[num_temps++];! return temps[num_temps++] =
tcg_temp_new_i32(); }That's pretty tragic if GCC fails to compile them to identical code, assuming you had optimisation turned on.
Quoted 7 lines
Have you tried building with -Os, -O2 etc. to see if that makes a difference?
Which GCC version are you using?
-- Jamie
BTW, I have even better optimizations for this code atgit://repo.or.cz/qemu/navara.git. These functions are no longer needed in the form as they appear in the source code today, since TCG has evolved.
F.
Quoted 5 lines · Filip Navara
BTW, I have even better optimizations for this code at
git://repo.or.cz/qemu/navara.git. These functions are no longer needed in the form as they appear in the source code today, since TCG has evolved.
Great! Thanks for sharing, will these be making it into QEMU?
Quoted 2 lines
F.
-Nigel
Quoted 9 lines · Nigel Horne
Quoted 6 lines · Filip Navara
BTW, I have even better optimizations for this code at
git://repo.or.cz/qemu/navara.git. These functions are no longer needed in the form as they appear in the source code today, since TCG has evolved.Great! Thanks for sharing, will these be making it into QEMU?
I hope so, but nobody commented on the series since I posted it last time on the mailing list (except for private comments on IRC which are addressed now)...
Filip