2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

ARM: Removed unnecessary goto with each instruction.

This commit is contained in:
bunnei 2014-11-09 01:28:33 -05:00
parent 3409790668
commit 573756e241

View file

@ -3747,7 +3747,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
#endif #endif
#define FETCH_INST if (inst_base->br != NON_BRANCH) \ #define FETCH_INST if (inst_base->br != NON_BRANCH) \
goto PROFILING; \ goto DISPATCH; \
inst_base = (arm_inst *)&inst_buf[ptr] inst_base = (arm_inst *)&inst_buf[ptr]
#define INC_PC(l) ptr += sizeof(arm_inst) + l #define INC_PC(l) ptr += sizeof(arm_inst) + l
@ -4180,10 +4180,6 @@ unsigned InterpreterMainLoop(ARMul_State* state)
inst_base = (arm_inst *)&inst_buf[ptr]; inst_base = (arm_inst *)&inst_buf[ptr];
GOTO_NEXT_INST; GOTO_NEXT_INST;
} }
PROFILING:
{
goto DISPATCH;
}
ADC_INST: ADC_INST:
{ {
INC_ICOUNTER; INC_ICOUNTER;
@ -4208,7 +4204,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(adc_inst)); INC_PC(sizeof(adc_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4242,7 +4238,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(add_inst)); INC_PC(sizeof(add_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4273,7 +4269,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(and_inst)); INC_PC(sizeof(and_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4291,11 +4287,11 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
SET_PC; SET_PC;
INC_PC(sizeof(bbl_inst)); INC_PC(sizeof(bbl_inst));
goto PROFILING; goto DISPATCH;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
INC_PC(sizeof(bbl_inst)); INC_PC(sizeof(bbl_inst));
goto PROFILING; goto DISPATCH;
} }
BIC_INST: BIC_INST:
{ {
@ -4323,7 +4319,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(bic_inst)); INC_PC(sizeof(bic_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4359,12 +4355,12 @@ unsigned InterpreterMainLoop(ARMul_State* state)
//DEBUG_MSG; //DEBUG_MSG;
} }
INC_PC(sizeof(blx_inst)); INC_PC(sizeof(blx_inst));
goto PROFILING; goto DISPATCH;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
// INC_PC(sizeof(bx_inst)); // INC_PC(sizeof(bx_inst));
INC_PC(sizeof(blx_inst)); INC_PC(sizeof(blx_inst));
goto PROFILING; goto DISPATCH;
} }
BX_INST: BX_INST:
{ {
@ -4377,12 +4373,12 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe; cpu->Reg[15] = cpu->Reg[inst_cream->Rm] & 0xfffffffe;
// cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1; // cpu->TFlag = cpu->Reg[inst_cream->Rm] & 0x1;
INC_PC(sizeof(bx_inst)); INC_PC(sizeof(bx_inst));
goto PROFILING; goto DISPATCH;
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
// INC_PC(sizeof(bx_inst)); // INC_PC(sizeof(bx_inst));
INC_PC(sizeof(bx_inst)); INC_PC(sizeof(bx_inst));
goto PROFILING; goto DISPATCH;
} }
BXJ_INST: BXJ_INST:
CDP_INST: CDP_INST:
@ -4524,7 +4520,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
// RD = RM; // RD = RM;
if ((inst_cream->Rd == 15)) { if ((inst_cream->Rd == 15)) {
INC_PC(sizeof(mov_inst)); INC_PC(sizeof(mov_inst));
goto PROFILING; goto DISPATCH;
} }
} }
// DEBUG_LOG(ARM11, "cpy inst %x\n", cpu->Reg[15]); // DEBUG_LOG(ARM11, "cpy inst %x\n", cpu->Reg[15]);
@ -4560,7 +4556,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(eor_inst)); INC_PC(sizeof(eor_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4719,7 +4715,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (BIT(inst, 15)) { if (BIT(inst, 15)) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4766,7 +4762,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->TFlag = value & 0x1; cpu->TFlag = value & 0x1;
cpu->Reg[15] &= 0xFFFFFFFE; cpu->Reg[15] &= 0xFFFFFFFE;
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
//} //}
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4796,7 +4792,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->TFlag = value & 0x1; cpu->TFlag = value & 0x1;
cpu->Reg[15] &= 0xFFFFFFFE; cpu->Reg[15] &= 0xFFFFFFFE;
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4850,7 +4846,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4871,7 +4867,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4928,7 +4924,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4955,7 +4951,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -4982,7 +4978,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5008,7 +5004,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5033,7 +5029,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value; cpu->Reg[BITS(inst_cream->inst, 12, 15)] = value;
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5060,7 +5056,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
if (BITS(inst_cream->inst, 12, 15) == 15) { if (BITS(inst_cream->inst, 12, 15) == 15) {
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5230,7 +5226,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(mla_inst)); INC_PC(sizeof(mla_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5262,7 +5258,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(mov_inst)); INC_PC(sizeof(mov_inst));
goto PROFILING; goto DISPATCH;
} }
// return; // return;
} }
@ -5424,7 +5420,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(mul_inst)); INC_PC(sizeof(mul_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5453,7 +5449,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(mvn_inst)); INC_PC(sizeof(mvn_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5485,7 +5481,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(orr_inst)); INC_PC(sizeof(orr_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5577,7 +5573,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(rsb_inst)); INC_PC(sizeof(rsb_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5614,7 +5610,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(rsc_inst)); INC_PC(sizeof(rsc_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -5655,7 +5651,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(sbc_inst)); INC_PC(sizeof(sbc_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -6068,7 +6064,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
//if (BITS(inst_cream->inst, 12, 15) == 15) //if (BITS(inst_cream->inst, 12, 15) == 15)
// goto PROFILING; // goto DISPATCH;
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
FETCH_INST; FETCH_INST;
GOTO_NEXT_INST; GOTO_NEXT_INST;
@ -6177,7 +6173,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
//if (BITS(inst_cream->inst, 12, 15) == 15) //if (BITS(inst_cream->inst, 12, 15) == 15)
// goto PROFILING; // goto DISPATCH;
INC_PC(sizeof(ldst_inst)); INC_PC(sizeof(ldst_inst));
FETCH_INST; FETCH_INST;
GOTO_NEXT_INST; GOTO_NEXT_INST;
@ -6227,7 +6223,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
} }
if (inst_cream->Rd == 15) { if (inst_cream->Rd == 15) {
INC_PC(sizeof(sub_inst)); INC_PC(sizeof(sub_inst));
goto PROFILING; goto DISPATCH;
} }
} }
cpu->Reg[15] += GET_INST_SIZE(cpu); cpu->Reg[15] += GET_INST_SIZE(cpu);
@ -6451,7 +6447,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm; cpu->Reg[15] = cpu->Reg[15] + 4 + inst_cream->imm;
//DEBUG_LOG(ARM11, " BL_1_THUMB: imm=0x%x, r14=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]); //DEBUG_LOG(ARM11, " BL_1_THUMB: imm=0x%x, r14=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]);
INC_PC(sizeof(b_2_thumb)); INC_PC(sizeof(b_2_thumb));
goto PROFILING; goto DISPATCH;
} }
B_COND_THUMB: B_COND_THUMB:
{ {
@ -6463,7 +6459,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[15] += 2; cpu->Reg[15] += 2;
//DEBUG_LOG(ARM11, " B_COND_THUMB: imm=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[15]); //DEBUG_LOG(ARM11, " B_COND_THUMB: imm=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[15]);
INC_PC(sizeof(b_cond_thumb)); INC_PC(sizeof(b_cond_thumb));
goto PROFILING; goto DISPATCH;
} }
BL_1_THUMB: BL_1_THUMB:
{ {
@ -6489,7 +6485,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->Reg[14] = tmp; cpu->Reg[14] = tmp;
//DEBUG_LOG(ARM11, " BL_2_THUMB: imm=0x%x, r14=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]); //DEBUG_LOG(ARM11, " BL_2_THUMB: imm=0x%x, r14=0x%x, r15=0x%x\n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]);
INC_PC(sizeof(bl_2_thumb)); INC_PC(sizeof(bl_2_thumb));
goto PROFILING; goto DISPATCH;
} }
BLX_1_THUMB: BLX_1_THUMB:
{ {
@ -6505,7 +6501,7 @@ unsigned InterpreterMainLoop(ARMul_State* state)
cpu->TFlag = 0; cpu->TFlag = 0;
//DEBUG_LOG(ARM11, "In BLX_1_THUMB, BLX(1),imm=0x%x,r14=0x%x, r15=0x%x, \n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]); //DEBUG_LOG(ARM11, "In BLX_1_THUMB, BLX(1),imm=0x%x,r14=0x%x, r15=0x%x, \n", inst_cream->imm, cpu->Reg[14], cpu->Reg[15]);
INC_PC(sizeof(blx_1_thumb)); INC_PC(sizeof(blx_1_thumb));
goto PROFILING; goto DISPATCH;
} }
UQADD16_INST: UQADD16_INST: