mirror of
https://github.com/libretro/ppsspp.git
synced 2024-11-25 01:00:01 +00:00
ARM optimization in ADDI2R: Dual adds instead of MOVI2R, ADD when possible
This commit is contained in:
parent
381b6d0f05
commit
1bf83efe9e
@ -156,8 +156,20 @@ void ARMXEmitter::ADDI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
|
||||
else
|
||||
SUB(rd, rs, op2);
|
||||
} else {
|
||||
MOVI2R(scratch, val);
|
||||
ADD(rd, rs, scratch);
|
||||
// Try 16-bit additions and subtractions - easy to test for.
|
||||
// Should also try other rotations...
|
||||
if ((val & 0xFFFF0000) == 0) {
|
||||
// Decompose into two additions.
|
||||
ADD(rd, rs, Operand2((u8)(val >> 8), 12)); // rotation right by 12*2 == rotation left by 8
|
||||
ADD(rd, rd, Operand2((u8)(val), 0));
|
||||
} else if (((-(u32)(s32)val) & 0xFFFF0000) == 0) {
|
||||
val = -(u32)(s32)val;
|
||||
SUB(rd, rs, Operand2((u8)(val >> 8), 12));
|
||||
SUB(rd, rd, Operand2((u8)(val), 0));
|
||||
} else {
|
||||
MOVI2R(scratch, val);
|
||||
ADD(rd, rs, scratch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user