qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 4/5] (PPC) Fix Alpha target floating point


From: Alexander Graf
Subject: [Qemu-devel] [PATCH 4/5] (PPC) Fix Alpha target floating point
Date: Thu, 17 Jan 2008 07:42:57 +0100
User-agent: Thunderbird 2.0.0.9 (X11/20070801)

This fixes the Alpha target for PowerPC hosts. It is merely a part of
the original gcc4 patch posted by Michael Matz.
--- qemu-0.9.0.cvs/target-alpha/op_template.h.mm        2007-08-22 
03:17:57.000000000 +0000
+++ qemu-0.9.0.cvs/target-alpha/op_template.h   2007-08-22 03:15:49.000000000 
+0000
@@ -28,7 +28,26 @@ void OPPROTO glue(op_reset_T, REG) (void
 
 void OPPROTO glue(op_reset_FT, REG) (void)
 {
+#ifdef HOST_PPC
+    /* We have a problem with HOST_PPC here:
+       We want this code:
+         glue(FT, REG) = 0;
+       unfortunately GCC4 notices that this stores (double)0.0 into
+       env->ft0 and emits that constant into the .rodata, and instructions
+       to load that zero from there.  But that construct can't be parsed by 
dyngen.
+       We could add -ffast-math for compiling op.c, that would just make it 
generate
+       two stores of zeros into both words of ft0.  But -ffast-math may have 
other
+       side-effects regarding the emulation.  We could use __builtin_memset,
+       which perhaps would be the sanest.  That relies on -O2 and our other 
options
+       to inline that memset, which currently it does, but who knows for how 
long.
+       So, we simply do that by hand, and a barely typesafe way :-/  */
+    union baeh { double d; unsigned int i[2];};
+    union baeh *p = (union baeh*)&(glue(FT, REG));
+    p->i[0] = 0;
+    p->i[1] = 0;
+#else
     glue(FT, REG) = 0;
+#endif
     RETURN();
 }

reply via email to

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