Skip to contentSkip to conversation

M68k for 2.8 patches

GIT PULL Laurent Vivier 2 participants 10 messages Oct 31, 2016 – Nov 3, 2016

lore
Share & tools
lore
#0 lore raw

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

for you to fetch changes up to b3d2ee9b3a0a03394b0f4f7f8cf4fd018de969b8:

target-m68k: add 64bit mull (2016-10-31 10:35:26 +0100)

----------------------------------------------------------------
This two patches are extracted from my last series as they are already reviewed to make them available before the soft-freeze.
----------------------------------------------------------------

Laurent Vivier (2):
target-m68k: add cmpm
target-m68k: add 64bit mull

 target-m68k/translate.c | 88 ++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 76 insertions(+), 12 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

[Qemu-devel] [PULL 1/2] target-m68k: add cmpm

---
 target-m68k/translate.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
target-m68k/translate.c +28 -0
index ee0ffe3..92e67eb 100644
@@ -2173,6 +2173,33 @@ DISAS_INSN(cmpa)
     gen_update_cc_cmp(s, reg, src, opsize);
 }
 
+DISAS_INSN(cmpm)
+{
+    int opsize = insn_opsize(insn);
+    TCGv tmp = tcg_temp_new();
+    TCGv src, dst, addr;
+
+    src = gen_load(s, opsize, AREG(insn, 0), 1);
+    /* delay the update after the second gen_load() */
+    tcg_gen_addi_i32(tmp, AREG(insn, 0), opsize_bytes(opsize));
+
+    /* but if the we use the same address register to
+     * read the second value, we must use the updated address
+     */
+    if (REG(insn, 0) == REG(insn, 9)) {
+        addr = tmp;
+    } else {
+        addr = AREG(insn, 9);
+    }
+
+    dst = gen_load(s, opsize, addr, 1);
+    tcg_gen_mov_i32(AREG(insn, 0), tmp);
+    tcg_gen_addi_i32(AREG(insn, 9), addr, opsize_bytes(opsize));
+    tcg_temp_free(tmp);
+
+    gen_update_cc_cmp(s, dst, src, opsize);
+}
+
 DISAS_INSN(eor)
 {
     TCGv src;
@@ -3414,6 +3441,7 @@ void register_m68k_insns (CPUM68KState *env)
     INSN(cmpa,      b1c0, f1c0, CF_ISA_A);
     INSN(cmp,       b000, f100, M68000);
     INSN(eor,       b100, f100, M68000);
+    INSN(cmpm,      b108, f138, M68000);
     INSN(cmpa,      b0c0, f0c0, M68000);
     INSN(eor,       b180, f1c0, CF_ISA_A);
     BASE(and,       c000, f000);
Signature · 1 line
2.7.4
#2 lore raw

[Qemu-devel] [PULL 2/2] target-m68k: add 64bit mull

In reply to Laurent Vivier
---
 target-m68k/translate.c | 60 +++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 48 insertions(+), 12 deletions(-)
target-m68k/translate.c +48 -12
index 92e67eb..75d8c05 100644
@@ -1812,24 +1812,60 @@ DISAS_INSN(tas)
 DISAS_INSN(mull)
 {
     uint16_t ext;
-    TCGv reg;
     TCGv src1;
-    TCGv dest;
+    int sign;
 
-    /* The upper 32 bits of the product are discarded, so
-       muls.l and mulu.l are functionally equivalent.  */
     ext = read_im16(env, s);
-    if (ext & 0x87ff) {
-        gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);
+
+    sign = ext & 0x800;
+
+    if (ext & 0x400) {
+        if (!m68k_feature(s->env, M68K_FEATURE_QUAD_MULDIV)) {
+            gen_exception(s, s->pc - 4, EXCP_UNSUPPORTED);
+            return;
+        }
+
+        SRC_EA(env, src1, OS_LONG, 0, NULL);
+
+        if (sign) {
+            tcg_gen_muls2_i32(DREG(ext, 12), DREG(ext, 0), src1, DREG(ext, 12));
+        } else {
+            tcg_gen_mulu2_i32(DREG(ext, 12), DREG(ext, 0), src1, DREG(ext, 12));
+        }
+
+        tcg_gen_movi_i32(QREG_CC_V, 0);
+        tcg_gen_movi_i32(QREG_CC_C, 0);
+        tcg_gen_mov_i32(QREG_CC_N, DREG(ext, 0));
+        tcg_gen_or_i32(QREG_CC_Z, DREG(ext, 12), DREG(ext, 0));
+
+        set_cc_op(s, CC_OP_FLAGS);
         return;
     }
-    reg = DREG(ext, 12);
     SRC_EA(env, src1, OS_LONG, 0, NULL);
-    dest = tcg_temp_new();
-    tcg_gen_mul_i32(dest, src1, reg);
-    tcg_gen_mov_i32(reg, dest);
-    /* Unlike m68k, coldfire always clears the overflow bit.  */
-    gen_logic_cc(s, dest, OS_LONG);
+    if (m68k_feature(s->env, M68K_FEATURE_M68000)) {
+        tcg_gen_movi_i32(QREG_CC_C, 0);
+        if (sign) {
+            tcg_gen_muls2_i32(QREG_CC_N, QREG_CC_V, src1, DREG(ext, 12));
+            /* QREG_CC_V is -(QREG_CC_V != (QREG_CC_N >> 31)) */
+            tcg_gen_sari_i32(QREG_CC_Z, QREG_CC_N, 31);
+            tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, QREG_CC_Z);
+        } else {
+            tcg_gen_mulu2_i32(QREG_CC_N, QREG_CC_V, src1, DREG(ext, 12));
+            /* QREG_CC_V is -(QREG_CC_V != 0), use QREG_CC_C as 0 */
+            tcg_gen_setcond_i32(TCG_COND_NE, QREG_CC_V, QREG_CC_V, QREG_CC_C);
+        }
+        tcg_gen_neg_i32(QREG_CC_V, QREG_CC_V);
+        tcg_gen_mov_i32(DREG(ext, 12), QREG_CC_N);
+
+        tcg_gen_mov_i32(QREG_CC_Z, QREG_CC_N);
+
+        set_cc_op(s, CC_OP_FLAGS);
+    } else {
+        /* The upper 32 bits of the product are discarded, so
+           muls.l and mulu.l are functionally equivalent.  */
+        tcg_gen_mul_i32(DREG(ext, 12), src1, DREG(ext, 12));
+        gen_logic_cc(s, DREG(ext, 12), OS_LONG);
+    }
 }
 
 static void gen_link(DisasContext *s, uint16_t insn, int32_t offset)
