Optimize right shift with small 16 bit values
This commit is contained in:
parent
abb2d7a417
commit
62cede95ce
|
@ -593,8 +593,18 @@ void rirq_sort(void)
|
|||
rasterIRQIndex[j] = ri;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NUM_IRQS & 3
|
||||
for(sbyte i=NUM_IRQS-1; i>=0; i--)
|
||||
rasterIRQNext[i] = rasterIRQRows[rasterIRQIndex[i + 1]];
|
||||
#else
|
||||
for(sbyte i=NUM_IRQS/4-1; i>=0; i--)
|
||||
{
|
||||
#pragma unroll(full)
|
||||
for(int j=0; j<4; j++)
|
||||
rasterIRQNext[i + j * NUM_IRQS / 4] = rasterIRQRows[rasterIRQIndex[i + j * NUM_IRQS / 4 + 1]];
|
||||
}
|
||||
#endif
|
||||
|
||||
npos++;
|
||||
byte yp = rasterIRQNext[nextIRQ];
|
||||
|
|
|
@ -11414,6 +11414,10 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
}
|
||||
else
|
||||
{
|
||||
uint32 mask = 0xffff;
|
||||
if (ins->mSrc[1].IsPositive() && ins->mSrc[1].mRange.mMaxState == IntegerValueRange::S_BOUND)
|
||||
mask = uint32(ins->mSrc[1].mRange.mMaxValue);
|
||||
|
||||
if (ins->mSrc[1].mTemp != ins->mDst.mTemp)
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ZERO_PAGE, BC_REG_TMP + proc->mTempOffset[ins->mSrc[1].mTemp] + 1));
|
||||
|
@ -11429,8 +11433,14 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
|||
mIns.Push(NativeCodeInstruction(ins, ASMIT_ROR, ASMIM_IMPLIED));
|
||||
for (int i = 1; i < shift; i++)
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LSR, ASMIM_ZERO_PAGE, treg + 1));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_ROR, ASMIM_IMPLIED));
|
||||
mask >>= 1;
|
||||
if (mask > 0xff)
|
||||
{
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LSR, ASMIM_ZERO_PAGE, treg + 1));
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_ROR, ASMIM_IMPLIED));
|
||||
}
|
||||
else
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_LSR, ASMIM_IMPLIED));
|
||||
}
|
||||
mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg));
|
||||
}
|
||||
|
|
|
@ -120,14 +120,14 @@ int main2(int argc, const char** argv)
|
|||
strcpy_s(crtFileNamePath, basePath);
|
||||
strcat_s(crtFileNamePath, "include/crt.h");
|
||||
|
||||
if ((crtFile = fopen(crtFileNamePath, "r")))
|
||||
if (!fopen_s(&crtFile, crtFileNamePath, "r"))
|
||||
strcat_s(includePath, "include/");
|
||||
else
|
||||
{
|
||||
strcpy_s(crtFileNamePath, basePath);
|
||||
strcat_s(crtFileNamePath, "include/oscar64/crt.h");
|
||||
|
||||
if ((crtFile = fopen(crtFileNamePath, "r")))
|
||||
if (!fopen_s(&crtFile, crtFileNamePath, "r"))
|
||||
strcat_s(includePath, "include/oscar64/");
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue