On 03/30/2012 07:42 AM, Richard Henderson wrote: > All of your helpers, whereever they receive or return a register value, need > to use > type target_ulong and the DEF_HELPER lines need to use "tl". All of the > mips32 > helpers you've written so far that return values need to make sure to > sign-extend > their results from 32-bits.
Hmm, actually I wonder if that's the best advice. It looks like your translated code isn't going to work well with r0. I suspect it would be better to add a gen_load_gpr32 function for the translator that (1) sets 0 for r0, (2a) copies the register for mips32, and (2b) truncates the register for mips64. That way 32-bit hosts do not need to use 64-bit arithmetic when unnecessary. You'd need a gen_store_gpr32 function as well, which for mips64 sign-extends the value. r~