Skip to contentSkip to conversation

[5675] target-mips: optimize gen_save_pc()

Qemu-devel Aurelien Jarno 2 participants 3 messages Nov 11, 2008 – Nov 12, 2008

lore
Share & tools
lore
#0 lore raw

Revision: 5675

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5675
Author:   aurel32
Date:     2008-11-11 11:36:04 +0000 (Tue, 11 Nov 2008)

Log Message:
-----------
target-mips: optimize gen_save_pc()

We obviously don't need to use a temporary variable to write PC.

Modified Paths:
--------------
trunk/target-mips/translate.c

Modified: trunk/target-mips/translate.c
===================================================================

target-mips/translate.c +1 -5
@@ -827,11 +827,7 @@
 
 static inline void gen_save_pc(target_ulong pc)
 {
-    TCGv r_tmp = tcg_temp_new(TCG_TYPE_TL);
-
-    tcg_gen_movi_tl(r_tmp, pc);
-    tcg_gen_mov_tl(cpu_PC, r_tmp);
-    tcg_temp_free(r_tmp);
+    tcg_gen_movi_tl(cpu_PC, pc);
 }
 
 static inline void save_cpu_state (DisasContext *ctx, int do_save_pc)
#1 lore raw

Am 11.11.2008 um 12:36 schrieb Aurelien Jarno:

Quoted 11 lines

Revision: 5675

         http://svn.sv.gnu.org/viewvc/? 
view=rev&root=qemu&revision=5675
Author:   aurel32
Date:     2008-11-11 11:36:04 +0000 (Tue, 11 Nov 2008)

Log Message:
-----------
target-mips: optimize gen_save_pc()

We obviously don't need to use a temporary variable to write PC.

We probably don't need an inline helper for that either, while we're at it?

Andreas

Quoted 18 lines

Modified: trunk/target-mips/translate.c
===================================================================

target-mips/translate.c +1 -5
@@ -827,11 +827,7 @@
 
 static inline void gen_save_pc(target_ulong pc)
 {
-    TCGv r_tmp = tcg_temp_new(TCG_TYPE_TL);
-
-    tcg_gen_movi_tl(r_tmp, pc);
-    tcg_gen_mov_tl(cpu_PC, r_tmp);
-    tcg_temp_free(r_tmp);
+    tcg_gen_movi_tl(cpu_PC, pc);
 }
 
 static inline void save_cpu_state (DisasContext *ctx, int do_save_pc)
#2 lore raw
Quoted 9 lines · Andreas Färber

Am 11.11.2008 um 12:36 schrieb Aurelien Jarno:

Quoted 6 lines

Revision: 5675

         http://svn.sv.gnu.org/viewvc/? 
view=rev&root=qemu&revision=5675
Author:   aurel32
Date:     2008-11-11 11:36:04 +0000 (Tue, 11 Nov 2008)
Quoted 8 lines
Quoted 5 lines

Log Message:
-----------
target-mips: optimize gen_save_pc()

We obviously don't need to use a temporary variable to write PC.

We probably don't need an inline helper for that either, while we're at it?

Well, the fact that we have an helper doesn't change the TCG generated code, and shouldn't change the host generated code if GCC is used with optimisation.

I am not sure it worth removing this function, I'll let the decision to Thiemo.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net