qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] Arm emulation tweak
@ 2009-08-18 15:57 Nigel Horne
  2009-08-18 16:14 ` Jamie Lokier
  0 siblings, 1 reply; 5+ messages in thread
From: Nigel Horne @ 2009-08-18 15:57 UTC (permalink / raw)
  To: qemu-devel

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.  */

-- 
Nigel Horne. Arranger, Adjudicator, Band Trainer, Composer, Tutor, Typesetter.
NJH Music, ICQ#20252325
njh@bandsman.co.uk http://www.bandsman.co.uk

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Arm emulation tweak
  2009-08-18 15:57 [Qemu-devel] Arm emulation tweak Nigel Horne
@ 2009-08-18 16:14 ` Jamie Lokier
  2009-08-19  9:46   ` Filip Navara
  0 siblings, 1 reply; 5+ messages in thread
From: Jamie Lokier @ 2009-08-18 16:14 UTC (permalink / raw)
  To: Nigel Horne; +Cc: qemu-devel

Nigel Horne wrote:
> 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:

>      if (GET_TCGV_I32(temps[num_temps]))
>        return temps[num_temps++];
> 
> !     tmp = tcg_temp_new_i32();
> !     temps[num_temps++] = tmp;
> !     return tmp;
>  }

becomes

>      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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Arm emulation tweak
  2009-08-18 16:14 ` Jamie Lokier
@ 2009-08-19  9:46   ` Filip Navara
  2009-08-19 10:12     ` Nigel Horne
  0 siblings, 1 reply; 5+ messages in thread
From: Filip Navara @ 2009-08-19  9:46 UTC (permalink / raw)
  To: Jamie Lokier; +Cc: Nigel Horne, qemu-devel

On Tue, Aug 18, 2009 at 6:14 PM, Jamie Lokier<jamie@shareable.org> wrote:
> Nigel Horne wrote:
>> 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:
>
>>      if (GET_TCGV_I32(temps[num_temps]))
>>        return temps[num_temps++];
>>
>> !     tmp = tcg_temp_new_i32();
>> !     temps[num_temps++] = tmp;
>> !     return tmp;
>>  }
>
> becomes
>
>>      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
>

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.

F.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Arm emulation tweak
  2009-08-19  9:46   ` Filip Navara
@ 2009-08-19 10:12     ` Nigel Horne
  2009-08-19 10:38       ` Filip Navara
  0 siblings, 1 reply; 5+ messages in thread
From: Nigel Horne @ 2009-08-19 10:12 UTC (permalink / raw)
  To: qemu-devel

Filip Navara wrote:
> 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?
> F.
>   
-Nigel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] Arm emulation tweak
  2009-08-19 10:12     ` Nigel Horne
@ 2009-08-19 10:38       ` Filip Navara
  0 siblings, 0 replies; 5+ messages in thread
From: Filip Navara @ 2009-08-19 10:38 UTC (permalink / raw)
  To: Nigel Horne; +Cc: qemu-devel

On Wed, Aug 19, 2009 at 12:12 PM, Nigel Horne<njh@bandsman.co.uk> wrote:
> Filip Navara wrote:
>>
>> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-08-19 10:38 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-18 15:57 [Qemu-devel] Arm emulation tweak Nigel Horne
2009-08-18 16:14 ` Jamie Lokier
2009-08-19  9:46   ` Filip Navara
2009-08-19 10:12     ` Nigel Horne
2009-08-19 10:38       ` Filip Navara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).