Re: [Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation

2011-12-10 Thread Andreas Gustafsson
malc wrote: > > Inefficient in what way? The generated code only grows by a single > > unconditional branch. > > The generated code grows by a memory write Yes, an additional store instruction is generated, but the number of store instructions *executed* does not change. The original code alrea

Re: [Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation

2011-12-10 Thread malc
On Sat, 10 Dec 2011, Andreas Gustafsson wrote: > malc wrote: > > On Sat, 10 Dec 2011, Andreas Gustafsson wrote: > > > > > When the i386 cmpxchg instruction is executed with a memory operand > > > and the comparison result is "unequal", do the memory write before > > > changing the accumulator ins

Re: [Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation

2011-12-10 Thread Andreas Gustafsson
malc wrote: > On Sat, 10 Dec 2011, Andreas Gustafsson wrote: > > > When the i386 cmpxchg instruction is executed with a memory operand > > and the comparison result is "unequal", do the memory write before > > changing the accumulator instead of the other way around, because > > otherwise the new

Re: [Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation

2011-12-10 Thread malc
On Sat, 10 Dec 2011, Andreas Gustafsson wrote: > When the i386 cmpxchg instruction is executed with a memory operand > and the comparison result is "unequal", do the memory write before > changing the accumulator instead of the other way around, because > otherwise the new accumulator value will i

[Qemu-devel] [PATCH] target-i386: fix cmpxchg instruction emulation

2011-12-10 Thread Andreas Gustafsson
When the i386 cmpxchg instruction is executed with a memory operand and the comparison result is "unequal", do the memory write before changing the accumulator instead of the other way around, because otherwise the new accumulator value will incorrectly be used in the comparison when the instructio