This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] [PowerPC] Use consistent types for holding insns, etc.
- From: Alan Modra <amodra at gmail dot com>
- To: Bill Schmidt <wschmidt at linux dot vnet dot ibm dot com>
- Cc: Peter Bergner <bergner at vnet dot ibm dot com>, binutils <binutils at sourceware dot org>
- Date: Sun, 3 Dec 2017 21:59:56 +1030
- Subject: Re: [PATCH] [PowerPC] Use consistent types for holding insns, etc.
- Authentication-results: sourceware.org; auth=none
- References: <4ceb5cec-a11e-3758-8458-003c821c58e5@vnet.ibm.com> <20171130233132.GI10905@bubble.grove.modra.org> <25c829af-20df-6924-cad3-da04c082b5bd@vnet.ibm.com> <021079D7-3CD2-4EDE-802B-D7A9F3D77663@linux.vnet.ibm.com>
On Fri, Dec 01, 2017 at 05:10:30PM -0600, Bill Schmidt wrote:
> On Dec 1, 2017, at 4:26 PM, Peter Bergner <bergner@vnet.ibm.com> wrote:
> > I know, but it never hurts to have another set of eyes on something
> > so bug. :-)
>
> Now *that's* a Freudian slip!
:-)
Correct sign extension. Fixes "FAIL: VLE relocations 3"
* ppc-opc.c (extract_li20): Rewrite.
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.
--
Alan Modra
Australia Development Lab, IBM