Fix float fast parameter aliasing
This commit is contained in:
parent
0b2c36ab1a
commit
dcfa50e36e
|
@ -18982,7 +18982,9 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
||||||
#endif
|
#endif
|
||||||
else if (
|
else if (
|
||||||
mInstructions[i + 0]->mDst.mTemp >= 0 &&
|
mInstructions[i + 0]->mDst.mTemp >= 0 &&
|
||||||
mInstructions[i + 1]->mCode == IC_BINARY_OPERATOR && IsCommutative(mInstructions[i + 1]->mOperator) && mInstructions[i + 0]->mDst.mTemp == mInstructions[i + 1]->mSrc[0].mTemp && mInstructions[i + 0]->mDst.mTemp != mInstructions[i + 1]->mSrc[1].mTemp)
|
mInstructions[i + 1]->mCode == IC_BINARY_OPERATOR && IsCommutative(mInstructions[i + 1]->mOperator) &&
|
||||||
|
mInstructions[i + 0]->mDst.mTemp == mInstructions[i + 1]->mSrc[0].mTemp &&
|
||||||
|
mInstructions[i + 0]->mDst.mTemp != mInstructions[i + 1]->mSrc[1].mTemp)
|
||||||
{
|
{
|
||||||
InterOperand io = mInstructions[i + 1]->mSrc[1];
|
InterOperand io = mInstructions[i + 1]->mSrc[1];
|
||||||
mInstructions[i + 1]->mSrc[1] = mInstructions[i + 1]->mSrc[0];
|
mInstructions[i + 1]->mSrc[1] = mInstructions[i + 1]->mSrc[0];
|
||||||
|
@ -19450,6 +19452,21 @@ bool InterCodeBasicBlock::PeepholeReplaceOptimization(const GrowingVariableArray
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
if (i + 2 < mInstructions.Size() &&
|
||||||
|
mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR && mInstructions[i + 0]->mDst.mType == IT_FLOAT &&
|
||||||
|
|
||||||
|
mInstructions[i + 1]->mCode == IC_BINARY_OPERATOR && (mInstructions[i + 1]->mOperator == IA_ADD || mInstructions[i + 1]->mOperator == IA_MUL) &&
|
||||||
|
mInstructions[i + 1]->mSrc[0].mTemp != mInstructions[i + 0]->mDst.mTemp &&
|
||||||
|
mInstructions[i + 1]->mSrc[1].mTemp == mInstructions[i + 0]->mDst.mTemp)
|
||||||
|
{
|
||||||
|
InterOperand op = mInstructions[i + 1]->mSrc[0];
|
||||||
|
mInstructions[i + 1]->mSrc[0] = mInstructions[i + 1]->mSrc[1];
|
||||||
|
mInstructions[i + 1]->mSrc[1] = op;
|
||||||
|
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#if 1
|
#if 1
|
||||||
if (i + 2 < mInstructions.Size() &&
|
if (i + 2 < mInstructions.Size() &&
|
||||||
mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR &&
|
mInstructions[i + 0]->mCode == IC_BINARY_OPERATOR &&
|
||||||
|
|
|
@ -9486,6 +9486,10 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
||||||
sop0 = 1; sop1 = 0;
|
sop0 = 1; sop1 = 0;
|
||||||
const InterInstruction* sins = sins0; sins0 = sins1; sins1 = sins;
|
const InterInstruction* sins = sins0; sins0 = sins1; sins1 = sins;
|
||||||
}
|
}
|
||||||
|
else if (!sins1 && !sins0 && ins->mSrc[sop1].mTemp >= 0 && CheckPredAccuStore(BC_REG_TMP + proc->mTempOffset[ins->mSrc[sop1].mTemp]) && ins->mSrc[sop1].mFinal)
|
||||||
|
{
|
||||||
|
// no flip in this case
|
||||||
|
}
|
||||||
else if (!sins0 && !sins1 && ins->mSrc[sop0].mTemp >= 0 && ins->mSrc[sop1].mTemp >= 0 && ins->mDst.mTemp == ins->mSrc[sop0].mTemp)
|
else if (!sins0 && !sins1 && ins->mSrc[sop0].mTemp >= 0 && ins->mSrc[sop1].mTemp >= 0 && ins->mDst.mTemp == ins->mSrc[sop0].mTemp)
|
||||||
{
|
{
|
||||||
flipop = true;
|
flipop = true;
|
||||||
|
@ -14593,6 +14597,15 @@ void NativeCodeBasicBlock::FindZeroPageAlias(const NumberSet& statics, NumberSet
|
||||||
else if (mIns[i].ChangesAddress())
|
else if (mIns[i].ChangesAddress())
|
||||||
invalid += mIns[i].mAddress;
|
invalid += mIns[i].mAddress;
|
||||||
}
|
}
|
||||||
|
else if (mIns[i].mType == ASMIT_JSR && (mIns[i].mFlags & NCIF_USE_ZP_32_X))
|
||||||
|
{
|
||||||
|
int j = mIns[i].mParam;
|
||||||
|
invalid += j;
|
||||||
|
invalid += j + 1;
|
||||||
|
invalid += j + 2;
|
||||||
|
invalid += j + 3;
|
||||||
|
accu = -1;
|
||||||
|
}
|
||||||
else if (mIns[i].ChangesAccu())
|
else if (mIns[i].ChangesAccu())
|
||||||
accu = -1;
|
accu = -1;
|
||||||
}
|
}
|
||||||
|
@ -14720,6 +14733,14 @@ void NativeCodeBasicBlock::CollectZeroPageUsage(NumberSet& used, NumberSet &modi
|
||||||
modified += BC_REG_ACCU + j;
|
modified += BC_REG_ACCU + j;
|
||||||
modified += BC_REG_WORK + j;
|
modified += BC_REG_WORK + j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mIns[i].mFlags & NCIF_USE_ZP_32_X)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 4; j++)
|
||||||
|
used += mIns[i].mParam + j;
|
||||||
|
for (int j = 0; j < 3; j++)
|
||||||
|
pairs += mIns[i].mParam + j;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIns[i].mLinkerObject)
|
if (mIns[i].mLinkerObject)
|
||||||
|
@ -50514,7 +50535,7 @@ void NativeCodeProcedure::Compile(InterCodeProcedure* proc)
|
||||||
mInterProc = proc;
|
mInterProc = proc;
|
||||||
mInterProc->mLinkerObject->mNativeProc = this;
|
mInterProc->mLinkerObject->mNativeProc = this;
|
||||||
|
|
||||||
CheckFunc = !strcmp(mInterProc->mIdent->mString, "sformat");
|
CheckFunc = !strcmp(mInterProc->mIdent->mString, "sqrt");
|
||||||
|
|
||||||
int nblocks = proc->mBlocks.Size();
|
int nblocks = proc->mBlocks.Size();
|
||||||
tblocks = new NativeCodeBasicBlock * [nblocks];
|
tblocks = new NativeCodeBasicBlock * [nblocks];
|
||||||
|
@ -51352,7 +51373,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
mEntryBlock->ReplaceFinalZeroPageUse(this);
|
mEntryBlock->ReplaceFinalZeroPageUse(this);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (step > 1)
|
if (step > 1)
|
||||||
{
|
{
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
|
@ -51377,7 +51397,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
mEntryBlock->CheckAsmCode();
|
mEntryBlock->CheckAsmCode();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int t = 0;
|
int t = 0;
|
||||||
#if 1
|
#if 1
|
||||||
do
|
do
|
||||||
|
@ -51478,7 +51497,6 @@ void NativeCodeProcedure::Optimize(void)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
if (step == 2)
|
if (step == 2)
|
||||||
{
|
{
|
||||||
ResetVisited();
|
ResetVisited();
|
||||||
|
|
Loading…
Reference in New Issue