+ 10*4 + 22*5 /* SPE GPRh */
#endif
+ 10*4 + 22*5 /* FPR */
- + 2*(10*6 + 22*7) /* AVRh, AVRl */];
+ + 2*(10*6 + 22*7) /* AVRh, AVRl */
+ + 8*5 /* CRF */];
static TCGv cpu_gpr[32];
#if !defined(TARGET_PPC64)
static TCGv cpu_gprh[32];
#endif
static TCGv cpu_fpr[32];
static TCGv cpu_avrh[32], cpu_avrl[32];
+static TCGv cpu_crf[8];
/* dyngen register indexes */
static TCGv cpu_T[3];
offsetof(CPUState, avr2.u64[1]), "AVR2L");
p = cpu_reg_names;
+
+ for (i = 0; i < 8; i++) {
+ sprintf(p, "crf%d", i);
+ cpu_crf[i] = tcg_global_mem_new(TCG_TYPE_I32, TCG_AREG0,
+ offsetof(CPUState, crf[i]), p);
+ p += 5;
+ }
+
for (i = 0; i < 32; i++) {
sprintf(p, "r%d", i);
cpu_gpr[i] = tcg_global_mem_new(TCG_TYPE_TL, TCG_AREG0,
static uint16_t **gen_fprf_ptr;
#endif
-#define GEN8(func, NAME) \
-static GenOpFunc *NAME ## _table [8] = { \
-NAME ## 0, NAME ## 1, NAME ## 2, NAME ## 3, \
-NAME ## 4, NAME ## 5, NAME ## 6, NAME ## 7, \
-}; \
-static always_inline void func (int n) \
-{ \
- NAME ## _table[n](); \
-}
-
#define GEN16(func, NAME) \
static GenOpFunc *NAME ## _table [16] = { \
NAME ## 0, NAME ## 1, NAME ## 2, NAME ## 3, \
NAME ## _table[n](); \
}
-/* Condition register moves */
-GEN8(gen_op_load_crf_T0, gen_op_load_crf_T0_crf);
-GEN8(gen_op_load_crf_T1, gen_op_load_crf_T1_crf);
-GEN8(gen_op_store_T0_crf, gen_op_store_T0_crf_crf);
-#if 0 // Unused
-GEN8(gen_op_store_T1_crf, gen_op_store_T1_crf_crf);
-#endif
-
/* internal defines */
typedef struct DisasContext {
struct TranslationBlock *tb;
#endif
gen_op_compute_fprf(1);
if (unlikely(set_rc))
- gen_op_store_T0_crf(1);
+ tcg_gen_andi_i32(cpu_crf[1], cpu_T[0], 0xf);
gen_op_float_check_status();
} else if (unlikely(set_rc)) {
/* We always need to compute fpcc */
gen_op_compute_fprf(0);
- gen_op_store_T0_crf(1);
+ tcg_gen_andi_i32(cpu_crf[1], cpu_T[0], 0xf);
if (set_fprf)
gen_op_float_check_status();
}
gen_op_##name##_64(); \
else \
gen_op_##name(); \
- gen_op_store_T0_crf(crfD(ctx->opcode)); \
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
}
#else
#define GEN_CMP(name, opc, type) \
tcg_gen_mov_tl(cpu_T[0], cpu_gpr[rA(ctx->opcode)]); \
tcg_gen_mov_tl(cpu_T[1], cpu_gpr[rB(ctx->opcode)]); \
gen_op_##name(); \
- gen_op_store_T0_crf(crfD(ctx->opcode)); \
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
}
#endif
else
#endif
gen_op_cmpi(SIMM(ctx->opcode));
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
}
/* cmpl */
GEN_CMP(cmpl, 0x01, PPC_INTEGER);
else
#endif
gen_op_cmpli(UIMM(ctx->opcode));
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
}
/* isel (PowerPC 2.03 specification) */
}
tcg_gen_mov_tl(cpu_T[2], cpu_gpr[rB(ctx->opcode)]);
mask = 1 << (3 - (bi & 0x03));
- gen_op_load_crf_T0(bi >> 2);
+ tcg_gen_mov_i32(cpu_T[0], cpu_crf[bi >> 2]);
gen_op_test_true(mask);
gen_op_isel();
tcg_gen_mov_tl(cpu_gpr[rD(ctx->opcode)], cpu_T[0]);
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]);
gen_reset_fpstatus();
gen_op_fcmpo();
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
gen_op_float_check_status();
}
tcg_gen_mov_i64(cpu_FT[1], cpu_fpr[rB(ctx->opcode)]);
gen_reset_fpstatus();
gen_op_fcmpu();
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
gen_op_float_check_status();
}
gen_optimize_fprf();
bfa = 4 * (7 - crfS(ctx->opcode));
gen_op_load_fpscr_T0(bfa);
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
gen_op_fpscr_resetbit(~(0xF << bfa));
}
}
} else {
mask = 1 << (3 - (bi & 0x03));
- gen_op_load_crf_T0(bi >> 2);
+ tcg_gen_mov_i32(cpu_T[0], cpu_crf[bi >> 2]);
if (bo & 0x8) {
switch (bo & 0x6) {
case 0:
{ \
uint8_t bitmask; \
int sh; \
- gen_op_load_crf_T0(crbA(ctx->opcode) >> 2); \
+ tcg_gen_mov_i32(cpu_T[0], cpu_crf[crbA(ctx->opcode) >> 2]); \
sh = (crbD(ctx->opcode) & 0x03) - (crbA(ctx->opcode) & 0x03); \
if (sh > 0) \
gen_op_srli_T0(sh); \
else if (sh < 0) \
gen_op_sli_T0(-sh); \
- gen_op_load_crf_T1(crbB(ctx->opcode) >> 2); \
+ tcg_gen_mov_i32(cpu_T[1], cpu_crf[crbB(ctx->opcode) >> 2]); \
sh = (crbD(ctx->opcode) & 0x03) - (crbB(ctx->opcode) & 0x03); \
if (sh > 0) \
gen_op_srli_T1(sh); \
gen_op_##op(); \
bitmask = 1 << (3 - (crbD(ctx->opcode) & 0x03)); \
gen_op_andi_T0(bitmask); \
- gen_op_load_crf_T1(crbD(ctx->opcode) >> 2); \
- gen_op_andi_T1(~bitmask); \
+ tcg_gen_andi_i32(cpu_T[1], cpu_crf[crbD(ctx->opcode) >> 2], ~bitmask); \
gen_op_or(); \
- gen_op_store_T0_crf(crbD(ctx->opcode) >> 2); \
+ tcg_gen_andi_i32(cpu_crf[crbD(ctx->opcode) >> 2], cpu_T[0], 0xf); \
}
/* crand */
/* mcrf */
GEN_HANDLER(mcrf, 0x13, 0x00, 0xFF, 0x00000001, PPC_INTEGER)
{
- gen_op_load_crf_T0(crfS(ctx->opcode));
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_mov_i32(cpu_crf[crfD(ctx->opcode)], cpu_crf[crfS(ctx->opcode)]);
}
/*** System linkage ***/
GEN_HANDLER(mcrxr, 0x1F, 0x00, 0x10, 0x007FF801, PPC_MISC)
{
gen_op_load_xer_cr();
- gen_op_store_T0_crf(crfD(ctx->opcode));
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf);
gen_op_clear_xer_ov();
gen_op_clear_xer_ca();
}
crm = CRM(ctx->opcode);
if (likely((crm ^ (crm - 1)) == 0)) {
crn = ffs(crm);
- gen_op_load_cro(7 - crn);
+ tcg_gen_mov_i32(cpu_T[0], cpu_crf[7 - crn]);
}
} else {
gen_op_load_cr();
if (likely((ctx->opcode & 0x00100000) || (crm ^ (crm - 1)) == 0)) {
crn = ffs(crm);
gen_op_srli_T0(crn * 4);
- gen_op_andi_T0(0xF);
- gen_op_store_cro(7 - crn);
+ tcg_gen_andi_i32(cpu_crf[7 - crn], cpu_T[0], 0xf);
} else {
gen_op_store_cr(crm);
}
gen_op_store_xer_bc();
if (Rc(ctx->opcode)) {
gen_op_440_dlmzb_update_Rc();
- gen_op_store_T0_crf(0);
+ tcg_gen_andi_i32(cpu_crf[0], cpu_T[0], 0xf);
}
}
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode)); \
gen_load_gpr64(cpu_T64[1], rB(ctx->opcode)); \
gen_op_##name(); \
- gen_op_store_T0_crf(crfD(ctx->opcode)); \
+ tcg_gen_andi_i32(cpu_crf[crfD(ctx->opcode)], cpu_T[0], 0xf); \
}
/* Logical */
GEN_EXCP_NO_AP(ctx);
return;
}
- gen_op_load_crf_T0(ctx->opcode & 0x7);
+ tcg_gen_mov_i32(cpu_T[0], cpu_crf[ctx->opcode & 0x7]);
gen_load_gpr64(cpu_T64[0], rA(ctx->opcode));
gen_load_gpr64(cpu_T64[1], rB(ctx->opcode));
gen_op_evsel();