target/mips: Clean up handling of CP0 register 0

Clean up handling of CP0 register 0.

Backports commit 1b142da5f82a8fcdc7783a418592de654d5c6052 from qemu
This commit is contained in:
Aleksandar Markovic 2019-11-18 22:25:12 -05:00 committed by Lioncash
parent effccae2d9
commit 47adeabf87
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 23 additions and 20 deletions

View file

@ -276,6 +276,9 @@ typedef struct mips_def_t mips_def_t;
/* CP0 Register 00 */ /* CP0 Register 00 */
#define CP0_REG00__INDEX 0 #define CP0_REG00__INDEX 0
#define CP0_REG00__MVPCONTROL 1
#define CP0_REG00__MVPCONF0 2
#define CP0_REG00__MVPCONF1 3
#define CP0_REG00__VPCONTROL 4 #define CP0_REG00__VPCONTROL 4
/* CP0 Register 01 */ /* CP0 Register 01 */
/* CP0 Register 02 */ /* CP0 Register 02 */

View file

@ -6896,26 +6896,26 @@ static void gen_mfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
switch (reg) { switch (reg) {
case CP0_REGISTER_00: case CP0_REGISTER_00:
switch (sel) { switch (sel) {
case 0: case CP0_REG00__INDEX:
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_Index)); gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_Index));
register_name = "Index"; register_name = "Index";
break; break;
case 1: case CP0_REG00__MVPCONTROL:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpcontrol(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpcontrol(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPControl"; register_name = "MVPControl";
break; break;
case 2: case CP0_REG00__MVPCONF0:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf0(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpconf0(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPConf0"; register_name = "MVPConf0";
break; break;
case 3: case CP0_REG00__MVPCONF1:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf1(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpconf1(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPConf1"; register_name = "MVPConf1";
break; break;
case 4: case CP0_REG00__VPCONTROL:
CP0_CHECK(ctx->vp); CP0_CHECK(ctx->vp);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_VPControl)); gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_VPControl));
register_name = "VPControl"; register_name = "VPControl";
@ -7653,26 +7653,26 @@ static void gen_mtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
switch (reg) { switch (reg) {
case CP0_REGISTER_00: case CP0_REGISTER_00:
switch (sel) { switch (sel) {
case 0: case CP0_REG00__INDEX:
gen_helper_mtc0_index(tcg_ctx, tcg_ctx->cpu_env, arg); gen_helper_mtc0_index(tcg_ctx, tcg_ctx->cpu_env, arg);
register_name = "Index"; register_name = "Index";
break; break;
case 1: case CP0_REG00__MVPCONTROL:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_mvpcontrol(tcg_ctx, tcg_ctx->cpu_env, arg); gen_helper_mtc0_mvpcontrol(tcg_ctx, tcg_ctx->cpu_env, arg);
register_name = "MVPControl"; register_name = "MVPControl";
break; break;
case 2: case CP0_REG00__MVPCONF0:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */ /* ignored */
register_name = "MVPConf0"; register_name = "MVPConf0";
break; break;
case 3: case CP0_REG00__MVPCONF1:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */ /* ignored */
register_name = "MVPConf1"; register_name = "MVPConf1";
break; break;
case 4: case CP0_REG00__VPCONTROL:
CP0_CHECK(ctx->vp); CP0_CHECK(ctx->vp);
/* ignored */ /* ignored */
register_name = "VPControl"; register_name = "VPControl";
@ -8394,26 +8394,26 @@ static void gen_dmfc0(DisasContext *ctx, TCGv arg, int reg, int sel)
switch (reg) { switch (reg) {
case CP0_REGISTER_00: case CP0_REGISTER_00:
switch (sel) { switch (sel) {
case 0: case CP0_REG00__INDEX:
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_Index)); gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_Index));
register_name = "Index"; register_name = "Index";
break; break;
case 1: case CP0_REG00__MVPCONTROL:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpcontrol(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpcontrol(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPControl"; register_name = "MVPControl";
break; break;
case 2: case CP0_REG00__MVPCONF0:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf0(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpconf0(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPConf0"; register_name = "MVPConf0";
break; break;
case 3: case CP0_REG00__MVPCONF1:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mfc0_mvpconf1(tcg_ctx, arg, tcg_ctx->cpu_env); gen_helper_mfc0_mvpconf1(tcg_ctx, arg, tcg_ctx->cpu_env);
register_name = "MVPConf1"; register_name = "MVPConf1";
break; break;
case 4: case CP0_REG00__VPCONTROL:
CP0_CHECK(ctx->vp); CP0_CHECK(ctx->vp);
gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_VPControl)); gen_mfc0_load32(ctx, arg, offsetof(CPUMIPSState, CP0_VPControl));
register_name = "VPControl"; register_name = "VPControl";
@ -9106,26 +9106,26 @@ static void gen_dmtc0(DisasContext *ctx, TCGv arg, int reg, int sel)
switch (reg) { switch (reg) {
case CP0_REGISTER_00: case CP0_REGISTER_00:
switch (sel) { switch (sel) {
case 0: case CP0_REG00__INDEX:
gen_helper_mtc0_index(tcg_ctx, tcg_ctx->cpu_env, arg); gen_helper_mtc0_index(tcg_ctx, tcg_ctx->cpu_env, arg);
register_name = "Index"; register_name = "Index";
break; break;
case 1: case CP0_REG00__MVPCONTROL:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
gen_helper_mtc0_mvpcontrol(tcg_ctx, tcg_ctx->cpu_env, arg); gen_helper_mtc0_mvpcontrol(tcg_ctx, tcg_ctx->cpu_env, arg);
register_name = "MVPControl"; register_name = "MVPControl";
break; break;
case 2: case CP0_REG00__MVPCONF0:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */ /* ignored */
register_name = "MVPConf0"; register_name = "MVPConf0";
break; break;
case 3: case CP0_REG00__MVPCONF1:
CP0_CHECK(ctx->insn_flags & ASE_MT); CP0_CHECK(ctx->insn_flags & ASE_MT);
/* ignored */ /* ignored */
register_name = "MVPConf1"; register_name = "MVPConf1";
break; break;
case 4: case CP0_REG00__VPCONTROL:
CP0_CHECK(ctx->vp); CP0_CHECK(ctx->vp);
/* ignored */ /* ignored */
register_name = "VPControl"; register_name = "VPControl";