This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Fix "FAIL: VLE relocations 3"
- From: Alan Modra <amodra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 3 Dec 2017 11:30:36 -0000
- Subject: [binutils-gdb] Fix "FAIL: VLE relocations 3"
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f143cb5fc655e1ed0a6e15e6ba33af0d79ba1802
commit f143cb5fc655e1ed0a6e15e6ba33af0d79ba1802
Author: Alan Modra <amodra@gmail.com>
Date: Sun Dec 3 21:51:45 2017 +1030
Fix "FAIL: VLE relocations 3"
Correct sign extension.
* ppc-opc.c (extract_li20): Rewrite.
Diff:
---
opcodes/ChangeLog | 4 ++++
opcodes/ppc-opc.c | 10 +++-------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 746e368..10d9e63 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-03 Alan Modra <amodra@gmail.com>
+
+ * ppc-opc.c (extract_li20): Rewrite.
+
2017-12-01 Peter Bergner <bergner@vnet.ibm.com>
* opcodes/ppc-dis.c (disassemble_init_powerpc): Fix white space.
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 81335c6..ad26c4f 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -571,13 +571,9 @@ extract_li20 (uint64_t insn,
ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED)
{
- int64_t ext = ((insn & 0x4000) == 0x4000) ? 0xfff00000 : 0x00000000;
-
- return (ext
- | (((insn >> 11) & 0xf) << 16)
- | (((insn >> 17) & 0xf) << 12)
- | (((insn >> 16) & 0x1) << 11)
- | (insn & 0x7ff));
+ return ((((insn << 5) & 0xf0000)
+ | ((insn >> 5) & 0xf800)
+ | (insn & 0x7ff)) ^ 0x80000) - 0x80000;
}
/* The 2-bit L field in a SYNC or WC field in a WAIT instruction.