When ins is used with a zero argument, don't OR.

Seems it's used effectively to mask out bits with rs=zero.  Makes sense...
This commit is contained in:
Unknown W. Brackets 2013-11-29 09:05:29 -08:00
parent 7dedf54bc3
commit dffa35ef2f
3 changed files with 11 additions and 3 deletions

View File

@ -261,7 +261,12 @@ void ARMXEmitter::TSTI2R(ARMReg rs, u32 val, ARMReg scratch)
void ARMXEmitter::ORI2R(ARMReg rd, ARMReg rs, u32 val, ARMReg scratch)
{
Operand2 op2;
if (TryMakeOperand2(val, op2)) {
if (val == 0) {
// Avoid the ALU, may improve pipeline.
if (rd != rs) {
MOV(rd, rs);
}
} else if (TryMakeOperand2(val, op2)) {
ORR(rd, rs, op2);
} else {
int ops = 0;

View File

@ -564,7 +564,9 @@ namespace MIPSComp
gpr.MapReg(rt, MAP_DIRTY);
ANDI2R(gpr.R(rt), gpr.R(rt), destmask, R0);
ORI2R(gpr.R(rt), gpr.R(rt), inserted, R0);
if (inserted != 0) {
ORI2R(gpr.R(rt), gpr.R(rt), inserted, R0);
}
} else {
gpr.MapDirtyIn(rt, rs, false);
#ifdef HAVE_ARMV7

View File

@ -643,7 +643,8 @@ namespace MIPSComp
gpr.Lock(rs, rt);
gpr.MapReg(rt, true, true);
AND(32, gpr.R(rt), Imm32(destmask));
OR(32, gpr.R(rt), Imm32(inserted));
if (inserted != 0)
OR(32, gpr.R(rt), Imm32(inserted));
gpr.UnlockAll();
}
else