mirror of
https://github.com/libretro/ppsspp.git
synced 2025-02-26 11:45:26 +00:00
Optimize ANDI2R() to use UBFX if possible.
This way, & 0x7FF or & 0xFFFF etc. are all fast when on ARMv7.
This commit is contained in:
parent
3a07924ad9
commit
836787d19a
@ -228,6 +228,27 @@ bool ARMXEmitter::TryANDI2R(ARMReg rd, ARMReg rs, u32 val)
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
#ifdef HAVE_ARMV7
|
||||
// Check if we have a single pattern of sequential bits.
|
||||
int seq = -1;
|
||||
for (int i = 0; i < 32; ++i) {
|
||||
if (((val >> i) & 1) == 0) {
|
||||
if (seq == -1) {
|
||||
// The width is all bits previous to this, set to 1.
|
||||
seq = i;
|
||||
}
|
||||
} else if (seq != -1) {
|
||||
// Uh oh, more than one sequence.
|
||||
seq = -2;
|
||||
}
|
||||
}
|
||||
|
||||
if (seq > 0) {
|
||||
UBFX(rd, rs, 0, seq);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
int ops = 0;
|
||||
for (int i = 0; i < 32; i += 2) {
|
||||
u8 bits = RotR(val, i) & 0xFF;
|
||||
|
Loading…
x
Reference in New Issue
Block a user