Fix left shift 1ul for upper 16 bits
This commit is contained in:
parent
2ba46283b2
commit
d24e666f92
|
@ -303,6 +303,18 @@ void shr32n(unsigned long xu, long xi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void shl1_32n(void)
|
||||||
|
{
|
||||||
|
static const unsigned long m[] = {
|
||||||
|
#for(i, 32) 1ul << i,
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int i=0; i<32; i++)
|
||||||
|
{
|
||||||
|
assert(1ul << i == m[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma native(shl32n)
|
#pragma native(shl32n)
|
||||||
#pragma native(shr32n)
|
#pragma native(shr32n)
|
||||||
|
|
||||||
|
@ -396,5 +408,7 @@ int main(void)
|
||||||
shr32n(0x12345678UL, 0x12345678L);
|
shr32n(0x12345678UL, 0x12345678L);
|
||||||
shr32n(0xfedcba98UL, 0xfedcba98L);
|
shr32n(0xfedcba98UL, 0xfedcba98L);
|
||||||
|
|
||||||
|
shl1_32n();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9921,9 +9921,9 @@ NativeCodeBasicBlock* NativeCodeBasicBlock::BinaryOperator(InterCodeProcedure* p
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, 0));
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_IMMEDIATE, 0));
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 0));
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 0));
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 1));
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 1));
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, frt.mOffset - 16, frt.mLinkerObject));
|
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 2));
|
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, frt.mOffset - 8, frt.mLinkerObject));
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, frt.mOffset - 8, frt.mLinkerObject));
|
||||||
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 2));
|
||||||
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_LDA, ASMIM_ABSOLUTE_X, frt.mOffset - 16, frt.mLinkerObject));
|
||||||
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 3));
|
hblock->mIns.Push(NativeCodeInstruction(ins, ASMIT_STA, ASMIM_ZERO_PAGE, treg + 3));
|
||||||
hblock->Close(ins, eblock, nullptr, ASMIT_JMP);
|
hblock->Close(ins, eblock, nullptr, ASMIT_JMP);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue