On 06/25/2017 12:21 PM, Laurent Vivier wrote:
+uint32_t HELPER(fmovem)(CPUM68KState *env, uint32_t addr, uint32_t ext)
+{
+    uintptr_t ra = GETPC();
+    int mode = (ext >> 11) & 0x3;
+    int is_load = ((ext & 0x2000) == 0);
+    uint16_t mask;
+    int incr, i;
+
+    if (m68k_feature(env, M68K_FEATURE_FPU)) {
+        incr = 12;
+    } else {
+        incr = 8;
+    }
+
+    if ((mode & 0x1) == 1) {
+        /* Dynamic register list */
+        int reg = extract32(ext, 4, 3);
+        mask = env->dregs[reg] & 0x00FF;
+    } else {
+        /* Static register list */
+        mask = ext & 0x00FF;
+    }
+
+    if (!is_load && (mode & 2) == 0) {

There's too much decoding being done in the helper.

I think it would be better to split this into 6 helpers:

  fmovem{d,x}_st_predec
  fmovem{d,x}_st_postdec
  fmovem{d,x}_ld_postdec

It should be easy to share code for these via inline functions.

Pass in the mask as an argument. This will either be a constant loaded via tcg_const_i32 or the zero-extended contents of the register.


r~

Reply via email to