qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>,
	Aurelien Jarno <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH 05/10] target-ppc: emulate prtyw and prtyd instructions
Date: Sat, 13 Apr 2013 14:47:26 +0200	[thread overview]
Message-ID: <1365857251-28173-6-git-send-email-aurelien@aurel32.net> (raw)
In-Reply-To: <1365857251-28173-1-git-send-email-aurelien@aurel32.net>

Needed for Power ISA version 2.05 compliance.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
---
 target-ppc/translate.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 80b7111..1286ad2 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -1458,6 +1458,42 @@ static void gen_popcntd(DisasContext *ctx)
 }
 #endif
 
+/* prtyw: PowerPC 2.05 specification */
+static void gen_prtyw(DisasContext *ctx)
+{
+    TCGv ra = cpu_gpr[rA(ctx->opcode)];
+    TCGv rs = cpu_gpr[rS(ctx->opcode)];
+    TCGv t0 = tcg_temp_new();
+    tcg_gen_shri_tl(t0, rs, 16);
+    tcg_gen_xor_tl(ra, rs, t0);
+    tcg_gen_shri_tl(t0, ra, 8);
+    tcg_gen_xor_tl(ra, ra, t0);
+#if defined(TARGET_PPC64)
+    tcg_gen_andi_tl(ra, ra, 0x100000001);
+#else
+    tcg_gen_andi_tl(ra, ra, 1);
+#endif
+    tcg_temp_free(t0);
+}
+
+#if defined(TARGET_PPC64)
+/* prtyd: PowerPC 2.05 specification */
+static void gen_prtyd(DisasContext *ctx)
+{
+    TCGv ra = cpu_gpr[rA(ctx->opcode)];
+    TCGv rs = cpu_gpr[rS(ctx->opcode)];
+    TCGv t0 = tcg_temp_new();
+    tcg_gen_shri_tl(t0, rs, 32);
+    tcg_gen_xor_tl(ra, rs, t0);
+    tcg_gen_shri_tl(t0, ra, 16);
+    tcg_gen_xor_tl(ra, ra, t0);
+    tcg_gen_shri_tl(t0, ra, 8);
+    tcg_gen_xor_tl(ra, ra, t0);
+    tcg_gen_andi_tl(ra, ra, 1);
+    tcg_temp_free(t0);
+}
+#endif
+
 #if defined(TARGET_PPC64)
 /* extsw & extsw. */
 GEN_LOGICAL1(extsw, tcg_gen_ext32s_tl, 0x1E, PPC_64B);
@@ -8489,9 +8525,11 @@ GEN_HANDLER(xori, 0x1A, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
 GEN_HANDLER(xoris, 0x1B, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
 GEN_HANDLER(popcntb, 0x1F, 0x03, 0x03, 0x0000F801, PPC_POPCNTB),
 GEN_HANDLER(popcntw, 0x1F, 0x1A, 0x0b, 0x0000F801, PPC_POPCNTWD),
+GEN_HANDLER_E(prtyw, 0x1F, 0x1A, 0x04, 0x0000F801, PPC_NONE, PPC2_ISA205),
 #if defined(TARGET_PPC64)
 GEN_HANDLER(popcntd, 0x1F, 0x1A, 0x0F, 0x0000F801, PPC_POPCNTWD),
 GEN_HANDLER(cntlzd, 0x1F, 0x1A, 0x01, 0x00000000, PPC_64B),
+GEN_HANDLER_E(prtyd, 0x1F, 0x1A, 0x05, 0x0000F801, PPC_NONE, PPC2_ISA205),
 #endif
 GEN_HANDLER(rlwimi, 0x14, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
 GEN_HANDLER(rlwinm, 0x15, 0xFF, 0xFF, 0x00000000, PPC_INTEGER),
-- 
1.7.10.4

  parent reply	other threads:[~2013-04-13 12:47 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-13 12:47 [Qemu-devel] [PATCH 00/10] target-ppc: emulate Power ISA 2.05 instructions Aurelien Jarno
2013-04-13 12:47 ` [Qemu-devel] [PATCH 01/10] target-ppc: optimize fabs, fnabs, fneg Aurelien Jarno
2013-04-13 13:20   ` Peter Maydell
2013-04-15  6:16     ` Aurelien Jarno
2013-04-13 12:47 ` [Qemu-devel] [PATCH 02/10] disas: Disassemble all ppc insns for the guest Aurelien Jarno
2013-04-17 14:15   ` Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 03/10] target-ppc: add instruction flags for Book I 2.05 Aurelien Jarno
2013-04-17 14:16   ` Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 04/10] target-ppc: emulate cmpb instruction Aurelien Jarno
2013-04-17 14:17   ` Richard Henderson
2013-04-13 12:47 ` Aurelien Jarno [this message]
2013-04-17 14:19   ` [Qemu-devel] [PATCH 05/10] target-ppc: emulate prtyw and prtyd instructions Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 06/10] target-ppc: emulate fcpsgn instruction Aurelien Jarno
2013-04-17 14:21   ` Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 07/10] target-ppc: emulate lfiwax instruction Aurelien Jarno
2013-04-17 14:22   ` Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 08/10] target-ppc: emulate load doubleword pair instructions Aurelien Jarno
2013-04-17 14:25   ` Richard Henderson
2013-04-13 12:47 ` [Qemu-devel] [PATCH 09/10] target-ppc: emulate store " Aurelien Jarno
2013-04-17 14:26   ` Richard Henderson
2013-04-19 18:54     ` Aurelien Jarno
2013-04-13 12:47 ` [Qemu-devel] [PATCH 10/10] target-ppc: add support for extended mtfsf/mtfsfi forms Aurelien Jarno
2013-04-19 15:35 ` [Qemu-devel] [PATCH 00/10] target-ppc: emulate Power ISA 2.05 instructions Alexander Graf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365857251-28173-6-git-send-email-aurelien@aurel32.net \
    --to=aurelien@aurel32.net \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).