[NIOS2] Fix disassembly of br.n instruction.

The code was checking wrong bit for sign extension. It caused it
to zero-extend instead of sign-extend the immediate value.

2021-03-25  Abid Qadeer  <abidh@codesourcery.com>

	opcodes/
	* nios2-dis.c (nios2_print_insn_arg): Fix sign extension of
	immediate in br.n instruction.

	gas/
	* testsuite/gas/nios2/brn.s: New.
	* testsuite/gas/nios2/brn.d: New.
This commit is contained in:
Hafiz Abid Qadeer
2021-03-24 21:24:35 +00:00
parent 5e74b4959b
commit efa30ac3c5
5 changed files with 25 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
2021-03-25 Abid Qadeer <abidh@codesourcery.com>
* nios2-dis.c (nios2_print_insn_arg): Fix sign extension of
immediate in br.n instruction.
2021-03-25 Jan Beulich <jbeulich@suse.com>
* i386-dis.c (XMGatherD, VexGatherD): New.

View File

@@ -694,7 +694,7 @@ nios2_print_insn_arg (const char *argptr,
switch (op->format)
{
case iw_I10_type:
o = (((GET_IW_I10_IMM10 (opcode) & 0x3ff) ^ 0x400) - 0x400) * 2;
o = (((GET_IW_I10_IMM10 (opcode) & 0x3ff) ^ 0x200) - 0x200) * 2;
break;
default:
bad_opcode (op);