aboutsummaryrefslogtreecommitdiff
path: root/opcodes/ppc-opc.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-12-03 21:51:45 +1030
committerAlan Modra <amodra@gmail.com>2017-12-03 21:54:47 +1030
commitf143cb5fc655e1ed0a6e15e6ba33af0d79ba1802 (patch)
tree15cb9e71574bbe9aa1514e0fda01d5b6eaef4b6b /opcodes/ppc-opc.c
parentc0e15c9bfd6fb4bf36e5240838f6ebed1e1f4a7e (diff)
downloadgdb-f143cb5fc655e1ed0a6e15e6ba33af0d79ba1802.zip
gdb-f143cb5fc655e1ed0a6e15e6ba33af0d79ba1802.tar.gz
gdb-f143cb5fc655e1ed0a6e15e6ba33af0d79ba1802.tar.bz2
Fix "FAIL: VLE relocations 3"
Correct sign extension. * ppc-opc.c (extract_li20): Rewrite.
Diffstat (limited to 'opcodes/ppc-opc.c')
-rw-r--r--opcodes/ppc-opc.c10
1 files changed, 3 insertions, 7 deletions
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.