On 5/2/08, Adam Lackorzynski wrote: > > On Thu May 01, 2008 at 18:02:46 +0300, Blue Swirl wrote: > > On 5/1/08, Adam Lackorzynski wrote: > > > > For 64bit target T0 is 64bits so "=a" does not work and "=A" is needed. > > > The strange thing is that I need to throw away the upper 32bits because > > > otherwise it won't work. gen_func is defined to return just long but T0 > > > is unsigned long long, this seems inconsistent. The 'and' does not > > > appear in 32bit targets so it does not harm there. > > > > This is because in this special case, T0 is not used as target CPU > > temporary, but instead to return next TB address. On i386 this is 32 > > bits, so only EAX is needed. TCG does not touch EDX, so it contains > > garbage. This also means that moving EDX to high word of T0 and then > > throwing the high word away may be slightly wasteful. > > > So I played a bit more with this by trying out the 'and' and the tmp > variable approaches. With the tmp variables the generated code looks ok > whereas with the 'and' approach it looks especially scary with gcc-4.3 > (gcc-3.4 looks ok). I have two versions now, one condensed and ugly and > then one with separate parts for 32 and 64 targets. I think this one > should be prefered. I made a new version that does not use T0 at all. Tested on i386 and AMD64, both Sparc32 and Sparc64 work. AMD64 asm version does not seem to be necessary.