qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.5 12/30] m68k: Manage divw overflow


From: Richard Henderson
Subject: Re: [Qemu-devel] [PATCH for-2.5 12/30] m68k: Manage divw overflow
Date: Tue, 11 Aug 2015 23:03:35 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

On 08/09/2015 01:13 PM, Laurent Vivier wrote:
"Overflow may be detected and set before the instruction completes.
If the instruction detects an overflow, it sets the overflow condition
code, and the operands are unaffected."

May also implies may not. I presume this is important for matching hardware? Is there some program you know of that depends on this?

+    /* dest.l / src.w */
+
+    dest = DREG(insn, 9);
+    tcg_gen_mov_i32(QREG_DIV1, dest);
+
      SRC_EA(env, src, OS_WORD, sign, NULL);
      tcg_gen_mov_i32(QREG_DIV2, src);
+
+    /* div1 / div2 */
+
      if (sign) {
          gen_helper_divs(cpu_env, tcg_const_i32(1));
      } else {
          gen_helper_divu(cpu_env, tcg_const_i32(1));
      }

+    set_cc_op(s, CC_OP_FLAGS);
+
+    l1 = gen_new_label();
+    gen_jmpcc(s, 9 /* V */, l1);
      tmp = tcg_temp_new();
      src = tcg_temp_new();
      tcg_gen_ext16u_i32(tmp, QREG_DIV1);
      tcg_gen_shli_i32(src, QREG_DIV2, 16);
-    tcg_gen_or_i32(reg, tmp, src);
-    set_cc_op(s, CC_OP_FLAGS);
+    tcg_gen_or_i32(dest, tmp, src);
+    gen_set_label(l1);

All that said, it's possible to implement this branch inside the helper via exception. Or simply return the inputs to effect no change.


r~



reply via email to

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