mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-29 23:33:00 +00:00
Pointer addition opcodes must leave NULL pointers as they are.
This commit is contained in:
parent
ac462638d3
commit
a8ce626708
1 changed files with 20 additions and 0 deletions
|
@ -1461,18 +1461,38 @@ JitFuncPtr JitCompile(VMScriptFunction *sfunc)
|
||||||
case OP_ADDA_RR: // pA = pB + dkC
|
case OP_ADDA_RR: // pA = pB + dkC
|
||||||
{
|
{
|
||||||
auto tmp = cc.newIntPtr();
|
auto tmp = cc.newIntPtr();
|
||||||
|
Label label = cc.newLabel();
|
||||||
|
|
||||||
cc.mov(tmp, regA[B]);
|
cc.mov(tmp, regA[B]);
|
||||||
|
|
||||||
|
// Check if zero, the first operand is zero, if it is, don't add.
|
||||||
|
cc.cmp(tmp, 0);
|
||||||
|
cc.je(label);
|
||||||
|
|
||||||
cc.add(tmp, regD[C]);
|
cc.add(tmp, regD[C]);
|
||||||
|
|
||||||
|
cc.bind(label);
|
||||||
cc.mov(regA[a], tmp);
|
cc.mov(regA[a], tmp);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case OP_ADDA_RK:
|
case OP_ADDA_RK:
|
||||||
{
|
{
|
||||||
auto tmp = cc.newIntPtr();
|
auto tmp = cc.newIntPtr();
|
||||||
|
Label label = cc.newLabel();
|
||||||
|
|
||||||
cc.mov(tmp, regA[B]);
|
cc.mov(tmp, regA[B]);
|
||||||
|
|
||||||
|
// Check if zero, the first operand is zero, if it is, don't add.
|
||||||
|
cc.cmp(tmp, 0);
|
||||||
|
cc.je(label);
|
||||||
|
|
||||||
cc.add(tmp, konstd[C]);
|
cc.add(tmp, konstd[C]);
|
||||||
|
|
||||||
|
cc.bind(label);
|
||||||
cc.mov(regA[a], tmp);
|
cc.mov(regA[a], tmp);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue