On 11/26/25 14:21, Philippe Mathieu-Daudé wrote:
In preparation of removing the cpu_ld*_mmuidx_ra() and
cpu_st*_mmuidx_ra() calls, inline them. Expand MO_TE to
mo_endian_env(env).

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  target/mips/tcg/ldst_helper.c | 49 +++++++++++++++++++----------------
  1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/target/mips/tcg/ldst_helper.c b/target/mips/tcg/ldst_helper.c
index f3652034afa..716b60e3a39 100644
--- a/target/mips/tcg/ldst_helper.c
+++ b/target/mips/tcg/ldst_helper.c
@@ -237,8 +237,10 @@ void helper_sdr(CPUMIPSState *env, target_ulong arg1, 
target_ulong arg2,
  static const int multiple_regs[] = { 16, 17, 18, 19, 20, 21, 22, 23, 30 };
void helper_lwm(CPUMIPSState *env, target_ulong addr, target_ulong reglist,
-                uint32_t mem_idx)
+                uint32_t mmu_idx)
  {
+    MemOp op = mo_endian_env(env) | MO_UL | MO_UNALN;
+    MemOpIdx oi = make_memop_idx(op, mmu_idx);
      target_ulong base_reglist = reglist & 0xf;
      target_ulong do_r31 = reglist & 0x10;
@@ -247,20 +249,22 @@ void helper_lwm(CPUMIPSState *env, target_ulong addr, target_ulong reglist, for (i = 0; i < base_reglist; i++) {
              env->active_tc.gpr[multiple_regs[i]] =
-                (target_long)cpu_ldl_mmuidx_ra(env, addr, mem_idx, GETPC());
+                (target_long)cpu_ldl_mmu(env, addr, oi, GETPC());

While this is a faithful expansion of cpu_ldl_mmuidx_ra, v5 micromips requires alignment and v6 micromips does not. You may be better served passing the whole MemOpIdx down with MO_ALIGN vs MO_UNALN.

Or, indeed, dropping the helper entirely and implementing the function inline -- this maxes out at 10 load/stores after all.


r~

Reply via email to