From 04e65276fa99a0de996142b054bb76f8491ae103 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 23 Jul 2018 11:09:43 +0200 Subject: [ARC] Fix decoding of w6 signed short immediate. gas/ Claudiu Zissulescu * testsuite/gas/arc/st.d: Fix test. opcodes/ Claudiu Zissulescu * arc-opc.c (extract_w6): Fix extending the sign. --- opcodes/arc-opc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'opcodes/arc-opc.c') diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c index 5349e13..b87a231 100644 --- a/opcodes/arc-opc.c +++ b/opcodes/arc-opc.c @@ -651,10 +651,14 @@ static long long extract_w6 (unsigned long long insn, bfd_boolean * invalid ATTRIBUTE_UNUSED) { - unsigned value = 0; + int value = 0; value |= ((insn >> 6) & 0x003f) << 0; + /* Extend the sign. */ + int signbit = 1 << 5; + value = (value ^ signbit) - signbit; + return value; } -- cgit v1.1