> From: Mateja Marjanovic <mateja.marjano...@rt-rk.com> > >> > >> +void helper_msa_ilvr_b(CPUMIPSState *env, uint32_t wd, > >> + uint32_t ws, uint32_t wt) > >> +{ > >> + wr_t *pwd = &(env->active_fpu.fpr[wd].wr); > >> + wr_t *pws = &(env->active_fpu.fpr[ws].wr); > >> + wr_t *pwt = &(env->active_fpu.fpr[wt].wr); > >> + > > Why do we use here env->active_fpu.fpr[wd].wr, while for other instructions > > in > > this patch, we access msa_wr_d<b|h|w|d[] directly? > With a pointer to wr_t we have an array of bytes, halfwords, words or > doublewords > and can read from them and change them like an ordinary array. In other > cases > we use a variable that is TCGv_i64 and would have to use tcg_gen > functions to > modify the value of the register. Before my changes in ilvr instruction > helpers > env->active_fpu.fpr[wd].wr was used, so I just copy-pasted that. >
Your answer touches just surface, and doesn't fully answer my question. I would like you to show deeper understanding of the code you are working with. You can't just copy/paste without thinking. Why do majority of MSA helpers use env->active_fpu.fpr[<index>].wr, while your code mostly reference the MSA register directly? Is this the same thing? If yes, why all MSA code doesn't use registers directly, which would certainly be simpler than referencing active_fpu? What is the role of "active_fpu"? Can it be changed? Can you analyze the underlying reasons for referencing "active_fpu", and can you claim that it is safe to circumvent it and reference the MSA registers directly? Thanks, Aleksandar