qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5119] SH4: Convert shift functions to TCG
Date: Sat, 30 Aug 2008 22:37:17 +0000	[thread overview]
Message-ID: <E1KZZ4H-0005UL-D9@cvs.savannah.gnu.org> (raw)

Revision: 5119
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5119
Author:   aurel32
Date:     2008-08-30 22:37:17 +0000 (Sat, 30 Aug 2008)

Log Message:
-----------
SH4: Convert shift functions to TCG

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

Modified Paths:
--------------
    trunk/target-sh4/op.c
    trunk/target-sh4/translate.c

Modified: trunk/target-sh4/op.c
===================================================================
--- trunk/target-sh4/op.c	2008-08-30 22:07:52 UTC (rev 5118)
+++ trunk/target-sh4/op.c	2008-08-30 22:37:17 UTC (rev 5119)
@@ -115,27 +115,6 @@
     RETURN();
 }
 
-void OPPROTO op_shal_Rn(void)
-{
-    cond_t(env->gregs[PARAM1] & 0x80000000);
-    env->gregs[PARAM1] <<= 1;
-    RETURN();
-}
-
-void OPPROTO op_shar_Rn(void)
-{
-    cond_t(env->gregs[PARAM1] & 1);
-    *(int32_t *)&env->gregs[PARAM1] >>= 1;
-    RETURN();
-}
-
-void OPPROTO op_shlr_Rn(void)
-{
-    cond_t(env->gregs[PARAM1] & 1);
-    env->gregs[PARAM1] >>= 1;
-    RETURN();
-}
-
 void OPPROTO op_fmov_frN_FT0(void)
 {
     FT0 = env->fregs[PARAM1];

Modified: trunk/target-sh4/translate.c
===================================================================
--- trunk/target-sh4/translate.c	2008-08-30 22:07:52 UTC (rev 5118)
+++ trunk/target-sh4/translate.c	2008-08-30 22:37:17 UTC (rev 5119)
@@ -1226,13 +1226,19 @@
 	return;
     case 0x4000:		/* shll Rn */
     case 0x4020:		/* shal Rn */
-	gen_op_shal_Rn(REG(B11_8));
+	tcg_gen_andi_i32(cpu_T[0], cpu_gregs[REG(B11_8)], 0x80000000);
+	gen_cmp_imm(TCG_COND_NE, cpu_T[0], 0);
+	tcg_gen_shli_i32(cpu_gregs[REG(B11_8)], cpu_gregs[REG(B11_8)], 1);
 	return;
     case 0x4021:		/* shar Rn */
-	gen_op_shar_Rn(REG(B11_8));
+	tcg_gen_andi_i32(cpu_T[0], cpu_gregs[REG(B11_8)], 1);
+	gen_cmp_imm(TCG_COND_NE, cpu_T[0], 0);
+	tcg_gen_sari_i32(cpu_gregs[REG(B11_8)], cpu_gregs[REG(B11_8)], 1);
 	return;
     case 0x4001:		/* shlr Rn */
-	gen_op_shlr_Rn(REG(B11_8));
+	tcg_gen_andi_i32(cpu_T[0], cpu_gregs[REG(B11_8)], 1);
+	gen_cmp_imm(TCG_COND_NE, cpu_T[0], 0);
+	tcg_gen_shri_i32(cpu_gregs[REG(B11_8)], cpu_gregs[REG(B11_8)], 1);
 	return;
     case 0x4008:		/* shll2 Rn */
 	tcg_gen_shli_i32(cpu_gregs[REG(B11_8)], cpu_gregs[REG(B11_8)], 2);

                 reply	other threads:[~2008-08-30 22:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1KZZ4H-0005UL-D9@cvs.savannah.gnu.org \
    --to=aurelien@aurel32.net \
    --cc=qemu-devel@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).