📄 vm_ppc_new.c
字号:
if(pass == 1)
printf("%08x LTU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "cmp", PPC_CMP, 0, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 4, 0, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 12, 0, v );
break;
case OP_LEU:
#if DEBUG_VM
if(pass == 1)
printf("%08x LEU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "cmp", PPC_CMP, 0, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 12, 1, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 4, 1, v );
break;
case OP_GTU:
#if DEBUG_VM
if(pass == 1)
printf("%08x GTU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "cmp", PPC_CMP, 0, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 4, 1, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 12, 1, v );
break;
case OP_GEU:
#if DEBUG_VM
if(pass == 1)
printf("%08x GEU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "cmp", PPC_CMP, 0, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 12, 0, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 4, 0, v );
break;
case OP_EQF:
#if DEBUG_VM
if(pass == 1)
printf("%08x EQF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 4, 2, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 12, 2, v );
break;
case OP_NEF:
#if DEBUG_VM
if(pass == 1)
printf("%08x NEF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 12, 2, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 4, 2, v );
break;
case OP_LTF:
#if DEBUG_VM
if(pass == 1)
printf("%08x LTF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 4, 0, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 12, 0, v );
break;
case OP_LEF:
#if DEBUG_VM
if(pass == 1)
printf("%08x LEF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 12, 1, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 4, 1, v );
break;
case OP_GTF:
#if DEBUG_VM
if(pass == 1)
printf("%08x GTF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 4, 1, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 12, 1, v );
break;
case OP_GEF:
#if DEBUG_VM
if(pass == 1)
printf("%08x GEF\n",instruction);
#endif
makeFloat(opStackDepth-1);
makeFloat(opStackDepth-2);
Inst( "fcmpu", PPC_FCMPU, 0, opStackFloatRegisters[opStackDepth-2], opStackFloatRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackRegType[opStackDepth-2] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-2] = 0;
opStackDepth -= 2;
i = Constant4();
jused[i] = 1;
InstImm( "bc", PPC_BC, 12, 0, 8 );
if ( pass==1 ) {
v = vm->instructionPointers[ i ] - (int)&buf[compiledOfs];
} else {
v = 0;
}
Emit4("b", PPC_B | (unsigned int)(v&0x3ffffff) );
// InstImm( "bc", PPC_BC, 4, 0, v );
break;
case OP_NEGI:
#if DEBUG_VM
if(pass == 1)
printf("%08x NEGI\n",instruction);
#endif
assertInteger(opStackDepth-1);
InstImm( "subfic", PPC_SUBFIC, opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-1], 0 );
opStackLoadInstructionAddr[opStackDepth-1] = 0;
break;
case OP_ADD:
#if DEBUG_VM
if(pass == 1)
printf("%08x ADD\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "add", PPC_ADD, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-2] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_SUB:
#if DEBUG_VM
if(pass == 1)
printf("%08x SUB\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "subf", PPC_SUBF, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-2] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_DIVI:
#if DEBUG_VM
if(pass == 1)
printf("%08x DIVI\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "divw", PPC_DIVW, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_DIVU:
#if DEBUG_VM
if(pass == 1)
printf("%08x DIVU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "divwu", PPC_DIVWU, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_MODI:
#if DEBUG_VM
if(pass == 1)
printf("%08x MODI\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "divw", PPC_DIVW, R_EA, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
Inst( "mullw", PPC_MULLW, R_EA, opStackIntRegisters[opStackDepth-1], R_EA );
Inst( "subf", PPC_SUBF, opStackIntRegisters[opStackDepth-2], R_EA, opStackIntRegisters[opStackDepth-2] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_MODU:
#if DEBUG_VM
if(pass == 1)
printf("%08x MODU\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "divwu", PPC_DIVWU, R_EA, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
Inst( "mullw", PPC_MULLW, R_EA, opStackIntRegisters[opStackDepth-1], R_EA );
Inst( "subf", PPC_SUBF, opStackIntRegisters[opStackDepth-2], R_EA, opStackIntRegisters[opStackDepth-2] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_MULI:
case OP_MULU:
#if DEBUG_VM
if(pass == 1)
printf("%08x MULI\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "mullw", PPC_MULLW, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-2] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_BAND:
#if DEBUG_VM
if(pass == 1)
printf("%08x BAND\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "and", PPC_AND, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_BOR:
#if DEBUG_VM
if(pass == 1)
printf("%08x BOR\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "or", PPC_OR, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_BXOR:
#if DEBUG_VM
if(pass == 1)
printf("%08x BXOR\n",instruction);
#endif
assertInteger(opStackDepth-1);
assertInteger(opStackDepth-2);
Inst( "xor", PPC_XOR, opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-2], opStackIntRegisters[opStackDepth-1] );
opStackRegType[opStackDepth-1] = 0;
opStackLoadInstructionAddr[opStackDepth-1] = 0;
opStackDepth -= 1;
break;
case OP_BCOM:
#if DEBUG_VM
if(pass == 1)
printf("%08x BCOM\n",instruction);
#endif
assertInteger(opStackDepth-1);
Inst( "nor", PPC_NOR, opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-1], opStackIntRegisters[opStackDepth-1] );
opStackLoadInstructionAddr[opStackDepth-1] = 0;
break;
case OP_LSH:
#if DEBUG_VM
if(pass == 1)
printf("%08x LSH\n",instruction);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -