From c12e2e4c48d7038b03aa1a1feedac39c41c27136 Mon Sep 17 00:00:00 2001
From: Gavin Romig-Koch <gavin@redhat.com>
Date: Fri, 25 Jul 1997 19:10:05 +0000
Subject: [PATCH] gencode.c: Two arg MADD should not assign result to
 /bin/bash.

---
 sim/mips/ChangeLog | 5 +++++
 sim/mips/gencode.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog
index d2b58937e33..d0575e70c23 100644
--- a/sim/mips/ChangeLog
+++ b/sim/mips/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jul 25 15:00:45 1997  Gavin Koch  <gavin@cygnus.com>
+ 
+ 	* gencode.c (build_instruction): Two arg MADD should
+ 	not assign result to $0.
+ 
 start-sanitize-r5900
 Thu Jul 10 11:58:48 1997  Andrew Cagney  <cagney@critters.cygnus.com>
 
diff --git a/sim/mips/gencode.c b/sim/mips/gencode.c
index 4f2044ad4d8..e264b0a4dc7 100644
--- a/sim/mips/gencode.c
+++ b/sim/mips/gencode.c
@@ -3320,8 +3320,9 @@ build_instruction (doisa, features, mips16, insn)
               prodtype, (notsigned ? "WORD64LO" : "SIGNEXTEND"), (notsigned ? "" : ",32"),
               prodtype, (notsigned ? "WORD64LO" : "SIGNEXTEND"), (notsigned ? "" : ",32")
               );
-       printf("GPR[destreg] = LO%s = SIGNEXTEND(prod,32);\n", pipeline );
+       printf("LO%s = SIGNEXTEND(prod,32);\n", pipeline );
        printf("HI%s = SIGNEXTEND( WORD64HI(prod), 32);\n", pipeline );
+       printf("if( destreg != 0 ) GPR[destreg] = LO%s;\n", pipeline );
        break;
      }