qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/40] Add GEN_VXRFORM{, 1} macros for subsequen


From: Nathan Froyd
Subject: Re: [Qemu-devel] [PATCH 07/40] Add GEN_VXRFORM{, 1} macros for subsequent instructions.
Date: Wed, 7 Jan 2009 13:22:11 -0800
User-agent: Mutt/1.5.13 (2006-08-11)

On Sat, Jan 03, 2009 at 02:58:03PM +0100, Aurelien Jarno wrote:
> On Tue, Dec 30, 2008 at 07:09:49PM -0800, Nathan Froyd wrote:
> > +        if (opc3 & 0x1) {                                               \
> 
> This should be opc3 & (0x1 << 4).

I knew I would screw that up, thanks for catching it.

> > +            tcg_gen_mov_i32(cpu_crf[6], result);                        \
> > +        }                                                               \
> 
> By the way, given those functions are using helpers, it may be better to
> have one helper for normal functions and one helper for '.' functions
> which directly write env->crf[6]. It would probably be a bit faster.

I'm ambivalent on this; I think that executing vcmp* instructions
happens infrequently enough that it's probably not worth optimizing them
by computing/writing the result when the record bit is set.  But the
patch below (and subsequent incoming patch for the vcmp* instructions)
implements your suggestion.

-Nathan

Use separate helpers for recording and non-recording instructions.

Signed-off-by: Nathan Froyd <address@hidden>
---
 target-ppc/translate.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 03dac58..ee3c747 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -6359,6 +6359,27 @@ GEN_VXFORM(vsum4shs, 4, 25);
 GEN_VXFORM(vsum2sws, 4, 26);
 GEN_VXFORM(vsumsws, 4, 30);
 
+#define GEN_VXRFORM1(opname, name, str, opc2, opc3)                     \
+    GEN_HANDLER2(name, str, 0x4, opc2, opc3, 0x00000000, PPC_ALTIVEC)   \
+    {                                                                   \
+        TCGv_ptr ra, rb, rd;                                            \
+        if (unlikely(!ctx->altivec_enabled)) {                          \
+            gen_exception(ctx, POWERPC_EXCP_VPU);                       \
+            return;                                                     \
+        }                                                               \
+        ra = gen_avr_ptr(rA(ctx->opcode));                              \
+        rb = gen_avr_ptr(rB(ctx->opcode));                              \
+        rd = gen_avr_ptr(rD(ctx->opcode));                              \
+        gen_helper_##opname (rd, ra, rb);                               \
+        tcg_temp_free_ptr(ra);                                          \
+        tcg_temp_free_ptr(rb);                                          \
+        tcg_temp_free_ptr(rd);                                          \
+    }
+
+#define GEN_VXRFORM(name, opc2, opc3)                                \
+    GEN_VXRFORM1(name, name, #name, opc2, opc3)                      \
+    GEN_VXRFORM1(name##_dot, name##_, #name ".", opc2, (opc3 | (0x1 << 4)))
+
 #define GEN_VXFORM_NOA(name, opc2, opc3)                                \
     GEN_HANDLER(name, 0x04, opc2, opc3, 0x001f0000, PPC_ALTIVEC)        \
     {                                                                   \
-- 
1.6.0.5






reply via email to

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