e2k: Remove {GET,SET}_FIELD macros.
This commit is contained in:
parent
535b0a0616
commit
2fc5c4f8e3
|
@ -10,12 +10,6 @@ void e2k_tcg_initialize(void);
|
|||
|
||||
#define GEN_MASK(start, len) (((1UL << (len)) - 1) << (start))
|
||||
#define GET_BIT(v, index) (((v) >> (index)) & 1)
|
||||
#define GET_FIELD(v, s, l) (((v) >> (s)) & GEN_MASK(0, l))
|
||||
#define SET_FIELD(v, f, s, l) \
|
||||
( \
|
||||
((v) & ~GEN_MASK((s), (l))) | \
|
||||
((((typeof((v))) (f)) << (s)) & GEN_MASK((s), (l))) \
|
||||
)
|
||||
|
||||
#define MMU_USER_IDX 1
|
||||
#define CPU_RESOLVING_TYPE TYPE_E2K_CPU
|
||||
|
|
|
@ -146,17 +146,17 @@ static size_t unpack_bundle(CPUE2KState *env,
|
|||
|
||||
/* Set POS to point to the last syllable in the current wide instruction and
|
||||
extract CDSj and PLSj syllables if any. */
|
||||
pos = ((GET_FIELD(hs, 4, 3) + 1) << 3) - 4;
|
||||
pos = ((extract32(hs, 4, 3) + 1) << 3) - 4;
|
||||
|
||||
/* Check for CDSj syllables. */
|
||||
for (i = 0; i < GET_FIELD(hs, 16, 2); i++) {
|
||||
for (i = 0; i < extract32(hs, 16, 2); i++) {
|
||||
bundle->cds_present[i] = true;
|
||||
bundle->cds[i] = translator_ldl(env, pc + pos);
|
||||
pos -= 4;
|
||||
}
|
||||
|
||||
/* Check for PLSj syllables. */
|
||||
for (i = 0; i < GET_FIELD(hs, 18, 2); i++) {
|
||||
for (i = 0; i < extract32(hs, 18, 2); i++) {
|
||||
bundle->pls_present[i] = true;
|
||||
bundle->pls[i] = translator_ldl(env, pc + pos);
|
||||
pos -= 4;
|
||||
|
@ -182,7 +182,7 @@ static size_t unpack_bundle(CPUE2KState *env,
|
|||
pos -= 4;
|
||||
}
|
||||
|
||||
return 8 + GET_FIELD(hs, 4, 3) * 8;
|
||||
return 8 + extract32(hs, 4, 3) * 8;
|
||||
}
|
||||
|
||||
static inline bool use_goto_tb(DisasContext *s, target_ulong pc,
|
||||
|
|
|
@ -603,7 +603,7 @@ static inline bool is_mrgc(uint16_t rlp, int chan)
|
|||
{
|
||||
int is_mrgc = GET_BIT(rlp, 15);
|
||||
int cluster = GET_BIT(rlp, 14);
|
||||
int alc_mask = GET_FIELD(rlp, 10, 3);
|
||||
int alc_mask = extract32(rlp, 10, 3);
|
||||
int alc = GET_BIT(alc_mask, chan % 3);
|
||||
|
||||
return is_mrgc && (cluster == (chan > 2)) && (alc != 0);
|
||||
|
|
|
@ -236,7 +236,7 @@ static void gen_cs0(DisasContext *dc)
|
|||
if (type == GETTSD && param_type != 1) {
|
||||
e2k_tr_gen_exception(dc, E2K_EXCP_ILLOPC);
|
||||
}
|
||||
int ipd = bundle->ss_present ? GET_FIELD(bundle->ss, 30, 2) : 3;
|
||||
int ipd = bundle->ss_present ? extract32(bundle->ss, 30, 2) : 3;
|
||||
if (type == DISP || type == LDISP) {
|
||||
int32_t sdisp = sextract32(cs0, 0, 28) << 3;
|
||||
uint64_t reg = (dc->pc + sdisp) |
|
||||
|
@ -247,7 +247,7 @@ static void gen_cs0(DisasContext *dc)
|
|||
}
|
||||
tcg_gen_movi_tl(e2k_cs.ctprs[ctpr - 1], reg);
|
||||
} else if (type == SDISP) {
|
||||
unsigned int disp = GET_FIELD(cs0, 0, 28) << 11;
|
||||
unsigned int disp = extract32(cs0, 0, 28) << 11;
|
||||
target_ulong base = ((uint64_t) 0xe2 << 40) | disp;
|
||||
uint64_t reg = (dc->pc + base) |
|
||||
((uint64_t) CTPR_TAG_SDISP << CTPR_TAG_OFF) |
|
||||
|
@ -374,7 +374,7 @@ static void gen_cs1(DisasContext *dc)
|
|||
unsigned int ctop = (bundle->ss & 0x00000c00) >> 10;
|
||||
if (ctop) {
|
||||
dc->ct.type = CT_CALL;
|
||||
dc->ct.wbs = GET_FIELD(cs1, 0, 7);
|
||||
dc->ct.wbs = extract32(cs1, 0, 7);
|
||||
} else {
|
||||
unsigned int cs1_ctopc = (cs1 & 0x380) >> 7;
|
||||
/* CS1.param.ctpopc == HCALL. CS0 is required to encode HCALL. */
|
||||
|
@ -622,9 +622,9 @@ void e2k_control_window_change(DisasContext *dc)
|
|||
}
|
||||
|
||||
if (setbn) {
|
||||
int rbs = GET_FIELD(cs1, BR_RBS_OFF, BR_RBS_LEN);
|
||||
int rsz = GET_FIELD(cs1, BR_RSZ_OFF, BR_RSZ_LEN);
|
||||
int rcur = GET_FIELD(cs1, BR_RCUR_OFF, BR_RCUR_LEN);
|
||||
int rbs = extract32(cs1, BR_RBS_OFF, BR_RBS_LEN);
|
||||
int rsz = extract32(cs1, BR_RSZ_OFF, BR_RSZ_LEN);
|
||||
int rcur = extract32(cs1, BR_RCUR_OFF, BR_RCUR_LEN);
|
||||
|
||||
tcg_gen_movi_i32(e2k_cs.boff, rbs * 2);
|
||||
tcg_gen_movi_i32(e2k_cs.bsize, (rsz + 1) * 2);
|
||||
|
@ -632,7 +632,7 @@ void e2k_control_window_change(DisasContext *dc)
|
|||
}
|
||||
|
||||
if (setbp) {
|
||||
int psz = GET_FIELD(cs1, BR_PSZ_OFF, BR_PSZ_LEN);
|
||||
int psz = extract32(cs1, BR_PSZ_OFF, BR_PSZ_LEN);
|
||||
|
||||
tcg_gen_movi_i32(e2k_cs.psize, psz);
|
||||
tcg_gen_movi_i32(e2k_cs.pcur, 0);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
static void gen_get_lp(TCGv_i32 ret, uint16_t clp, int offset, TCGv_i32 lp[7])
|
||||
{
|
||||
int p = GET_FIELD(clp, offset, 3);
|
||||
int p = extract32(clp, offset, 3);
|
||||
int neg = GET_BIT(clp, offset + 3);
|
||||
|
||||
tcg_gen_xori_i32(ret, lp[p], neg);
|
||||
|
@ -69,8 +69,8 @@ static inline void scan_needed(const UnpackedBundle *bundle, int need[7])
|
|||
continue;
|
||||
}
|
||||
|
||||
p0 = GET_FIELD(bundle->pls[i], 10, 3);
|
||||
p1 = GET_FIELD(bundle->pls[i], 6, 3);
|
||||
p0 = extract32(bundle->pls[i], 10, 3);
|
||||
p1 = extract32(bundle->pls[i], 6, 3);
|
||||
|
||||
if (p0 < 7 && need[p0] == 0) {
|
||||
need[p0] = 1;
|
||||
|
@ -117,23 +117,23 @@ void e2k_plu_execute(DisasContext *ctx)
|
|||
|
||||
if (i < 2) {
|
||||
if (need[i * 2]) {
|
||||
int elp = GET_FIELD(bundle->pls[i], 24, 7);
|
||||
int elp = extract32(bundle->pls[i], 24, 7);
|
||||
e2k_gen_cond_i32(ctx, lp[i * 2], elp);
|
||||
}
|
||||
|
||||
if (need[i * 2 + 1]) {
|
||||
int elp = GET_FIELD(bundle->pls[i], 16, 7);
|
||||
int elp = extract32(bundle->pls[i], 16, 7);
|
||||
e2k_gen_cond_i32(ctx, lp[i * 2 + 1], elp);
|
||||
}
|
||||
}
|
||||
|
||||
if (need[4 + i]) {
|
||||
uint16_t clp = GET_FIELD(bundle->pls[i], 0, 16);
|
||||
int opc = GET_FIELD(clp, 14, 2);
|
||||
uint16_t clp = extract32(bundle->pls[i], 0, 16);
|
||||
int opc = extract32(clp, 14, 2);
|
||||
TCGv_i32 p0 = tcg_temp_new_i32();
|
||||
TCGv_i32 p1 = tcg_temp_new_i32();
|
||||
int vdst = GET_BIT(clp, 5);
|
||||
int pdst = GET_FIELD(clp, 0, 5);
|
||||
int pdst = extract32(clp, 0, 5);
|
||||
|
||||
// TODO: check clp arg
|
||||
// {C/M}LP0 0, 1 => 4
|
||||
|
|
Loading…
Reference in New Issue