Am 10.09.2012 16:08, schrieb Richard Henderson:
On Sat, 2012-09-08 at 16:12 +0200, Stefan Weil wrote:
+ tmp16 = *tb_ptr++;
+ tmp8 = *tb_ptr++;
+ tmp32 = (((1<< tmp8) - 1)<< tmp16);
+ tci_write_reg32(t0, (t1& ~tmp32) | ((t2<< tmp16)&
tmp32));
Use the deposit* functions from bitops.h?
r~
Well, that would justify their existence in bitops.h, wouldn't it?
When I wrote deposit for TCI (November 2011), there still
was no bitops.h, and I was just too lazy to modify and test the
code again.
Now I tested code with both my version (with a small correction for
the 64 bit variant) and with the deposit* functions.
Both variants give identical results. The deposit* variant
creates larger (and I expect also less efficient) code.
I doubt that the effect will be measurable in a system emulation.
Results with 64 bit Debian Linux:
my variant
6909 0 128 7037 1b7d
bin/ndebug/x86-tci/i386-linux-user/tci.o
6975 0 128 7103 1bbf
bin/ndebug/x86-tci/i386-softmmu/tci.o
6917 0 128 7045 1b85
bin/ndebug/x86-tci/x86_64-linux-user/tci.o
6972 0 128 7100 1bbc
bin/ndebug/x86-tci/x86_64-softmmu/tci.o
deposit*
6935 0 128 7063 1b97
bin/ndebug/x86-tci/i386-linux-user/tci.o
7000 0 128 7128 1bd8
bin/ndebug/x86-tci/i386-softmmu/tci.o
6963 0 128 7091 1bb3
bin/ndebug/x86-tci/x86_64-linux-user/tci.o
6997 0 128 7125 1bd5
bin/ndebug/x86-tci/x86_64-softmmu/tci.o
Other emulation targets show similar differences.
On a Windows host, the difference was smaller, but still in favour of my
code.
Regards,
Stefan