qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 7/7] target/m68k: add fmovem


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH 7/7] target/m68k: add fmovem
Date: Mon, 26 Jun 2017 11:40:10 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

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

[Prev in Thread] Current Thread [Next in Thread]