Powerpc VLE operand extract
Alan Modra
amodra@gmail.com
Thu May 9 04:32:00 GMT 2013
Fixes a couple of occurrences of 64-bit unclean code.
* ppc-opc.c (extract_vlesi): Properly sign extend.
(extract_vlensi): Likewise. Comment reason for setting invalid.
Index: opcodes/ppc-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/ppc-opc.c,v
retrieving revision 1.158
diff -u -p -r1.158 ppc-opc.c
--- opcodes/ppc-opc.c 11 Jan 2013 02:25:36 -0000 1.158
+++ opcodes/ppc-opc.c 9 May 2013 03:50:10 -0000
@@ -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;
}
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list