Byte forwardiong optimisation in native mode
This commit is contained in:
parent
1dd63ac708
commit
2fc414ed6b
|
@ -96,6 +96,12 @@ if %errorlevel% neq 0 goto :error
|
||||||
..\release\oscar64 -e -n loopdomtest.c
|
..\release\oscar64 -e -n loopdomtest.c
|
||||||
if %errorlevel% neq 0 goto :error
|
if %errorlevel% neq 0 goto :error
|
||||||
|
|
||||||
|
..\release\oscar64 -e byteindextest.c
|
||||||
|
if %errorlevel% neq 0 goto :error
|
||||||
|
|
||||||
|
..\release\oscar64 -e -n byteindextest.c
|
||||||
|
if %errorlevel% neq 0 goto :error
|
||||||
|
|
||||||
exit /b 0
|
exit /b 0
|
||||||
:error
|
:error
|
||||||
echo Failed with error #%errorlevel%.
|
echo Failed with error #%errorlevel%.
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// short index ops
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
char a[20];
|
char a[20];
|
||||||
|
|
||||||
|
@ -11,6 +12,7 @@ int main(void)
|
||||||
for(char i=0; i<20; i++)
|
for(char i=0; i<20; i++)
|
||||||
x += a[i];
|
x += a[i];
|
||||||
|
|
||||||
printf("Sum %d\n", x);
|
assert(x == 190);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -779,10 +779,19 @@ bool NativeCodeInstruction::ValueForwarding(NativeRegisterDataSet& data)
|
||||||
switch (mType)
|
switch (mType)
|
||||||
{
|
{
|
||||||
case ASMIT_LDA:
|
case ASMIT_LDA:
|
||||||
if (data.mRegs[CPU_REG_A].mZeroPage && data.mRegs[CPU_REG_A].mValue == mAddress && !(mLive & LIVE_CPU_REG_Z))
|
if (data.mRegs[CPU_REG_A].mZeroPage && data.mRegs[CPU_REG_A].mValue == mAddress)
|
||||||
|
{
|
||||||
|
if (mLive & LIVE_CPU_REG_Z)
|
||||||
|
{
|
||||||
|
mType = ASMIT_ORA;
|
||||||
|
mMode = ASMIM_IMMEDIATE;
|
||||||
|
mAddress = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
mType = ASMIT_NOP;
|
mType = ASMIT_NOP;
|
||||||
mMode = ASMIM_IMPLIED;
|
mMode = ASMIM_IMPLIED;
|
||||||
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
}
|
}
|
||||||
else if (data.mRegs[mAddress].mImmediate)
|
else if (data.mRegs[mAddress].mImmediate)
|
||||||
|
|
Loading…
Reference in New Issue