Clean-up for loading instructions

Expanding the scope of the clean-up from lscbx to other loading/storing instructions.
This commit is contained in:
dingusdev 2024-03-01 07:57:46 -07:00
parent 6a4326af39
commit ebac8b92ba
2 changed files with 20 additions and 20 deletions

View File

@ -697,8 +697,8 @@ void dppc_interpreter::ppc_lfsu() {
void dppc_interpreter::ppc_lfsx() {
ppc_grab_regsfpdiab();
ppc_effective_address = (reg_a) ? val_reg_a + val_reg_b : val_reg_b;
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
ppc_effective_address = val_reg_b + (reg_a ? val_reg_a : 0);
uint32_t result = mmu_read_vmem<uint32_t>(ppc_effective_address);
ppc_state.fpr[reg_d].dbl64_r = *(float*)(&result);
}
@ -737,7 +737,7 @@ void dppc_interpreter::ppc_lfdu() {
void dppc_interpreter::ppc_lfdx() {
ppc_grab_regsfpdiab();
ppc_effective_address = (reg_a) ? val_reg_a + val_reg_b : val_reg_b;
ppc_effective_address = val_reg_b + (reg_a ? val_reg_a : 0);
uint64_t ppc_result64_d = mmu_read_vmem<uint64_t>(ppc_effective_address);
ppc_store_dfpresult_int(reg_d);
}
@ -777,7 +777,7 @@ void dppc_interpreter::ppc_stfsu() {
void dppc_interpreter::ppc_stfsx() {
ppc_grab_regsfpsiab();
ppc_effective_address = reg_a ? (val_reg_a + val_reg_b) : val_reg_b;
ppc_effective_address = val_reg_b + (reg_a ? val_reg_a : 0);
float result = ppc_state.fpr[reg_s].dbl64_r;
mmu_write_vmem<uint32_t>(ppc_effective_address, *(uint32_t*)(&result));
}
@ -815,7 +815,7 @@ void dppc_interpreter::ppc_stfdu() {
void dppc_interpreter::ppc_stfdx() {
ppc_grab_regsfpsiab();
ppc_effective_address = reg_a ? (val_reg_a + val_reg_b) : val_reg_b;
ppc_effective_address = val_reg_b + (reg_a ? val_reg_a : 0);
mmu_write_vmem<uint64_t>(ppc_effective_address, ppc_state.fpr[reg_s].int64_r);
}
@ -832,7 +832,7 @@ void dppc_interpreter::ppc_stfdux() {
void dppc_interpreter::ppc_stfiwx() {
ppc_grab_regsfpsiab();
ppc_effective_address = reg_a ? (val_reg_a + val_reg_b) : val_reg_b;
ppc_effective_address = val_reg_b + (reg_a ? val_reg_a : 0);
mmu_write_vmem<uint32_t>(ppc_effective_address, uint32_t(ppc_state.fpr[reg_s].int64_r));
}

View File

@ -1556,7 +1556,7 @@ void dppc_interpreter::ppc_dcbtst() {
void dppc_interpreter::ppc_dcbz() {
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
ppc_effective_address &= 0xFFFFFFE0UL; // align EA on a 32-byte boundary
@ -1587,7 +1587,7 @@ void dppc_interpreter::ppc_stbx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
mmu_write_vmem<uint8_t>(ppc_effective_address, ppc_result_d);
//mem_write_byte(ppc_effective_address, ppc_result_d);
}
@ -1670,7 +1670,7 @@ void dppc_interpreter::ppc_sthx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
mmu_write_vmem<uint16_t>(ppc_effective_address, ppc_result_d);
//mem_write_word(ppc_effective_address, ppc_result_d);
}
@ -1680,7 +1680,7 @@ void dppc_interpreter::ppc_sthbrx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
ppc_result_d = uint32_t(BYTESWAP_16(uint16_t(ppc_result_d)));
mmu_write_vmem<uint16_t>(ppc_effective_address, ppc_result_d);
//mem_write_word(ppc_effective_address, ppc_result_d);
@ -1702,7 +1702,7 @@ void dppc_interpreter::ppc_stwx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
mmu_write_vmem<uint32_t>(ppc_effective_address, ppc_result_d);
//mem_write_dword(ppc_effective_address, ppc_result_d);
}
@ -1762,7 +1762,7 @@ void dppc_interpreter::ppc_stwbrx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
ppc_result_d = BYTESWAP_32(ppc_result_d);
mmu_write_vmem<uint32_t>(ppc_effective_address, ppc_result_d);
//mem_write_dword(ppc_effective_address, ppc_result_d);
@ -1823,7 +1823,7 @@ void dppc_interpreter::ppc_lbzx() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//ppc_result_d = mem_grab_byte(ppc_effective_address);
ppc_result_d = mmu_read_vmem<uint8_t>(ppc_effective_address);
ppc_store_result_regd();
@ -1882,7 +1882,7 @@ void dppc_interpreter::ppc_lhzx() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//ppc_result_d = mem_grab_word(ppc_effective_address);
ppc_result_d = mmu_read_vmem<uint16_t>(ppc_effective_address);
ppc_store_result_regd();
@ -1961,7 +1961,7 @@ void dppc_interpreter::ppc_lhax() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//uint16_t val = mem_grab_word(ppc_effective_address);
int16_t val = mmu_read_vmem<uint16_t>(ppc_effective_address);
ppc_result_d = int32_t(val);
@ -1973,7 +1973,7 @@ void dppc_interpreter::ppc_lhbrx() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//ppc_result_d = (uint32_t)(BYTESWAP_16(mem_grab_word(ppc_effective_address)));
ppc_result_d = uint32_t(BYTESWAP_16(mmu_read_vmem<uint16_t>(ppc_effective_address)));
ppc_store_result_regd();
@ -1996,7 +1996,7 @@ void dppc_interpreter::ppc_lwbrx() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//ppc_result_d = BYTESWAP_32(mem_grab_dword(ppc_effective_address));
ppc_result_d = BYTESWAP_32(mmu_read_vmem<uint32_t>(ppc_effective_address));
ppc_store_result_regd();
@ -2025,7 +2025,7 @@ void dppc_interpreter::ppc_lwzx() {
num_int_loads++;
#endif
ppc_grab_regsdab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
//ppc_result_d = mem_grab_dword(ppc_effective_address);
ppc_result_d = mmu_read_vmem<uint32_t>(ppc_effective_address);
ppc_store_result_regd();
@ -2129,7 +2129,7 @@ void dppc_interpreter::ppc_lswx() {
}
*/
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
uint32_t grab_inb = ppc_state.spr[SPR::XER] & 0x7F;
for (;;) {
@ -2199,7 +2199,7 @@ void dppc_interpreter::ppc_stswx() {
num_int_stores++;
#endif
ppc_grab_regssab();
ppc_effective_address = reg_a ? (ppc_result_a + ppc_result_b) : ppc_result_b;
ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0);
uint32_t grab_inb = ppc_state.spr[SPR::XER] & 127;
while (grab_inb >= 4) {