diff options
author | Claudiu Zissulescu <claziss@gmail.com> | 2018-07-23 11:09:43 +0200 |
---|---|---|
committer | Claudiu Zissulescu <claziss@gmail.com> | 2018-07-23 11:09:43 +0200 |
commit | 04e65276fa99a0de996142b054bb76f8491ae103 (patch) | |
tree | 96c49386157449d8e235a4e271b23a74202bf19d /opcodes/arc-opc.c | |
parent | 47e6f81c7c269ab5ef2b3004bb5ebe0de5cfb969 (diff) | |
download | gdb-04e65276fa99a0de996142b054bb76f8491ae103.zip gdb-04e65276fa99a0de996142b054bb76f8491ae103.tar.gz gdb-04e65276fa99a0de996142b054bb76f8491ae103.tar.bz2 |
[ARC] Fix decoding of w6 signed short immediate.
gas/
Claudiu Zissulescu <claziss@synopsys.com>
* testsuite/gas/arc/st.d: Fix test.
opcodes/
Claudiu Zissulescu <claziss@synopsys.com>
* arc-opc.c (extract_w6): Fix extending the sign.
Diffstat (limited to 'opcodes/arc-opc.c')
-rw-r--r-- | opcodes/arc-opc.c | 6 |
1 files changed, 5 insertions, 1 deletions
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; } |