public inbox for gdb-testers@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] tic4x: sign extension using shifts
@ 2020-01-13  4:04 gdb-buildbot
  2020-01-13  3:58 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: gdb-buildbot @ 2020-01-13  4:04 UTC (permalink / raw)
  To: gdb-testers

*** TEST RESULTS FOR COMMIT 5496abe1c5c31aa6648e8fdb15e4122025bcabfe ***

commit 5496abe1c5c31aa6648e8fdb15e4122025bcabfe
Author:     Alan Modra <amodra@gmail.com>
AuthorDate: Sun Jan 12 20:16:22 2020 +1030
Commit:     Alan Modra <amodra@gmail.com>
CommitDate: Mon Jan 13 12:12:05 2020 +1030

    tic4x: sign extension using shifts
    
    Don't do that.  Especially don't use shift counts that assume the type
    being shifted is 32 bits when the type is long/unsigned long.  Also
    reverts part of a change I made on 2019-12-11 to tic4x_print_register
    that on closer inspection turns out to be unnecessary.
    
    include/
            * opcode/tic4x.h (EXTR): Delete.
            (EXTRU, EXTRS, INSERTU, INSERTS): Rewrite without zero/sign
            extension using shifts.  Do trim INSERTU value to specified bitfield.
    opcodes/
            * tic4x-dis.c (tic4x_print_register): Remove dead code.
    gas/
            * config/tc-tic4x.c (tic4x_operands_match): Correct tic3x trap
            insertion.

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 245bd74363..4186fbd05e 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-13  Alan Modra  <amodra@gmail.com>
+
+	* config/tc-tic4x.c (tic4x_operands_match): Correct tic3x trap
+	insertion.
+
 2020-01-10  Alan Modra  <amodra@gmail.com>
 
 	* testsuite/gas/elf/pr14891.s: Don't start directives in first column.
diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c
index 913120d9ab..cc477b62bb 100644
--- a/gas/config/tc-tic4x.c
+++ b/gas/config/tc-tic4x.c
@@ -2193,7 +2193,7 @@ tic4x_operands_match (tic4x_inst_t *inst, tic4x_insn_t *tinsn, int check)
 		}
 	      else if (exp->X_add_number < 32 && IS_CPU_TIC3X (tic4x_cpu))
 		{
-		  INSERTU (opcode, exp->X_add_number | 0x20, 4, 0);
+		  INSERTU (opcode, exp->X_add_number | 0x20, 5, 0);
 		  continue;
 		}
 	      else
diff --git a/include/ChangeLog b/include/ChangeLog
index 91765c5be6..3e2cdcaeb4 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-13  Alan Modra  <amodra@gmail.com>
+
+	* opcode/tic4x.h (EXTR): Delete.
+	(EXTRU, EXTRS, INSERTU, INSERTS): Rewrite without zero/sign
+	extension using shifts.  Do trim INSERTU value to specified bitfield.
+
 2020-01-10  Alan Modra  <amodra@gmail.com>
 
 	* opcode/spu.h: Formatting.
diff --git a/include/opcode/tic4x.h b/include/opcode/tic4x.h
index 66b4ebfd08..04e3f0853d 100644
--- a/include/opcode/tic4x.h
+++ b/include/opcode/tic4x.h
@@ -23,11 +23,13 @@
 #define IS_CPU_TIC4X(v) ((v) ==  0 || (v) == 40 || (v) == 44)
 
 /* Define some bitfield extraction/insertion macros.  */
-#define EXTR(inst, m, l)          ((inst) << (31 - (m)) >> (31 - ((m) - (l)))) 
-#define EXTRU(inst, m, l)         EXTR ((unsigned long)(inst), (m), (l))
-#define EXTRS(inst, m, l)         EXTR ((long)(inst), (m), (l))
-#define INSERTU(inst, val, m, l)  (inst |= ((val) << (l))) 
-#define INSERTS(inst, val, m, l)  INSERTU (inst, ((val) & ((1 << ((m) - (l) + 1)) - 1)), m, l)
+#define EXTRU(inst, m, l) \
+  (((inst) >> (l)) & ((2u << ((m) - (l))) - 1))
+#define EXTRS(inst, m, l) \
+  ((int) ((EXTRU (inst, m, l) ^ (1u << ((m) - (l)))) - (1u << ((m) - (l)))))
+#define INSERTU(inst, val, m, l) \
+  ((inst) |= ((val) & ((2u << ((m) - (l))) - 1)) << (l))
+#define INSERTS INSERTU
 
 /* Define register numbers.  */
 typedef enum
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index feeb7c5535..26d1e6c4a2 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-13  Alan Modra  <amodra@gmail.com>
+
+	* tic4x-dis.c (tic4x_print_register): Remove dead code.
+
 2020-01-13  Alan Modra  <amodra@gmail.com>
 
 	* fr30-ibld.c: Regenerate.
diff --git a/opcodes/tic4x-dis.c b/opcodes/tic4x-dis.c
index 1d7946918b..34e270b713 100644
--- a/opcodes/tic4x-dis.c
+++ b/opcodes/tic4x-dis.c
@@ -148,8 +148,7 @@ tic4x_print_register (struct disassemble_info *info, unsigned long regno)
 	      = (tic4x_register_t *)(tic4x_registers + i);
 	}
     }
-  if (regno > (IS_CPU_TIC4X (tic4x_version) ? TIC4X_REG_MAX : TIC3X_REG_MAX)
-      || registertable[regno] == NULL)
+  if (regno > (IS_CPU_TIC4X (tic4x_version) ? TIC4X_REG_MAX : TIC3X_REG_MAX))
     return 0;
   if (info != NULL)
     (*info->fprintf_func) (info->stream, "%s", registertable[regno]->name);


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-14 21:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-13  4:04 [binutils-gdb] tic4x: sign extension using shifts gdb-buildbot
2020-01-13  3:58 ` Failures on Ubuntu-Aarch64-m64, branch master gdb-buildbot
2020-01-14 20:40 ` Failures on Fedora-i686, " gdb-buildbot
2020-01-14 20:44 ` Failures on Fedora-x86_64-cc-with-index, " gdb-buildbot
2020-01-14 20:45 ` Failures on Fedora-x86_64-m32, " gdb-buildbot
2020-01-14 20:45 ` Failures on Fedora-x86_64-m64, " gdb-buildbot
2020-01-14 21:15 ` Failures on Fedora-x86_64-native-extended-gdbserver-m32, " gdb-buildbot
2020-01-14 21:27 ` Failures on Fedora-x86_64-native-extended-gdbserver-m64, " gdb-buildbot
2020-01-14 21:35 ` Failures on Fedora-x86_64-native-gdbserver-m32, " gdb-buildbot
2020-01-14 22:02 ` Failures on Fedora-x86_64-native-gdbserver-m64, " gdb-buildbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).