From 19ba15f2f1ec0412475e1bef604967d5dfcc6cf8 Mon Sep 17 00:00:00 2001 From: joevt Date: Tue, 26 Mar 2024 01:14:23 -0700 Subject: [PATCH] ppc: Separate enums for separate fields. --- cpu/ppc/poweropcodes.cpp | 56 ++++----- cpu/ppc/ppcemu.h | 251 +++++++++++++++++++++------------------ cpu/ppc/ppcexec.cpp | 16 +-- cpu/ppc/ppcfpopcodes.cpp | 70 +++++------ cpu/ppc/ppcopcodes.cpp | 60 +++++----- 5 files changed, 233 insertions(+), 220 deletions(-) diff --git a/cpu/ppc/poweropcodes.cpp b/cpu/ppc/poweropcodes.cpp index 08be487..b76014e 100644 --- a/cpu/ppc/poweropcodes.cpp +++ b/cpu/ppc/poweropcodes.cpp @@ -44,7 +44,7 @@ static inline uint32_t power_rot_mask(unsigned rot_mb, unsigned rot_me) { return ((rot_mb <= rot_me) ? m2 & m1 : m1 | m2); } -template +template void dppc_interpreter::power_abs() { uint32_t ppc_result_d; ppc_grab_regsda(ppc_cur_instruction); @@ -85,7 +85,7 @@ void dppc_interpreter::power_clcs() { ppc_store_iresult_reg(reg_d, ppc_result_d); } -template +template void dppc_interpreter::power_div() { uint32_t ppc_result_d; ppc_grab_regsdab(ppc_cur_instruction); @@ -114,7 +114,7 @@ template void dppc_interpreter::power_div(); template void dppc_interpreter::power_div(); template void dppc_interpreter::power_div(); -template +template void dppc_interpreter::power_divs() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t ppc_result_d = ppc_result_a / ppc_result_b; @@ -133,7 +133,7 @@ template void dppc_interpreter::power_divs(); template void dppc_interpreter::power_divs(); template void dppc_interpreter::power_divs(); -template +template void dppc_interpreter::power_doz() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t ppc_result_d = (int32_t(ppc_result_a) >= int32_t(ppc_result_b))\ @@ -163,7 +163,7 @@ void dppc_interpreter::power_dozi() { ppc_store_iresult_reg(reg_d, ppc_result_d); } -template +template void dppc_interpreter::power_lscbx() { ppc_grab_regsdab(ppc_cur_instruction); ppc_effective_address = ppc_result_b + (reg_a ? ppc_result_a : 0); @@ -214,7 +214,7 @@ void dppc_interpreter::power_lscbx() { template void dppc_interpreter::power_lscbx(); template void dppc_interpreter::power_lscbx(); -template +template void dppc_interpreter::power_maskg() { ppc_grab_regssab(ppc_cur_instruction); uint32_t mask_start = ppc_result_d & 31; @@ -240,9 +240,9 @@ void dppc_interpreter::power_maskg() { } template void dppc_interpreter::power_maskg(); -template void dppc_interpreter::power_maskg(); +template void dppc_interpreter::power_maskg(); -template +template void dppc_interpreter::power_maskir() { ppc_grab_regssab(ppc_cur_instruction); ppc_result_a = (ppc_result_a & ~ppc_result_b) | (ppc_result_d & ppc_result_b); @@ -254,9 +254,9 @@ void dppc_interpreter::power_maskir() { } template void dppc_interpreter::power_maskir(); -template void dppc_interpreter::power_maskir(); +template void dppc_interpreter::power_maskir(); -template +template void dppc_interpreter::power_mul() { ppc_grab_regsdab(ppc_cur_instruction); uint64_t product; @@ -278,7 +278,7 @@ template void dppc_interpreter::power_mul(); template void dppc_interpreter::power_mul(); template void dppc_interpreter::power_mul(); -template +template void dppc_interpreter::power_nabs() { ppc_grab_regsda(ppc_cur_instruction); uint32_t ppc_result_d = ppc_result_a & 0x80000000 ? ppc_result_a : -ppc_result_a; @@ -313,7 +313,7 @@ void dppc_interpreter::power_rlmi() { ppc_store_iresult_reg(reg_a, ppc_result_a); } -template +template void dppc_interpreter::power_rrib() { ppc_grab_regssab(ppc_cur_instruction); @@ -332,7 +332,7 @@ void dppc_interpreter::power_rrib() { template void dppc_interpreter::power_rrib(); template void dppc_interpreter::power_rrib(); -template +template void dppc_interpreter::power_sle() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -351,7 +351,7 @@ void dppc_interpreter::power_sle() { template void dppc_interpreter::power_sle(); template void dppc_interpreter::power_sle(); -template +template void dppc_interpreter::power_sleq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -370,7 +370,7 @@ void dppc_interpreter::power_sleq() { template void dppc_interpreter::power_sleq(); template void dppc_interpreter::power_sleq(); -template +template void dppc_interpreter::power_sliq() { ppc_grab_regssa(ppc_cur_instruction); unsigned rot_sh = (ppc_cur_instruction >> 11) & 31; @@ -387,7 +387,7 @@ void dppc_interpreter::power_sliq() { template void dppc_interpreter::power_sliq(); template void dppc_interpreter::power_sliq(); -template +template void dppc_interpreter::power_slliq() { ppc_grab_regssa(ppc_cur_instruction); unsigned rot_sh = (ppc_cur_instruction >> 11) & 31; @@ -406,7 +406,7 @@ void dppc_interpreter::power_slliq() { template void dppc_interpreter::power_slliq(); template void dppc_interpreter::power_slliq(); -template +template void dppc_interpreter::power_sllq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -429,7 +429,7 @@ void dppc_interpreter::power_sllq() { template void dppc_interpreter::power_sllq(); template void dppc_interpreter::power_sllq(); -template +template void dppc_interpreter::power_slq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -449,7 +449,7 @@ void dppc_interpreter::power_slq() { template void dppc_interpreter::power_slq(); template void dppc_interpreter::power_slq(); -template +template void dppc_interpreter::power_sraiq() { ppc_grab_regssa(ppc_cur_instruction); unsigned rot_sh = (ppc_cur_instruction >> 11) & 0x1F; @@ -472,7 +472,7 @@ void dppc_interpreter::power_sraiq() { template void dppc_interpreter::power_sraiq(); template void dppc_interpreter::power_sraiq(); -template +template void dppc_interpreter::power_sraq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 0x1F; @@ -497,7 +497,7 @@ void dppc_interpreter::power_sraq() { template void dppc_interpreter::power_sraq(); template void dppc_interpreter::power_sraq(); -template +template void dppc_interpreter::power_sre() { ppc_grab_regssab(ppc_cur_instruction); @@ -515,7 +515,7 @@ void dppc_interpreter::power_sre() { template void dppc_interpreter::power_sre(); template void dppc_interpreter::power_sre(); -template +template void dppc_interpreter::power_srea() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 0x1F; @@ -537,7 +537,7 @@ void dppc_interpreter::power_srea() { template void dppc_interpreter::power_srea(); template void dppc_interpreter::power_srea(); -template +template void dppc_interpreter::power_sreq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -555,7 +555,7 @@ void dppc_interpreter::power_sreq() { template void dppc_interpreter::power_sreq(); template void dppc_interpreter::power_sreq(); -template +template void dppc_interpreter::power_sriq() { ppc_grab_regssa(ppc_cur_instruction); unsigned rot_sh = (ppc_cur_instruction >> 11) & 31; @@ -571,7 +571,7 @@ void dppc_interpreter::power_sriq() { template void dppc_interpreter::power_sriq(); template void dppc_interpreter::power_sriq(); -template +template void dppc_interpreter::power_srliq() { ppc_grab_regssa(ppc_cur_instruction); unsigned rot_sh = (ppc_cur_instruction >> 11) & 31; @@ -591,7 +591,7 @@ void dppc_interpreter::power_srliq() { template void dppc_interpreter::power_srliq(); template void dppc_interpreter::power_srliq(); -template +template void dppc_interpreter::power_srlq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -614,7 +614,7 @@ void dppc_interpreter::power_srlq() { template void dppc_interpreter::power_srlq(); template void dppc_interpreter::power_srlq(); -template +template void dppc_interpreter::power_srq() { ppc_grab_regssab(ppc_cur_instruction); unsigned rot_sh = ppc_result_b & 31; @@ -634,4 +634,4 @@ void dppc_interpreter::power_srq() { } template void dppc_interpreter::power_srq(); -template void dppc_interpreter::power_srq(); \ No newline at end of file +template void dppc_interpreter::power_srq(); diff --git a/cpu/ppc/ppcemu.h b/cpu/ppc/ppcemu.h index 83f7891..5ba457c 100644 --- a/cpu/ppc/ppcemu.h +++ b/cpu/ppc/ppcemu.h @@ -349,6 +349,53 @@ extern uint64_t num_int_stores; extern uint64_t exceptions_processed; #endif +// instruction enums +typedef enum { + bool_and = 1, + bool_andc = 2, + bool_eqv = 3, + bool_nand = 4, + bool_nor = 5, + bool_or = 6, + bool_orc = 7, + bool_xor = 8, +} bool_fun; + +typedef enum { + LK0, + LK1, +} field_lk; + +typedef enum { + AA0, + AA1, +} field_aa; + +typedef enum { + SHFT0, + SHFT1, +} field_shift; + +typedef enum { + RC0, + RC1, +} field_rc; + +typedef enum { + OV0, + OV1, +} field_ov; + +typedef enum { + CARRY0, + CARRY1, +} field_carry; + +typedef enum { + NOT601, + IS601, +} field_601; + // Function prototypes extern void ppc_cpu_init(MemCtrlBase* mem_ctrl, uint32_t cpu_version, uint64_t tb_freq); extern void ppc_mmu_init(); @@ -361,7 +408,7 @@ void ppc_release_int(); //void ppc_opcode4(); void ppc_opcode16(); void ppc_opcode18(); -template void ppc_opcode19(); +template void ppc_opcode19(); void ppc_opcode31(); void ppc_opcode59(); void ppc_opcode63(); @@ -389,37 +436,9 @@ extern void do_ctx_sync(void); // The functions used by the PowerPC processor -enum bool_fun { - bool_and = 1, - bool_andc = 2, - bool_eqv = 3, - bool_nand = 4, - bool_nor = 5, - bool_or = 6, - bool_orc = 7, - bool_xor = 8, -}; - -enum field_setting { - LK0 = 0, - LK1 = 1, - AA0 = 0, - AA1 = 1, - SHFT0 = 0, - SHFT1 = 1, - RC0 = 0, - RC1 = 1, - OV0 = 0, - OV1 = 1, - CARRY0 = 0, - CARRY1 = 1, - IS601 = 1, - NOT601 = 0 -}; - namespace dppc_interpreter { -template extern void ppc_bcctr(); -template extern void ppc_bclr(); +template extern void ppc_bcctr(); +template extern void ppc_bclr(); extern void ppc_crand(); extern void ppc_crandc(); extern void ppc_creqv(); @@ -430,27 +449,27 @@ extern void ppc_crorc(); extern void ppc_crxor(); extern void ppc_isync(); -template extern void ppc_do_bool(); +template extern void ppc_do_bool(); -template extern void ppc_add(); -template extern void ppc_adde(); -template extern void ppc_addme(); -template extern void ppc_addze(); +template extern void ppc_add(); +template extern void ppc_adde(); +template extern void ppc_addme(); +template extern void ppc_addze(); extern void ppc_cmp(); extern void ppc_cmpl(); -template extern void ppc_cntlzw(); +template extern void ppc_cntlzw(); extern void ppc_dcbf(); extern void ppc_dcbi(); extern void ppc_dcbst(); extern void ppc_dcbt(); extern void ppc_dcbtst(); extern void ppc_dcbz(); -template extern void ppc_divw(); -template extern void ppc_divwu(); +template extern void ppc_divw(); +template extern void ppc_divwu(); extern void ppc_eciwx(); extern void ppc_ecowx(); extern void ppc_eieio(); -template extern void ppc_exts(); +template extern void ppc_exts(); extern void ppc_icbi(); extern void ppc_mftb(); extern void ppc_lhaux(); @@ -462,23 +481,23 @@ template extern void ppc_lzx(); template extern void ppc_lzux(); extern void ppc_mcrxr(); extern void ppc_mfcr(); -template extern void ppc_mulhwu(); -template extern void ppc_mulhw(); -template extern void ppc_mullw(); -template extern void ppc_neg(); -template extern void ppc_shift(); -template extern void ppc_sraw(); -template extern void ppc_srawi(); +template extern void ppc_mulhwu(); +template extern void ppc_mulhw(); +template extern void ppc_mullw(); +template extern void ppc_neg(); +template extern void ppc_shift(); +template extern void ppc_sraw(); +template extern void ppc_srawi(); template extern void ppc_stx(); template extern void ppc_stux(); extern void ppc_stfiwx(); extern void ppc_sthbrx(); extern void ppc_stwcx(); extern void ppc_stwbrx(); -template extern void ppc_subf(); -template extern void ppc_subfe(); -template extern void ppc_subfme(); -template extern void ppc_subfze(); +template extern void ppc_subf(); +template extern void ppc_subfe(); +template extern void ppc_subfme(); +template extern void ppc_subfze(); extern void ppc_sync(); extern void ppc_tlbia(); extern void ppc_tlbie(); @@ -504,19 +523,19 @@ extern void ppc_mfspr(); extern void ppc_mtmsr(); extern void ppc_mtspr(); -template extern void ppc_mtfsb0(); -template extern void ppc_mtfsb1(); +template extern void ppc_mtfsb0(); +template extern void ppc_mtfsb1(); extern void ppc_mcrfs(); -template extern void ppc_fmr(); -template extern void ppc_mffs(); -template extern void ppc_mtfsf(); -template extern void ppc_mtfsfi(); +template extern void ppc_fmr(); +template extern void ppc_mffs(); +template extern void ppc_mtfsf(); +template extern void ppc_mtfsfi(); -template extern void ppc_addi(); -template extern void ppc_addic(); -template extern void ppc_andirc(); -template extern void ppc_b(); -template extern void ppc_bc(); +template extern void ppc_addi(); +template extern void ppc_addic(); +template extern void ppc_andirc(); +template extern void ppc_b(); +template extern void ppc_bc(); extern void ppc_cmpi(); extern void ppc_cmpli(); template extern void ppc_lz(); @@ -525,7 +544,7 @@ extern void ppc_lha(); extern void ppc_lhau(); extern void ppc_lmw(); extern void ppc_mulli(); -template extern void ppc_ori(); +template extern void ppc_ori(); extern void ppc_rfi(); extern void ppc_rlwimi(); extern void ppc_rlwinm(); @@ -536,7 +555,7 @@ template extern void ppc_stu(); extern void ppc_stmw(); extern void ppc_subfic(); extern void ppc_twi(); -template extern void ppc_xori(); +template extern void ppc_xori(); extern void ppc_lfs(); extern void ppc_lfsu(); @@ -555,66 +574,66 @@ extern void ppc_stfdu(); extern void ppc_stfdx(); extern void ppc_stfdux(); -template extern void ppc_fadd(); -template extern void ppc_fsub(); -template extern void ppc_fmul(); -template extern void ppc_fdiv(); -template extern void ppc_fadds(); -template extern void ppc_fsubs(); -template extern void ppc_fmuls(); -template extern void ppc_fdivs(); -template extern void ppc_fmadd(); -template extern void ppc_fmsub(); -template extern void ppc_fnmadd(); -template extern void ppc_fnmsub(); -template extern void ppc_fmadds(); -template extern void ppc_fmsubs(); -template extern void ppc_fnmadds(); -template extern void ppc_fnmsubs(); -template extern void ppc_fabs(); -template extern void ppc_fnabs(); -template extern void ppc_fneg(); -template extern void ppc_fsel(); -template extern void ppc_fres(); -template extern void ppc_fsqrts(); -template extern void ppc_fsqrt(); -template extern void ppc_frsqrte(); -template extern void ppc_frsp(); -template extern void ppc_fctiw(); -template extern void ppc_fctiwz(); +template extern void ppc_fadd(); +template extern void ppc_fsub(); +template extern void ppc_fmul(); +template extern void ppc_fdiv(); +template extern void ppc_fadds(); +template extern void ppc_fsubs(); +template extern void ppc_fmuls(); +template extern void ppc_fdivs(); +template extern void ppc_fmadd(); +template extern void ppc_fmsub(); +template extern void ppc_fnmadd(); +template extern void ppc_fnmsub(); +template extern void ppc_fmadds(); +template extern void ppc_fmsubs(); +template extern void ppc_fnmadds(); +template extern void ppc_fnmsubs(); +template extern void ppc_fabs(); +template extern void ppc_fnabs(); +template extern void ppc_fneg(); +template extern void ppc_fsel(); +template extern void ppc_fres(); +template extern void ppc_fsqrts(); +template extern void ppc_fsqrt(); +template extern void ppc_frsqrte(); +template extern void ppc_frsp(); +template extern void ppc_fctiw(); +template extern void ppc_fctiwz(); extern void ppc_fcmpo(); extern void ppc_fcmpu(); // Power-specific instructions -template extern void power_abs(); +template extern void power_abs(); extern void power_clcs(); -template extern void power_div(); -template extern void power_divs(); -template extern void power_doz(); +template extern void power_div(); +template extern void power_divs(); +template extern void power_doz(); extern void power_dozi(); -template extern void power_lscbx(); -template extern void power_maskg(); -template extern void power_maskir(); -template extern void power_mul(); -template extern void power_nabs(); +template extern void power_lscbx(); +template extern void power_maskg(); +template extern void power_maskir(); +template extern void power_mul(); +template extern void power_nabs(); extern void power_rlmi(); -template extern void power_rrib(); -template extern void power_sle(); -template extern void power_sleq(); -template extern void power_sliq(); -template extern void power_slliq(); -template extern void power_sllq(); -template extern void power_slq(); -template extern void power_sraiq(); -template extern void power_sraq(); -template extern void power_sre(); -template extern void power_srea(); -template extern void power_sreq(); -template extern void power_sriq(); -template extern void power_srliq(); -template extern void power_srlq(); -template extern void power_srq(); +template extern void power_rrib(); +template extern void power_sle(); +template extern void power_sleq(); +template extern void power_sliq(); +template extern void power_slliq(); +template extern void power_sllq(); +template extern void power_slq(); +template extern void power_sraiq(); +template extern void power_sraq(); +template extern void power_sre(); +template extern void power_srea(); +template extern void power_sreq(); +template extern void power_sriq(); +template extern void power_srliq(); +template extern void power_srlq(); +template extern void power_srq(); } // namespace dppc_interpreter // AltiVec instructions diff --git a/cpu/ppc/ppcexec.cpp b/cpu/ppc/ppcexec.cpp index 00bf41c..b9056c9 100644 --- a/cpu/ppc/ppcexec.cpp +++ b/cpu/ppc/ppcexec.cpp @@ -215,7 +215,7 @@ void ppc_opcode18() { SubOpcode18Grabber[ppc_cur_instruction & 3](); } -template +template void ppc_opcode19() { uint16_t subop_grab = ppc_cur_instruction & 0x7FF; @@ -224,10 +224,10 @@ void ppc_opcode19() { ppc_mcrf(); break; case 32: - ppc_bclr(); + ppc_bclr(); break; case 33: - ppc_bclr(); + ppc_bclr(); break; case 66: ppc_crnor(); @@ -260,16 +260,10 @@ void ppc_opcode19() { ppc_cror(); break; case 1056: - if (for601) - ppc_bcctr(); - else - ppc_bcctr(); + ppc_bcctr(); break; case 1057: - if (for601) - ppc_bcctr(); - else - ppc_bcctr(); + ppc_bcctr(); break; default: ppc_illegalop(); diff --git a/cpu/ppc/ppcfpopcodes.cpp b/cpu/ppc/ppcfpopcodes.cpp index 76a74fc..8238dda 100644 --- a/cpu/ppc/ppcfpopcodes.cpp +++ b/cpu/ppc/ppcfpopcodes.cpp @@ -92,7 +92,7 @@ void update_fex() { } template -void ppc_confirm_inf_nan(int chosen_reg_1, int chosen_reg_2, bool rec = false) { +void ppc_confirm_inf_nan(int chosen_reg_1, int chosen_reg_2, field_rc rec = RC0) { double input_a = ppc_state.fpr[chosen_reg_1].dbl64_r; double input_b = ppc_state.fpr[chosen_reg_2].dbl64_r; @@ -156,7 +156,7 @@ static void fpresult_update(double set_result) { } // Floating Point Arithmetic -template +template void dppc_interpreter::ppc_fadd() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -176,7 +176,7 @@ void dppc_interpreter::ppc_fadd() { template void dppc_interpreter::ppc_fadd(); template void dppc_interpreter::ppc_fadd(); -template +template void dppc_interpreter::ppc_fsub() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -196,7 +196,7 @@ void dppc_interpreter::ppc_fsub() { template void dppc_interpreter::ppc_fsub(); template void dppc_interpreter::ppc_fsub(); -template +template void dppc_interpreter::ppc_fdiv() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -215,7 +215,7 @@ void dppc_interpreter::ppc_fdiv() { template void dppc_interpreter::ppc_fdiv(); template void dppc_interpreter::ppc_fdiv(); -template +template void dppc_interpreter::ppc_fmul() { ppc_grab_regsfpdac(ppc_cur_instruction); @@ -234,7 +234,7 @@ void dppc_interpreter::ppc_fmul() { template void dppc_interpreter::ppc_fmul(); template void dppc_interpreter::ppc_fmul(); -template +template void dppc_interpreter::ppc_fmadd() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -256,7 +256,7 @@ void dppc_interpreter::ppc_fmadd() { template void dppc_interpreter::ppc_fmadd(); template void dppc_interpreter::ppc_fmadd(); -template +template void dppc_interpreter::ppc_fmsub() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -278,7 +278,7 @@ void dppc_interpreter::ppc_fmsub() { template void dppc_interpreter::ppc_fmsub(); template void dppc_interpreter::ppc_fmsub(); -template +template void dppc_interpreter::ppc_fnmadd() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -300,7 +300,7 @@ void dppc_interpreter::ppc_fnmadd() { template void dppc_interpreter::ppc_fnmadd(); template void dppc_interpreter::ppc_fnmadd(); -template +template void dppc_interpreter::ppc_fnmsub() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -322,7 +322,7 @@ void dppc_interpreter::ppc_fnmsub() { template void dppc_interpreter::ppc_fnmsub(); template void dppc_interpreter::ppc_fnmsub(); -template +template void dppc_interpreter::ppc_fadds() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -343,7 +343,7 @@ void dppc_interpreter::ppc_fadds() { template void dppc_interpreter::ppc_fadds(); template void dppc_interpreter::ppc_fadds(); -template +template void dppc_interpreter::ppc_fsubs() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -362,7 +362,7 @@ void dppc_interpreter::ppc_fsubs() { template void dppc_interpreter::ppc_fsubs(); template void dppc_interpreter::ppc_fsubs(); -template +template void dppc_interpreter::ppc_fdivs() { ppc_grab_regsfpdab(ppc_cur_instruction); @@ -381,7 +381,7 @@ void dppc_interpreter::ppc_fdivs() { template void dppc_interpreter::ppc_fdivs(); template void dppc_interpreter::ppc_fdivs(); -template +template void dppc_interpreter::ppc_fmuls() { ppc_grab_regsfpdac(ppc_cur_instruction); @@ -400,7 +400,7 @@ void dppc_interpreter::ppc_fmuls() { template void dppc_interpreter::ppc_fmuls(); template void dppc_interpreter::ppc_fmuls(); -template +template void dppc_interpreter::ppc_fmadds() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -422,7 +422,7 @@ void dppc_interpreter::ppc_fmadds() { template void dppc_interpreter::ppc_fmadds(); template void dppc_interpreter::ppc_fmadds(); -template +template void dppc_interpreter::ppc_fmsubs() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -444,7 +444,7 @@ void dppc_interpreter::ppc_fmsubs() { template void dppc_interpreter::ppc_fmsubs(); template void dppc_interpreter::ppc_fmsubs(); -template +template void dppc_interpreter::ppc_fnmadds() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -466,7 +466,7 @@ void dppc_interpreter::ppc_fnmadds() { template void dppc_interpreter::ppc_fnmadds(); template void dppc_interpreter::ppc_fnmadds(); -template +template void dppc_interpreter::ppc_fnmsubs() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -488,7 +488,7 @@ void dppc_interpreter::ppc_fnmsubs() { template void dppc_interpreter::ppc_fnmsubs(); template void dppc_interpreter::ppc_fnmsubs(); -template +template void dppc_interpreter::ppc_fabs() { ppc_grab_regsfpdb(ppc_cur_instruction); @@ -503,7 +503,7 @@ void dppc_interpreter::ppc_fabs() { template void dppc_interpreter::ppc_fabs(); template void dppc_interpreter::ppc_fabs(); -template +template void dppc_interpreter::ppc_fnabs() { ppc_grab_regsfpdb(ppc_cur_instruction); @@ -519,7 +519,7 @@ void dppc_interpreter::ppc_fnabs() { template void dppc_interpreter::ppc_fnabs(); template void dppc_interpreter::ppc_fnabs(); -template +template void dppc_interpreter::ppc_fneg() { ppc_grab_regsfpdb(ppc_cur_instruction); @@ -534,7 +534,7 @@ void dppc_interpreter::ppc_fneg() { template void dppc_interpreter::ppc_fneg(); template void dppc_interpreter::ppc_fneg(); -template +template void dppc_interpreter::ppc_fsel() { ppc_grab_regsfpdabc(ppc_cur_instruction); @@ -549,7 +549,7 @@ void dppc_interpreter::ppc_fsel() { template void dppc_interpreter::ppc_fsel(); template void dppc_interpreter::ppc_fsel(); -template +template void dppc_interpreter::ppc_fsqrt() { ppc_grab_regsfpdb(ppc_cur_instruction); double testd2 = (double)(GET_FPR(reg_b)); @@ -564,7 +564,7 @@ void dppc_interpreter::ppc_fsqrt() { template void dppc_interpreter::ppc_fsqrt(); template void dppc_interpreter::ppc_fsqrt(); -template +template void dppc_interpreter::ppc_fsqrts() { ppc_grab_regsfpdb(ppc_cur_instruction); double testd2 = (double)(GET_FPR(reg_b)); @@ -579,7 +579,7 @@ void dppc_interpreter::ppc_fsqrts() { template void dppc_interpreter::ppc_fsqrts(); template void dppc_interpreter::ppc_fsqrts(); -template +template void dppc_interpreter::ppc_frsqrte() { ppc_grab_regsfpdb(ppc_cur_instruction); double testd2 = (double)(GET_FPR(reg_b)); @@ -596,7 +596,7 @@ void dppc_interpreter::ppc_frsqrte() { template void dppc_interpreter::ppc_frsqrte(); template void dppc_interpreter::ppc_frsqrte(); -template +template void dppc_interpreter::ppc_frsp() { ppc_grab_regsfpdb(ppc_cur_instruction); double ppc_dblresult64_d = (float)(GET_FPR(reg_b)); @@ -609,7 +609,7 @@ void dppc_interpreter::ppc_frsp() { template void dppc_interpreter::ppc_frsp(); template void dppc_interpreter::ppc_frsp(); -template +template void dppc_interpreter::ppc_fres() { ppc_grab_regsfpdb(ppc_cur_instruction); double start_num = GET_FPR(reg_b); @@ -634,7 +634,7 @@ void dppc_interpreter::ppc_fres() { template void dppc_interpreter::ppc_fres(); template void dppc_interpreter::ppc_fres(); -static void round_to_int(const uint8_t mode, bool rec) { +static void round_to_int(const uint8_t mode, field_rc rec) { ppc_grab_regsfpdb(ppc_cur_instruction); double val_reg_b = GET_FPR(reg_b); @@ -691,7 +691,7 @@ static void round_to_int(const uint8_t mode, bool rec) { ppc_update_cr1(); } -template +template void dppc_interpreter::ppc_fctiw() { round_to_int(ppc_state.fpscr & 0x3, rec); } @@ -699,7 +699,7 @@ void dppc_interpreter::ppc_fctiw() { template void dppc_interpreter::ppc_fctiw(); template void dppc_interpreter::ppc_fctiw(); -template +template void dppc_interpreter::ppc_fctiwz() { round_to_int(1, rec); } @@ -873,7 +873,7 @@ void dppc_interpreter::ppc_stfiwx() { // Floating Point Register Transfer -template +template void dppc_interpreter::ppc_fmr() { ppc_grab_regsfpdb(ppc_cur_instruction); ppc_state.fpr[reg_d].dbl64_r = ppc_state.fpr[reg_b].dbl64_r; @@ -885,7 +885,7 @@ void dppc_interpreter::ppc_fmr() { template void dppc_interpreter::ppc_fmr(); template void dppc_interpreter::ppc_fmr(); -template +template void dppc_interpreter::ppc_mffs() { int reg_d = (ppc_cur_instruction >> 21) & 31; @@ -900,7 +900,7 @@ template void dppc_interpreter::ppc_mffs(); template void dppc_interpreter::ppc_mffs(); template void dppc_interpreter::ppc_mffs(); -template +template void dppc_interpreter::ppc_mtfsf() { int reg_b = (ppc_cur_instruction >> 11) & 0x1F; uint8_t fm = (ppc_cur_instruction >> 17) & 0xFF; @@ -933,7 +933,7 @@ void dppc_interpreter::ppc_mtfsf() { template void dppc_interpreter::ppc_mtfsf(); template void dppc_interpreter::ppc_mtfsf(); -template +template void dppc_interpreter::ppc_mtfsfi() { int crf_d = (ppc_cur_instruction >> 21) & 0x1C; uint32_t imm = (ppc_cur_instruction << 16) & 0xF0000000UL; @@ -953,7 +953,7 @@ void dppc_interpreter::ppc_mtfsfi() { template void dppc_interpreter::ppc_mtfsfi(); template void dppc_interpreter::ppc_mtfsfi(); -template +template void dppc_interpreter::ppc_mtfsb0() { int crf_d = (ppc_cur_instruction >> 21) & 0x1F; if (!crf_d || (crf_d > 2)) { // FEX and VX can't be explicitely cleared @@ -967,7 +967,7 @@ void dppc_interpreter::ppc_mtfsb0() { template void dppc_interpreter::ppc_mtfsb0(); template void dppc_interpreter::ppc_mtfsb0(); -template +template void dppc_interpreter::ppc_mtfsb1() { int crf_d = (ppc_cur_instruction >> 21) & 0x1F; if (!crf_d || (crf_d > 2)) { // FEX and VX can't be explicitely set diff --git a/cpu/ppc/ppcopcodes.cpp b/cpu/ppc/ppcopcodes.cpp index 925a16b..53cb619 100644 --- a/cpu/ppc/ppcopcodes.cpp +++ b/cpu/ppc/ppcopcodes.cpp @@ -98,7 +98,7 @@ comparisons needed. This means loads of functions, but less CPU cycles needed to function (theoretically). **/ -template +template void dppc_interpreter::ppc_addi() { ppc_grab_regsdasimm(ppc_cur_instruction); if (shift) @@ -110,7 +110,7 @@ void dppc_interpreter::ppc_addi() { template void dppc_interpreter::ppc_addi(); template void dppc_interpreter::ppc_addi(); -template +template void dppc_interpreter::ppc_addic() { ppc_grab_regsdasimm(ppc_cur_instruction); uint32_t ppc_result_d = (ppc_result_a + simm); @@ -123,7 +123,7 @@ void dppc_interpreter::ppc_addic() { template void dppc_interpreter::ppc_addic(); template void dppc_interpreter::ppc_addic();; -template +template void dppc_interpreter::ppc_add() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t ppc_result_d = ppc_result_a + ppc_result_b; @@ -146,7 +146,7 @@ template void dppc_interpreter::ppc_add(); template void dppc_interpreter::ppc_add(); template void dppc_interpreter::ppc_add(); -template +template void dppc_interpreter::ppc_adde() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t xer_ca = !!(ppc_state.spr[SPR::XER] & 0x20000000); @@ -171,7 +171,7 @@ template void dppc_interpreter::ppc_adde(); template void dppc_interpreter::ppc_adde(); template void dppc_interpreter::ppc_adde(); -template +template void dppc_interpreter::ppc_addme() { ppc_grab_regsda(ppc_cur_instruction); uint32_t xer_ca = !!(ppc_state.spr[SPR::XER] & 0x20000000); @@ -196,7 +196,7 @@ template void dppc_interpreter::ppc_addme(); template void dppc_interpreter::ppc_addme(); template void dppc_interpreter::ppc_addme(); -template +template void dppc_interpreter::ppc_addze() { ppc_grab_regsda(ppc_cur_instruction); uint32_t grab_xer = !!(ppc_state.spr[SPR::XER] & 0x20000000); @@ -231,7 +231,7 @@ void dppc_interpreter::ppc_subfic() { ppc_store_iresult_reg(reg_d, ppc_result_d); } -template +template void dppc_interpreter::ppc_subf() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t ppc_result_d = ppc_result_b - ppc_result_a; @@ -255,7 +255,7 @@ template void dppc_interpreter::ppc_subf(); template void dppc_interpreter::ppc_subf(); template void dppc_interpreter::ppc_subf(); -template +template void dppc_interpreter::ppc_subfe() { ppc_grab_regsdab(ppc_cur_instruction); uint32_t grab_ca = !!(ppc_state.spr[SPR::XER] & XER::CA); @@ -278,7 +278,7 @@ template void dppc_interpreter::ppc_subfe(); template void dppc_interpreter::ppc_subfe(); template void dppc_interpreter::ppc_subfe(); -template +template void dppc_interpreter::ppc_subfme() { ppc_grab_regsda(ppc_cur_instruction); uint32_t grab_ca = !!(ppc_state.spr[SPR::XER] & XER::CA); @@ -307,7 +307,7 @@ template void dppc_interpreter::ppc_subfme(); template void dppc_interpreter::ppc_subfme(); template void dppc_interpreter::ppc_subfme(); -template +template void dppc_interpreter::ppc_subfze() { ppc_grab_regsda(ppc_cur_instruction); uint32_t grab_ca = !!(ppc_state.spr[SPR::XER] & XER::CA); @@ -336,7 +336,7 @@ template void dppc_interpreter::ppc_subfze(); template void dppc_interpreter::ppc_subfze(); template void dppc_interpreter::ppc_subfze(); -template +template void dppc_interpreter::ppc_andirc() { ppc_grab_regssauimm(ppc_cur_instruction); ppc_result_a = shift ? (ppc_result_d & (uimm << 16)) : (ppc_result_d & uimm); @@ -347,7 +347,7 @@ void dppc_interpreter::ppc_andirc() { template void dppc_interpreter::ppc_andirc(); template void dppc_interpreter::ppc_andirc(); -template +template void dppc_interpreter::ppc_ori() { ppc_grab_regssauimm(ppc_cur_instruction); ppc_result_a = shift ? (ppc_result_d | (uimm << 16)) : (ppc_result_d | uimm); @@ -357,7 +357,7 @@ void dppc_interpreter::ppc_ori() { template void dppc_interpreter::ppc_ori(); template void dppc_interpreter::ppc_ori(); -template +template void dppc_interpreter::ppc_xori() { ppc_grab_regssauimm(ppc_cur_instruction); ppc_result_a = shift ? (ppc_result_d ^ (uimm << 16)) : (ppc_result_d ^ uimm); @@ -367,7 +367,7 @@ void dppc_interpreter::ppc_xori() { template void dppc_interpreter::ppc_xori(); template void dppc_interpreter::ppc_xori(); -template +template void dppc_interpreter::ppc_do_bool() { ppc_grab_regssab(ppc_cur_instruction); if (bool_op == bool_fun::bool_and) @@ -410,7 +410,7 @@ template void dppc_interpreter::ppc_do_bool(); template void dppc_interpreter::ppc_do_bool(); template void dppc_interpreter::ppc_do_bool(); -template +template void dppc_interpreter::ppc_neg() { ppc_grab_regsda(ppc_cur_instruction); uint32_t ppc_result_d = ~(ppc_result_a) + 1; @@ -433,7 +433,7 @@ template void dppc_interpreter::ppc_neg(); template void dppc_interpreter::ppc_neg(); template void dppc_interpreter::ppc_neg(); -template +template void dppc_interpreter::ppc_cntlzw() { ppc_grab_regssa(ppc_cur_instruction); @@ -463,7 +463,7 @@ void dppc_interpreter::ppc_cntlzw() { template void dppc_interpreter::ppc_cntlzw(); template void dppc_interpreter::ppc_cntlzw();; -template +template void dppc_interpreter::ppc_mulhwu() { ppc_grab_regsdab(ppc_cur_instruction); uint64_t product = uint64_t(ppc_result_a) * uint64_t(ppc_result_b); @@ -478,7 +478,7 @@ void dppc_interpreter::ppc_mulhwu() { template void dppc_interpreter::ppc_mulhwu(); template void dppc_interpreter::ppc_mulhwu();; -template +template void dppc_interpreter::ppc_mulhw() { ppc_grab_regsdab(ppc_cur_instruction); int64_t product = int64_t(int32_t(ppc_result_a)) * int64_t(int32_t(ppc_result_b)); @@ -493,7 +493,7 @@ void dppc_interpreter::ppc_mulhw() { template void dppc_interpreter::ppc_mulhw(); template void dppc_interpreter::ppc_mulhw();; -template +template void dppc_interpreter::ppc_mullw() { ppc_grab_regsdab(ppc_cur_instruction); int64_t product = int64_t(int32_t(ppc_result_a)) * int64_t(int32_t(ppc_result_b)); @@ -526,7 +526,7 @@ void dppc_interpreter::ppc_mulli() { ppc_store_iresult_reg(reg_d, ppc_result_d); } -template +template void dppc_interpreter::ppc_divw() { uint32_t ppc_result_d; ppc_grab_regsdab(ppc_cur_instruction); @@ -562,7 +562,7 @@ template void dppc_interpreter::ppc_divw(); template void dppc_interpreter::ppc_divw(); template void dppc_interpreter::ppc_divw(); -template +template void dppc_interpreter::ppc_divwu() { uint32_t ppc_result_d; ppc_grab_regsdab(ppc_cur_instruction); @@ -595,14 +595,14 @@ template void dppc_interpreter::ppc_divwu(); // Value shifting -template +template void dppc_interpreter::ppc_shift() { ppc_grab_regssab(ppc_cur_instruction); if (ppc_result_b & 0x20) { ppc_result_a = 0; } else { - ppc_result_a = left ? (ppc_result_d << (ppc_result_b & 0x1F)) + ppc_result_a = shift ? (ppc_result_d << (ppc_result_b & 0x1F)) : (ppc_result_d >> (ppc_result_b & 0x1F)); } @@ -617,7 +617,7 @@ template void dppc_interpreter::ppc_shift(); template void dppc_interpreter::ppc_shift(); template void dppc_interpreter::ppc_shift(); -template +template void dppc_interpreter::ppc_sraw() { ppc_grab_regssab(ppc_cur_instruction); @@ -645,7 +645,7 @@ void dppc_interpreter::ppc_sraw() { template void dppc_interpreter::ppc_sraw(); template void dppc_interpreter::ppc_sraw();; -template +template void dppc_interpreter::ppc_srawi() { ppc_grab_regssa(ppc_cur_instruction); uint32_t shift = (ppc_cur_instruction >> 11) & 0x1F; @@ -1021,7 +1021,7 @@ void dppc_interpreter::ppc_mcrxr() { ppc_state.spr[SPR::XER] &= 0x0FFFFFFF; } -template +template void dppc_interpreter::ppc_exts() { ppc_grab_regssa(ppc_cur_instruction); ppc_result_a = int32_t(T(ppc_result_d)); @@ -1039,7 +1039,7 @@ template void dppc_interpreter::ppc_exts(); // Branching Instructions -template +template void dppc_interpreter::ppc_b() { int32_t adr_li = int32_t((ppc_cur_instruction & ~3UL) << 6) >> 6; @@ -1059,7 +1059,7 @@ template void dppc_interpreter::ppc_b(); template void dppc_interpreter::ppc_b(); template void dppc_interpreter::ppc_b(); -template +template void dppc_interpreter::ppc_bc() { uint32_t ctr_ok; uint32_t cnd_ok; @@ -1090,7 +1090,7 @@ template void dppc_interpreter::ppc_bc(); template void dppc_interpreter::ppc_bc(); template void dppc_interpreter::ppc_bc(); -template +template void dppc_interpreter::ppc_bcctr() { uint32_t ctr_ok; uint32_t cnd_ok; @@ -1125,7 +1125,7 @@ template void dppc_interpreter::ppc_bcctr(); template void dppc_interpreter::ppc_bcctr(); template void dppc_interpreter::ppc_bcctr(); -template +template void dppc_interpreter::ppc_bclr() { uint32_t br_bo = (ppc_cur_instruction >> 21) & 31; uint32_t br_bi = (ppc_cur_instruction >> 16) & 31;