Patchwork [11/13] alpha: Fix FMOV.

login
register
mail settings
Submitter Richard Henderson
Date Dec. 11, 2009, 9:21 p.m.
Message ID <cb8fe4f052091dc751f79f584eb90bcdb6b5beca.1260580414.git.rth@twiddle.net>
Download mbox | patch
Permalink /patch/40938/
State New
Headers show

Comments

Richard Henderson - Dec. 11, 2009, 9:21 p.m.
Properly handle move from the zero register.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 target-alpha/translate.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

Patch

diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index d361ffe..3773ab4 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -1834,12 +1834,16 @@  static inline int translate_one(DisasContext *ctx, uint32_t insn)
             break;
         case 0x020:
             if (likely(rc != 31)) {
-                if (ra == rb)
+                if (ra == rb) {
                     /* FMOV */
-                    tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]);
-                else
+                    if (ra == 31)
+                        tcg_gen_movi_i64(cpu_fir[rc], 0);
+                    else
+                        tcg_gen_mov_i64(cpu_fir[rc], cpu_fir[ra]);
+                } else {
                     /* CPYS */
                     gen_fcpys(ra, rb, rc);
+                }
             }
             break;
         case 0x021: