aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2013-05-09 04:32:55 +0000
committerAlan Modra <amodra@gmail.com>2013-05-09 04:32:55 +0000
commit9f0682fe89d9bb1107239411dc555d4063543ce0 (patch)
treeb877e848ad529d45b1b3e7b0a0325743a6a771e6 /opcodes
parentda8094d7964e634fb0ec5632d36f9bd282f3170e (diff)
downloadgdb-9f0682fe89d9bb1107239411dc555d4063543ce0.zip
gdb-9f0682fe89d9bb1107239411dc555d4063543ce0.tar.gz
gdb-9f0682fe89d9bb1107239411dc555d4063543ce0.tar.bz2
* ppc-opc.c (extract_vlesi): Properly sign extend.
(extract_vlensi): Likewise. Comment reason for setting invalid.
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/ppc-opc.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 88f9294..e918abc 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-09 Alan Modra <amodra@gmail.com>
+
+ * ppc-opc.c (extract_vlesi): Properly sign extend.
+ (extract_vlensi): Likewise. Comment reason for setting invalid.
+
2013-05-02 Nick Clifton <nickc@redhat.com>
* msp430-dis.c: Add support for MSP430X instructions.
diff --git a/opcodes/ppc-opc.c b/opcodes/ppc-opc.c
index 80dfa24..62edf02 100644
--- a/opcodes/ppc-opc.c
+++ b/opcodes/ppc-opc.c
@@ -2022,11 +2022,8 @@ extract_vlesi (unsigned long insn,
ppc_cpu_t dialect ATTRIBUTE_UNUSED,
int *invalid ATTRIBUTE_UNUSED)
{
- /* RWRW Because I don't know how to make int be 16 and long be 32 */
- /* I can't rely on casting an int to long to get sign extension. */
long value = ((insn >> 10) & 0xf800) | (insn & 0x7ff);
- if (value & 0x8000)
- value |= 0xffff0000;
+ value = (value ^ 0x8000) - 0x8000;
return value;
}
@@ -2045,8 +2042,8 @@ extract_vlensi (unsigned long insn,
int *invalid ATTRIBUTE_UNUSED)
{
long value = ((insn >> 10) & 0xf800) | (insn & 0x7ff);
- if (value & 0x8000)
- value |= 0xffff0000;
+ value = (value ^ 0x8000) - 0x8000;
+ /* Don't use for disassembly. */
*invalid = 1;
return -value;
}