Signature · 1 line
2.7.4
#3 lore raw
In reply to Laurent Vivier
Quoted 17 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

for you to fetch changes up to b3d2ee9b3a0a03394b0f4f7f8cf4fd018de969b8:

target-m68k: add 64bit mull (2016-10-31 10:35:26 +0100)

----------------------------------------------------------------
This two patches are extracted from my last series as they are already reviewed to make them available before the soft-freeze.
----------------------------------------------------------------

Quoted 7 lines

Laurent Vivier (2):
target-m68k: add cmpm
target-m68k: add 64bit mull

 target-m68k/translate.c | 88 ++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 76 insertions(+), 12 deletions(-)

Cancel this request, there are more comments on the 64bit mull patch.

Thanks,
Laurent

#4 lore raw
In reply to Laurent Vivier
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thanks,
Stefan

#5 lore raw
Quoted 9 lines · Stefan Hajnoczi
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

Quoted 8 lines

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thank you Stefan.

I'm using your tool "git-publish", is there a way to detect this problem automatically?

Laurent

#6 lore raw
Quoted 15 lines · Laurent Vivier
Quoted 14 lines · Stefan Hajnoczi
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

Quoted 8 lines
Quoted 3 lines

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thank you Stefan.

I'm using your tool "git-publish", is there a way to detect this problem automatically?

