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.
+2021-03-25  Abid Qadeer  <abidh@codesourcery.com>
+
+       * testsuite/gas/nios2/brn.d: New.
+       * testsuite/gas/nios2/brn.d: New.
+
 2021-03-25  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386.c (match_template): Use t instead of i.tm.
 
--- /dev/null
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 br.n
+#as: -march=r2
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c4000020        nop
+0+0004 <[^>]*> ff43            br.n    00000000 <foo>
+       ...
 
--- /dev/null
+# Source file used to test the br.n instructions
+foo:
+       nop
+       br.n foo
 
+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.
 
       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);