From: Tom Marn <tom.marn@telargo.com>
To: tom.marn@telargo.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] PATCH stfiwx implementation
Date: Wed, 11 Oct 2006 10:05:55 +0200 [thread overview]
Message-ID: <452CA5E3.5040909@telargo.com> (raw)
In-Reply-To: <452B639A.3090304@telargo.com>
[-- Attachment #1: Type: text/plain, Size: 114 bytes --]
Hi
Resending fixed patch, mirror fix in glue(stfi, MEMSUFFIX) function; bitwise typo: && instead of &.
Tom Marn
[-- Attachment #2: stfiwx_cast.patch --]
[-- Type: text/x-patch, Size: 3582 bytes --]
Patch which appends optional "stfiwx" PowerPC instruction into QEMU.
Mirror fix of patch: 2006-10-11 : bitwise typo && instead &
Tom Marn
--- target-ppc/translate.c.orig 2006-10-11 09:05:17.000000000 +0200
+++ target-ppc/translate.c 2006-10-11 09:56:02.000000000 +0200
@@ -1716,14 +1716,29 @@ GEN_STFS(fs, 0x14);
/* Optional: */
/* stfiwx */
-GEN_HANDLER(stfiwx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT)
-{
- if (!ctx->fpu_enabled) {
- RET_EXCP(ctx, EXCP_NO_FP, 0);
- return;
- }
- RET_INVAL(ctx);
-}
+#define GEN_STWXF(width) \
+GEN_HANDLER(st##width##wx, 0x1F, 0x17, 0x1E, 0x00000001, PPC_FLOAT) \
+{ \
+ if (!ctx->fpu_enabled) { \
+ RET_EXCP(ctx, EXCP_NO_FP, 0); \
+ return; \
+ } \
+ if (rA(ctx->opcode) == 0) { \
+ gen_op_load_gpr_T0(rB(ctx->opcode)); \
+ } else { \
+ gen_op_load_gpr_T0(rA(ctx->opcode)); \
+ gen_op_load_gpr_T1(rB(ctx->opcode)); \
+ gen_op_add(); \
+ } \
+ gen_op_load_fpr_FT1(rS(ctx->opcode)); \
+ op_ldst(st##width); \
+}
+
+#define GEN_STFI(width) \
+OP_ST_TABLE(width); \
+GEN_STWXF(width);
+
+GEN_STFI(fi);
/*** Branch ***/
--- target-ppc/op_mem.h.orig 2006-10-11 09:05:28.000000000 +0200
+++ target-ppc/op_mem.h 2006-10-11 09:52:28.000000000 +0200
@@ -187,6 +187,30 @@ PPC_OP(glue(glue(st, name), MEMSUFFIX))
PPC_STF_OP(fd, stfq);
PPC_STF_OP(fs, stfl);
+
+static inline void glue(stfi, MEMSUFFIX) (target_ulong EA, float f)
+{
+ union {
+ float f;
+ uint32_t u;
+ } u;
+
+ u.f = f;
+ u.u = u.u & 0x00000000FFFFFFFFULL;
+ glue(stl, MEMSUFFIX)(T0, u.f);
+ RETURN();
+}
+
+#if 0
+static inline void glue(stfi, MEMSUFFIX) (target_ulong EA, float f)
+{
+ glue(stl, MEMSUFFIX)(T0,(int)f);
+ RETURN();
+}
+#endif
+
+PPC_STF_OP(fi, stfi);
+
static inline void glue(stfqr, MEMSUFFIX) (target_ulong EA, double d)
{
union {
@@ -224,6 +248,23 @@ static inline void glue(stflr, MEMSUFFIX
PPC_STF_OP(fd_le, stfqr);
PPC_STF_OP(fs_le, stflr);
+static inline void glue(stfir, MEMSUFFIX) (target_ulong EA, float f)
+{
+ union {
+ float f;
+ uint32_t u;
+ } u;
+
+ u.f = f;
+ u.u = ((u.u & 0xFF000000UL) >> 24) |
+ ((u.u & 0x00FF0000ULL) >> 8) |
+ ((u.u & 0x0000FF00UL) << 8) |
+ ((u.u & 0x000000FFULL) << 24);
+ glue(stfi, MEMSUFFIX)(EA, u.f);
+}
+
+PPC_STF_OP(fi_le, stfir);
+
/*** Floating-point load ***/
#define PPC_LDF_OP(name, op) \
PPC_OP(glue(glue(l, name), MEMSUFFIX)) \
next prev parent reply other threads:[~2006-10-11 8:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-10 9:10 [Qemu-devel] PATCH stfiwx implementation Tom Marn
2006-10-11 8:05 ` Tom Marn [this message]
2006-10-16 8:23 ` [Qemu-devel] PATCH stfiwx implementation - Problem with casting Tom Marn
2006-10-16 19:58 ` André Braga
2006-10-17 7:52 ` Tom Marn
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=452CA5E3.5040909@telargo.com \
--to=tom.marn@telargo.com \
--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).