Right now git-publish doesn't check the generated URI. In some use cases it's reasonable to use an SSH URI so adding an error or even warning to git-publish isn't ideal.

I am modifying the patches tool (https://github.com/stefanha/patches)
to automatically translate GitHub URIs since they are so prevalent... This will allow me to apply pull requests that have GitHub SSH URIs.

Stefan

#7 lore raw
Quoted 25 lines · Stefan Hajnoczi
Quoted 15 lines · Laurent Vivier
Quoted 14 lines · Stefan Hajnoczi
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

Quoted 8 lines
Quoted 3 lines

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thank you Stefan.

I'm using your tool "git-publish", is there a way to detect this problem automatically?

Quoted 7 lines

Right now git-publish doesn't check the generated URI. In some use cases it's reasonable to use an SSH URI so adding an error or even warning to git-publish isn't ideal.

I am modifying the patches tool (https://github.com/stefanha/patches)
to automatically translate GitHub URIs since they are so prevalent... This will allow me to apply pull requests that have GitHub SSH URIs.

On second thought, even that isn't a general solution. If people are collaborating on private GitHub repos then translating URIs to HTTPS is not correct either.

Instead of trying to do magic I'll ask pull request submitters to fix their .gitconfig.

Stefan

#8 lore raw
Quoted 34 lines · Stefan Hajnoczi
Quoted 25 lines · Stefan Hajnoczi
Quoted 15 lines · Laurent Vivier
Quoted 14 lines · Stefan Hajnoczi
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

Quoted 8 lines
Quoted 3 lines

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thank you Stefan.

I'm using your tool "git-publish", is there a way to detect this problem automatically?

Quoted 7 lines

Right now git-publish doesn't check the generated URI. In some use cases it's reasonable to use an SSH URI so adding an error or even warning to git-publish isn't ideal.

I am modifying the patches tool (https://github.com/stefanha/patches)
to automatically translate GitHub URIs since they are so prevalent... This will allow me to apply pull requests that have GitHub SSH URIs.

Quoted 6 lines

On second thought, even that isn't a general solution. If people are collaborating on private GitHub repos then translating URIs to HTTPS is not correct either.

Instead of trying to do magic I'll ask pull request submitters to fix their .gitconfig.

Perhaps you can also update git-publish README.rst?

Thanks,
Laurent

#9 lore raw
Quoted 35 lines · Laurent Vivier
Quoted 34 lines · Stefan Hajnoczi
Quoted 32 lines · Stefan Hajnoczi
Quoted 15 lines · Laurent Vivier
Quoted 14 lines · Stefan Hajnoczi
Quoted 7 lines · Laurent Vivier

The following changes since commit 5b2ecabaeabc17f032197246c4846b9ba95ba8a6:

Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20161028-1' into staging (2016-10-28 17:59:04 +0100)

are available in the git repository at:

[email protected]:vivier/qemu-m68k.git tags/m68k-for-2.8-pull-request

This URI is not publicly accessible. Some tools will fail to apply your pull request because of this.

Please adjust your .gitconfig:

Quoted 8 lines
Quoted 3 lines

[remote "origin"]
url = git://github.com/vivier/qemu.git
pushurl = [email protected]:vivier/qemu.git

Thank you Stefan.

I'm using your tool "git-publish", is there a way to detect this problem automatically?

Right now git-publish doesn't check the generated URI. In some use cases it's reasonable to use an SSH URI so adding an error or even warning to git-publish isn't ideal.

I am modifying the patches tool (https://github.com/stefanha/patches)
to automatically translate GitHub URIs since they are so prevalent... This will allow me to apply pull requests that have GitHub SSH URIs.

Quoted 8 lines
Quoted 6 lines

On second thought, even that isn't a general solution. If people are collaborating on private GitHub repos then translating URIs to HTTPS is not correct either.

Instead of trying to do magic I'll ask pull request submitters to fix their .gitconfig.

Perhaps you can also update git-publish README.rst?

Good idea, I'll add info on how to set up separate url and pushurl fields.

Stefan