Skip to contentSkip to conversation

qemu hw/mips_r4k.c target-mips/cpu.h target-mip...

Qemu-devel Thiemo Seufer 3 participants 6 messages Dec 21, 2006

lore
Share & tools
lore
#0 lore raw
#1 lore raw

You should suppress the SIGN_EXTEND32() macro and just use an 'int32_t' cast...

Fabrice.

Quoted 34 lines · Thiemo Seufer

CVSROOT: /sources/qemu
Module name: qemu
Changes by: Thiemo Seufer <ths> 06/12/21 01:19:56

Modified files:
hw : mips_r4k.c
target-mips : cpu.h exec.h fop_template.c helper.c
mips-defs.h op.c op_helper.c op_helper_mem.c op_mem.c op_template.c translate.c

Log message:
Preliminiary MIPS64 support, disabled by default due to performance impact.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/qemu/hw/mips_r4k.c?cvsroot=qemu&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/cpu.h?cvsroot=qemu&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/exec.h?cvsroot=qemu&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/fop_template.c?cvsroot=qemu&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/helper.c?cvsroot=qemu&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/mips-defs.h?cvsroot=qemu&r1=1.5&r2=1.6
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op.c?cvsroot=qemu&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op_helper.c?cvsroot=qemu&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op_helper_mem.c?cvsroot=qemu&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op_mem.c?cvsroot=qemu&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/op_template.c?cvsroot=qemu&r1=1.1&r2=1.2
http://cvs.savannah.gnu.org/viewcvs/qemu/target-mips/translate.c?cvsroot=qemu&r1=1.28&r2=1.29

_______________________________________________
Qemu-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/qemu-devel

#2 lore raw
Quoted 2 lines · Fabrice Bellard

You should suppress the SIGN_EXTEND32() macro and just use an 'int32_t' cast...

Then it may not work. A MIPS64 CPU requires properly sign-extended 32bit values. Host architectures can define either sign- or zero- Extension for 32bit values in 64bit Registers.

Thiemo

#3 lore raw
Quoted 7 lines · Thiemo Seufer
Quoted 2 lines · Fabrice Bellard

You should suppress the SIGN_EXTEND32() macro and just use an 'int32_t' cast...

Then it may not work. A MIPS64 CPU requires properly sign-extended 32bit values. Host architectures can define either sign- or zero- Extension for 32bit values in 64bit Registers.

Which makes no sense on a seond thought, as we support only 2-complement machines anyway. I'll try to get rid of the SIGN_EXTEND32.

Thiemo

#4 lore raw
In reply to Thiemo Seufer
Quoted 7 lines · Thiemo Seufer
Quoted 2 lines · Fabrice Bellard

You should suppress the SIGN_EXTEND32() macro and just use an 'int32_t' cast...

Then it may not work. A MIPS64 CPU requires properly sign-extended 32bit values. Host architectures can define either sign- or zero- Extension for 32bit values in 64bit Registers.

Whether or not it works, GCC *WILL* optimize it away as a redundant statement, if it deems so (i.e., if it's called with some flag that enables cse/gcse and peephole optimizations, and the variable(s) in question is(are) not declared volatile).

IMHO macros like these SHOULD stay, as they are mostly innocuous and happen to document the target machine behaviour.

Cheers,
A.

#5 lore raw
Quoted 11 lines · André Braga
Quoted 7 lines · Thiemo Seufer
Quoted 2 lines · Fabrice Bellard

You should suppress the SIGN_EXTEND32() macro and just use an 'int32_t' cast...

Then it may not work. A MIPS64 CPU requires properly sign-extended 32bit values. Host architectures can define either sign- or zero- Extension for 32bit values in 64bit Registers.

Whether or not it works, GCC *WILL* optimize it away as a redundant statement,

Only iff it is redundant, which is what we want to achieve.

Quoted 3 lines

if it deems so (i.e., if it's called with some flag that enables cse/gcse and peephole optimizations, and the variable(s) in question is(are) not declared volatile).

Currently it appears to work as is. Given that the CPU env is a global it is unlikely gcc can use fancy optimizations. When compiling with -combine we may need to declare the emulated machine registers volatile.

Quoted 2 lines

IMHO macros like these SHOULD stay, as they are mostly innocuous and happen to document the target machine behaviour.

I disagree, it clutters the source more, and a cast provides the same information.

Thiemo