[RFC] PowerPC flags emulation optimization

https://github.com/delroth/dolphin/commit/81404494599f9d783c3a46edc44470c372ff9f90 explains in details what this is about.

Fairly nice performance boost for CPU emulation. @JMC47 reports a 5-12% performance improvement in CPU limited situations.

Caveats: currently broken for JITIL64, JITARM and JITILARM. Since it needs to touch interpreter code, it's difficult to isolate the change from these 3 JITs, and they will have to be modified.
I think it's less ambiguous to explicitly state the s32 -> s64 extension
here. Opinions?


On Tue, Jun 24, 2014 at 8:46 AM, magumagu <notifications@github.com> wrote:

> In Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp:
>
> > -{
> > -	u32 new_cr0;
> > -	int sValue = (int)_uValue;
> > -	if (sValue > 0)
> > -		new_cr0 = 0x4;
> > -	else if (sValue < 0)
> > -		new_cr0 = 0x8;
> > -	else
> > -		new_cr0 = 0x2;
> > -	new_cr0 |= GetXER_SO();
> > -	SetCRField(0, new_cr0);
> > +void Interpreter::Helper_UpdateCR0(u32 value)
> > +{
> > +	s64 sign_extended = (s64)(s32)value;
> > +	u64 cr_val = (u64)sign_extended;
> > +	cr_val = (cr_val & ~(1ull << 61)) | ((u64)GetXER_SO() << 61);
>
> You can just write (u64)(s32)value.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/dolphin-emu/dolphin/pull/527/files#r14115156>.
>



-- 
Pierre "delroth" Bourdon <delroth@gmail.com>
Software Engineer @ Zürich, Switzerland
http://code.delroth.net/