Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mips/mips gcc/gas also emits "or ...,zero" as well ...



details:   https://anonhg.NetBSD.org/src/rev/35883674914f
branches:  trunk
changeset: 960986:35883674914f
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Apr 05 06:38:01 2021 +0000

description:
gcc/gas also emits "or ...,zero" as well as "addu/daddu ...,zero" for a
"move" pseudo instruction.  Disassemble the "or" case as a "move" too.

diffstat:

 sys/arch/mips/mips/db_disasm.c |  19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diffs (44 lines):

diff -r d75835cabb7d -r 35883674914f sys/arch/mips/mips/db_disasm.c
--- a/sys/arch/mips/mips/db_disasm.c    Mon Apr 05 06:35:04 2021 +0000
+++ b/sys/arch/mips/mips/db_disasm.c    Mon Apr 05 06:38:01 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $    */
+/*     $NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $    */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.36 2021/04/05 06:35:04 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.37 2021/04/05 06:38:01 simonb Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -277,16 +277,19 @@
                        db_printf("ehb");
                        break;
                }
-               /* XXX
-                * "addu" is a "move" only in 32-bit mode.  What's the correct
-                * answer - never decode addu/daddu as "move"?
+               /*
+                * The following are equivalents of a "move dst,src":
+                *      addu    dst,src,zero    (in 32-bit mode)
+                *      daddu   dst,src,zero    (in 64-bit mode)
+                *      or      dst,src,zero    (in 32- and 64-bit modes)
                 */
-               if (true
 #ifdef __mips_o32
-                   && i.RType.func == OP_ADDU
+#define        OP_MOVE_ADDU    OP_ADDU
 #else
-                   && i.RType.func == OP_DADDU
+#define        OP_MOVE_ADDU    OP_DADDU
 #endif
+               if (true &&
+                   ((i.RType.func == OP_OR) || (i.RType.func == OP_MOVE_ADDU))
                    && i.RType.rt == 0) {
                        db_printf("move\t%s,%s",
                            reg_name[i.RType.rd],



Home | Main Index | Thread Index | Old Index