Skip to contentSkip to conversation

[6936] target-mips: optimize gen_compute_branch()

Qemu-devel Aurelien Jarno 2 participants 3 messages Mar 29, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6936

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6936
Author:   aurel32
Date:     2009-03-29 01:18:52 +0000 (Sun, 29 Mar 2009)

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

Modified Paths:
--------------
trunk/target-mips/cpu.h
trunk/target-mips/machine.c
trunk/target-mips/translate.c

Modified: trunk/target-mips/cpu.h
===================================================================

target-mips/cpu.h +1 -1
@@ -443,7 +443,7 @@
 #define MIPS_HFLAG_BL     0x0C00 /* Likely branch                      */
 #define MIPS_HFLAG_BR     0x1000 /* branch to register (can't link TB) */
     target_ulong btarget;        /* Jump / branch target               */
-    int bcond;                   /* Branch condition (if needed)       */
+    target_ulong bcond;          /* Branch condition (if needed)       */
 
     int SYNCI_Step; /* Address step size for SYNCI */
     int CCRes; /* Cycle count resolution/divisor */

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

target-mips/machine.c +4 -2
@@ -91,7 +91,8 @@
     qemu_put_sbe32s(f, &env->error_code);
     qemu_put_be32s(f, &env->hflags);
     qemu_put_betls(f, &env->btarget);
-    qemu_put_sbe32s(f, &env->bcond);
+    i = env->bcond;
+    qemu_put_sbe32s(f, &i);
 
     /* Save remaining CP1 registers */
     qemu_put_sbe32s(f, &env->CP0_Index);
@@ -240,7 +241,8 @@
     qemu_get_sbe32s(f, &env->error_code);
     qemu_get_be32s(f, &env->hflags);
     qemu_get_betls(f, &env->btarget);
-    qemu_get_sbe32s(f, &env->bcond);
+    qemu_get_sbe32s(f, &i);
+    env->bcond = i;
 
     /* Load remaining CP1 registers */
     qemu_get_sbe32s(f, &env->CP0_Index);

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

target-mips/translate.c +43 -48

270 lines not on this page · raw message

#1 lore raw
Quoted 35 lines · Aurelien Jarno

Revision: 6936

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6936
Author:   aurel32
Date:     2009-03-29 01:18:52 +0000 (Sun, 29 Mar 2009)

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

Modified Paths:
--------------
trunk/target-mips/cpu.h
trunk/target-mips/machine.c
trunk/target-mips/translate.c

Modified: trunk/target-mips/cpu.h
===================================================================

target-mips/cpu.h +1 -1
@@ -443,7 +443,7 @@
 #define MIPS_HFLAG_BL     0x0C00 /* Likely branch                      */
 #define MIPS_HFLAG_BR     0x1000 /* branch to register (can't link TB) */
     target_ulong btarget;        /* Jump / branch target               */
-    int bcond;                   /* Branch condition (if needed)       */
+    target_ulong bcond;          /* Branch condition (if needed)       */
 
     int SYNCI_Step; /* Address step size for SYNCI */
     int CCRes; /* Cycle count resolution/divisor */

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

target-mips/machine.c line 96

Quoted 7 lines
target-mips/machine.c +2 -1
@@ -91,7 +91,8 @@
     qemu_put_sbe32s(f, &env->error_code);
     qemu_put_be32s(f, &env->hflags);
     qemu_put_betls(f, &env->btarget);
-    qemu_put_sbe32s(f, &env->bcond);
+    i = env->bcond;
+    qemu_put_sbe32s(f, &i);
 

bcond is now target_ulong (32 or 64 bit target), i is int. Are the upper 32 bits of bcond not needed?

target-mips/machine.c line 246

Quoted 11 lines
target-mips/machine.c +2 -1
     /* Save remaining CP1 registers */
     qemu_put_sbe32s(f, &env->CP0_Index);
@@ -240,7 +241,8 @@
     qemu_get_sbe32s(f, &env->error_code);
     qemu_get_be32s(f, &env->hflags);
     qemu_get_betls(f, &env->btarget);
-    qemu_get_sbe32s(f, &env->bcond);
+    qemu_get_sbe32s(f, &i);
+    env->bcond = i;
 

See above.

target-mips/machine.c line 248

Quoted 5 lines
target-mips/machine.c +0 -0
     /* Load remaining CP1 registers */
     qemu_get_sbe32s(f, &env->CP0_Index);

Regards

Stefan

#2 lore raw
Quoted 31 lines · Stefan Weil
Quoted 30 lines · Aurelien Jarno

Revision: 6936

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6936
Author:   aurel32
Date:     2009-03-29 01:18:52 +0000 (Sun, 29 Mar 2009)

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

Modified Paths:
--------------
trunk/target-mips/cpu.h
trunk/target-mips/machine.c
trunk/target-mips/translate.c

Modified: trunk/target-mips/cpu.h
===================================================================

target-mips/cpu.h +1 -1
@@ -443,7 +443,7 @@
 #define MIPS_HFLAG_BL     0x0C00 /* Likely branch                      */
 #define MIPS_HFLAG_BR     0x1000 /* branch to register (can't link TB) */
     target_ulong btarget;        /* Jump / branch target               */
-    int bcond;                   /* Branch condition (if needed)       */
+    target_ulong bcond;          /* Branch condition (if needed)       */
 
     int SYNCI_Step; /* Address step size for SYNCI */
     int CCRes; /* Cycle count resolution/divisor */
Quoted 15 lines

target-mips/machine.c line 96

Quoted 12 lines

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

target-mips/machine.c +2 -1
@@ -91,7 +91,8 @@
     qemu_put_sbe32s(f, &env->error_code);
     qemu_put_be32s(f, &env->hflags);
     qemu_put_betls(f, &env->btarget);
-    qemu_put_sbe32s(f, &env->bcond);
+    i = env->bcond;
+    qemu_put_sbe32s(f, &i);
 

bcond is now target_ulong (32 or 64 bit target), i is int. Are the upper 32 bits of bcond not needed?

No they are not used as this variable only contains 0 or 1, so saving only the lower 32 bits is fine.

Signature · 2 lines
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
[email protected]                 http://www.aurel32.net