This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] Assembler tests for Nios II R2
- From: Sandra Loosemore <sandra at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 1 Jul 2015 23:13:24 -0000
- Subject: [binutils-gdb] Assembler tests for Nios II R2
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0cb5a38a5be39be9e18a1090418d3be97d6b8678
commit 0cb5a38a5be39be9e18a1090418d3be97d6b8678
Author: Sandra Loosemore <sandra@codesourcery.com>
Date: Wed Jul 1 16:11:47 2015 -0700
Assembler tests for Nios II R2
2015-07-01 Sandra Loosemore <sandra@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
gas/testsuite/
* gas/nios2/add-r2.d: New.
* gas/nios2/align_fill-r2.d: New.
* gas/nios2/align_text-r2.d: New.
* gas/nios2/aligned_text-r2.d: New.
* gas/nios2/and-r2.d: New.
* gas/nios2/andc.d: New.
* gas/nios2/andc.s: New.
* gas/nios2/bmx.d: New.
* gas/nios2/bmx.s: New.
* gas/nios2/branch-r2.d: New.
* gas/nios2/break-r2.d: New.
* gas/nios2/bret-r2.d: New.
* gas/nios2/cache-r2.d: New.
* gas/nios2/cache-r2.s: New.
* gas/nios2/call-r2.d: New.
* gas/nios2/call26-r2.d: New.
* gas/nios2/call26_noat-r2.d: New.
* gas/nios2/call_noat-r2.d: New.
* gas/nios2/cdx_add.d: New.
* gas/nios2/cdx_add.s: New.
* gas/nios2/cdx_and.d: New.
* gas/nios2/cdx_and.s: New.
* gas/nios2/cdx_break.d: New.
* gas/nios2/cdx_break.s: New.
* gas/nios2/cdx_callr.d: New.
* gas/nios2/cdx_callr.s: New.
* gas/nios2/cdx_jmpr.d: New.
* gas/nios2/cdx_jmpr.s: New.
* gas/nios2/cdx_ldbu.d: New.
* gas/nios2/cdx_ldbu.s: New.
* gas/nios2/cdx_ldhu.d: New.
* gas/nios2/cdx_ldhu.s: New.
* gas/nios2/cdx_ldw.d: New.
* gas/nios2/cdx_ldw.s: New.
* gas/nios2/cdx_ldwsp.d: New.
* gas/nios2/cdx_ldwsp.s: New.
* gas/nios2/cdx_mov.d: New.
* gas/nios2/cdx_mov.s: New.
* gas/nios2/cdx_neg.d: New.
* gas/nios2/cdx_neg.s: New.
* gas/nios2/cdx_not.d: New.
* gas/nios2/cdx_not.s: New.
* gas/nios2/cdx_or.d: New.
* gas/nios2/cdx_or.s: New.
* gas/nios2/cdx_pop.d: New.
* gas/nios2/cdx_pop.s: New.
* gas/nios2/cdx_push.d: New.
* gas/nios2/cdx_push.s: New.
* gas/nios2/cdx_relax.d: New.
* gas/nios2/cdx_relax.s: New.
* gas/nios2/cdx_ret.d: New.
* gas/nios2/cdx_ret.s: New.
* gas/nios2/cdx_sll.d: New.
* gas/nios2/cdx_sll.s: New.
* gas/nios2/cdx_spaddi.d: New.
* gas/nios2/cdx_spaddi.s: New.
* gas/nios2/cdx_spdeci.d: New.
* gas/nios2/cdx_spdeci.s: New.
* gas/nios2/cdx_srl.d: New.
* gas/nios2/cdx_srl.s: New.
* gas/nios2/cdx_stb.d: New.
* gas/nios2/cdx_stb.s: New.
* gas/nios2/cdx_sth.d: New.
* gas/nios2/cdx_sth.s: New.
* gas/nios2/cdx_stw.d: New.
* gas/nios2/cdx_stw.s: New.
* gas/nios2/cdx_stwsp.d: New.
* gas/nios2/cdx_stwsp.s: New.
* gas/nios2/cdx_sub.d: New.
* gas/nios2/cdx_sub.s: New.
* gas/nios2/cdx_trap.d: New.
* gas/nios2/cdx_trap.s: New.
* gas/nios2/cdx_xor.d: New.
* gas/nios2/cdx_xor.s: New.
* gas/nios2/cmp-r2.d: New.
* gas/nios2/comments-r2.d: New.
* gas/nios2/complex-r2.d: New.
* gas/nios2/ctl-r2.d: New.
* gas/nios2/custom-r2.d: New.
* gas/nios2/eni.d: New.
* gas/nios2/eni.s: New.
* gas/nios2/etbt-r2.d: New.
* gas/nios2/flushda-r2.d: New.
* gas/nios2/jmp-r2.d: New.
* gas/nios2/ldb-r2.d: New.
* gas/nios2/ldb-r2.s: New.
* gas/nios2/ldh-r2.d: New.
* gas/nios2/ldh-r2.s: New.
* gas/nios2/ldw-r2.d: New.
* gas/nios2/ldw-r2.s: New.
* gas/nios2/ldwm.d: New.
* gas/nios2/ldwm.s: New.
* gas/nios2/lineseparator-r2.d: New.
* gas/nios2/movia-r2.d: New.
* gas/nios2/mpx.d: New.
* gas/nios2/mpx.s: New.
* gas/nios2/mul-r2.d: New.
* gas/nios2/nop-r2.d: New.
* gas/nios2/nop-r2.s: New.
* gas/nios2/nor-r2.d: New.
* gas/nios2/or-r2.d: New.
* gas/nios2/rdprs-r2.d: New.
* gas/nios2/rdprs-r2.s: New.
* gas/nios2/registers-r2.d: New.
* gas/nios2/ret-r2.d: New.
* gas/nios2/rotate-r2.d: New.
* gas/nios2/stb-r2.d: New.
* gas/nios2/stb-r2.s: New.
* gas/nios2/sth-r2.d: New.
* gas/nios2/sth-r2.s: New.
* gas/nios2/stw-r2.d: New.
* gas/nios2/stw-r2.s: New.
* gas/nios2/stwm.d: New.
* gas/nios2/stwm.s: New.
* gas/nios2/sub-r2.d: New.
* gas/nios2/sync-r2.d: New.
* gas/nios2/trap-r2.d: New.
* gas/nios2/tret-r2.d: New.
* gas/nios2/wrpie.d: New.
* gas/nios2/wrpie.s: New.
* gas/nios2/wrprs-r2.d: New.
* gas/nios2/xor-r2.d: New.
Diff:
---
gas/testsuite/ChangeLog | 126 ++++++++++++++++++
gas/testsuite/gas/nios2/add-r2.d | 18 +++
gas/testsuite/gas/nios2/align_fill-r2.d | 25 ++++
gas/testsuite/gas/nios2/align_text-r2.d | 24 ++++
gas/testsuite/gas/nios2/aligned_text-r2.d | 24 ++++
gas/testsuite/gas/nios2/and-r2.d | 19 +++
gas/testsuite/gas/nios2/andc.d | 17 +++
gas/testsuite/gas/nios2/andc.s | 12 ++
gas/testsuite/gas/nios2/bmx.d | 21 +++
gas/testsuite/gas/nios2/bmx.s | 15 +++
gas/testsuite/gas/nios2/branch-r2.d | 23 ++++
gas/testsuite/gas/nios2/break-r2.d | 14 ++
gas/testsuite/gas/nios2/bret-r2.d | 10 ++
gas/testsuite/gas/nios2/cache-r2.d | 18 +++
gas/testsuite/gas/nios2/cache-r2.s | 21 +++
gas/testsuite/gas/nios2/call-r2.d | 13 ++
gas/testsuite/gas/nios2/call26-r2.d | 78 ++++++++++++
gas/testsuite/gas/nios2/call26_noat-r2.d | 78 ++++++++++++
gas/testsuite/gas/nios2/call_noat-r2.d | 13 ++
gas/testsuite/gas/nios2/cdx_add.d | 19 +++
gas/testsuite/gas/nios2/cdx_add.s | 12 ++
gas/testsuite/gas/nios2/cdx_and.d | 27 ++++
gas/testsuite/gas/nios2/cdx_and.s | 20 +++
gas/testsuite/gas/nios2/cdx_break.d | 11 ++
gas/testsuite/gas/nios2/cdx_break.s | 8 ++
gas/testsuite/gas/nios2/cdx_callr.d | 9 ++
gas/testsuite/gas/nios2/cdx_callr.s | 6 +
gas/testsuite/gas/nios2/cdx_jmpr.d | 11 ++
gas/testsuite/gas/nios2/cdx_jmpr.s | 6 +
gas/testsuite/gas/nios2/cdx_ldbu.d | 17 +++
gas/testsuite/gas/nios2/cdx_ldbu.s | 11 ++
gas/testsuite/gas/nios2/cdx_ldhu.d | 17 +++
gas/testsuite/gas/nios2/cdx_ldhu.s | 11 ++
gas/testsuite/gas/nios2/cdx_ldw.d | 17 +++
gas/testsuite/gas/nios2/cdx_ldw.s | 11 ++
gas/testsuite/gas/nios2/cdx_ldwsp.d | 13 ++
gas/testsuite/gas/nios2/cdx_ldwsp.s | 7 +
gas/testsuite/gas/nios2/cdx_mov.d | 17 +++
gas/testsuite/gas/nios2/cdx_mov.s | 11 ++
gas/testsuite/gas/nios2/cdx_neg.d | 13 ++
gas/testsuite/gas/nios2/cdx_neg.s | 7 +
gas/testsuite/gas/nios2/cdx_not.d | 13 ++
gas/testsuite/gas/nios2/cdx_not.s | 7 +
gas/testsuite/gas/nios2/cdx_or.d | 13 ++
gas/testsuite/gas/nios2/cdx_or.s | 7 +
gas/testsuite/gas/nios2/cdx_pop.d | 17 +++
gas/testsuite/gas/nios2/cdx_pop.s | 11 ++
gas/testsuite/gas/nios2/cdx_push.d | 17 +++
gas/testsuite/gas/nios2/cdx_push.s | 11 ++
gas/testsuite/gas/nios2/cdx_relax.d | 22 ++++
gas/testsuite/gas/nios2/cdx_relax.s | 27 ++++
gas/testsuite/gas/nios2/cdx_ret.d | 11 ++
gas/testsuite/gas/nios2/cdx_ret.s | 4 +
gas/testsuite/gas/nios2/cdx_sll.d | 21 +++
gas/testsuite/gas/nios2/cdx_sll.s | 14 ++
gas/testsuite/gas/nios2/cdx_spaddi.d | 13 ++
gas/testsuite/gas/nios2/cdx_spaddi.s | 7 +
gas/testsuite/gas/nios2/cdx_spdeci.d | 13 ++
gas/testsuite/gas/nios2/cdx_spdeci.s | 7 +
gas/testsuite/gas/nios2/cdx_srl.d | 21 +++
gas/testsuite/gas/nios2/cdx_srl.s | 14 ++
gas/testsuite/gas/nios2/cdx_stb.d | 21 +++
gas/testsuite/gas/nios2/cdx_stb.s | 15 +++
gas/testsuite/gas/nios2/cdx_sth.d | 17 +++
gas/testsuite/gas/nios2/cdx_sth.s | 11 ++
gas/testsuite/gas/nios2/cdx_stw.d | 21 +++
gas/testsuite/gas/nios2/cdx_stw.s | 15 +++
gas/testsuite/gas/nios2/cdx_stwsp.d | 13 ++
gas/testsuite/gas/nios2/cdx_stwsp.s | 7 +
gas/testsuite/gas/nios2/cdx_sub.d | 19 +++
gas/testsuite/gas/nios2/cdx_sub.s | 12 ++
gas/testsuite/gas/nios2/cdx_trap.d | 11 ++
gas/testsuite/gas/nios2/cdx_trap.s | 8 ++
gas/testsuite/gas/nios2/cdx_xor.d | 13 ++
gas/testsuite/gas/nios2/cdx_xor.s | 7 +
gas/testsuite/gas/nios2/cmp-r2.d | 26 ++++
gas/testsuite/gas/nios2/comments-r2.d | 28 ++++
gas/testsuite/gas/nios2/complex-r2.d | 14 ++
gas/testsuite/gas/nios2/ctl-r2.d | 22 ++++
gas/testsuite/gas/nios2/custom-r2.d | 15 +++
gas/testsuite/gas/nios2/eni.d | 12 ++
gas/testsuite/gas/nios2/eni.s | 7 +
gas/testsuite/gas/nios2/etbt-r2.d | 12 ++
gas/testsuite/gas/nios2/flushda-r2.d | 12 ++
gas/testsuite/gas/nios2/jmp-r2.d | 12 ++
gas/testsuite/gas/nios2/ldb-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/ldb-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/ldh-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/ldh-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/ldw-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/ldw-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/ldwm.d | 37 ++++++
gas/testsuite/gas/nios2/ldwm.s | 31 +++++
gas/testsuite/gas/nios2/lineseparator-r2.d | 12 ++
gas/testsuite/gas/nios2/movia-r2.d | 22 ++++
gas/testsuite/gas/nios2/mpx.d | 14 ++
gas/testsuite/gas/nios2/mpx.s | 9 ++
gas/testsuite/gas/nios2/mul-r2.d | 21 +++
gas/testsuite/gas/nios2/nop-r2.d | 11 ++
gas/testsuite/gas/nios2/nop-r2.s | 8 ++
gas/testsuite/gas/nios2/nor-r2.d | 11 ++
gas/testsuite/gas/nios2/or-r2.d | 13 ++
gas/testsuite/gas/nios2/rdprs-r2.d | 32 +++++
gas/testsuite/gas/nios2/rdprs-r2.s | 28 ++++
gas/testsuite/gas/nios2/registers-r2.d | 53 ++++++++
gas/testsuite/gas/nios2/ret-r2.d | 10 ++
gas/testsuite/gas/nios2/rotate-r2.d | 19 +++
gas/testsuite/gas/nios2/stb-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/stb-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/sth-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/sth-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/stw-r2.d | 197 +++++++++++++++++++++++++++++
gas/testsuite/gas/nios2/stw-r2.s | 117 +++++++++++++++++
gas/testsuite/gas/nios2/stwm.d | 35 +++++
gas/testsuite/gas/nios2/stwm.s | 29 +++++
gas/testsuite/gas/nios2/sub-r2.d | 12 ++
gas/testsuite/gas/nios2/sync-r2.d | 10 ++
gas/testsuite/gas/nios2/trap-r2.d | 12 ++
gas/testsuite/gas/nios2/tret-r2.d | 9 ++
gas/testsuite/gas/nios2/wrpie.d | 20 +++
gas/testsuite/gas/nios2/wrpie.s | 16 +++
gas/testsuite/gas/nios2/wrprs-r2.d | 21 +++
gas/testsuite/gas/nios2/xor-r2.d | 13 ++
123 files changed, 3862 insertions(+)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 3d4848b..210a0d1 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,129 @@
+2015-07-01 Sandra Loosemore <sandra@codesourcery.com>
+ Cesar Philippidis <cesar@codesourcery.com>
+
+ * gas/nios2/add-r2.d: New.
+ * gas/nios2/align_fill-r2.d: New.
+ * gas/nios2/align_text-r2.d: New.
+ * gas/nios2/aligned_text-r2.d: New.
+ * gas/nios2/and-r2.d: New.
+ * gas/nios2/andc.d: New.
+ * gas/nios2/andc.s: New.
+ * gas/nios2/bmx.d: New.
+ * gas/nios2/bmx.s: New.
+ * gas/nios2/branch-r2.d: New.
+ * gas/nios2/break-r2.d: New.
+ * gas/nios2/bret-r2.d: New.
+ * gas/nios2/cache-r2.d: New.
+ * gas/nios2/cache-r2.s: New.
+ * gas/nios2/call-r2.d: New.
+ * gas/nios2/call26-r2.d: New.
+ * gas/nios2/call26_noat-r2.d: New.
+ * gas/nios2/call_noat-r2.d: New.
+ * gas/nios2/cdx_add.d: New.
+ * gas/nios2/cdx_add.s: New.
+ * gas/nios2/cdx_and.d: New.
+ * gas/nios2/cdx_and.s: New.
+ * gas/nios2/cdx_break.d: New.
+ * gas/nios2/cdx_break.s: New.
+ * gas/nios2/cdx_callr.d: New.
+ * gas/nios2/cdx_callr.s: New.
+ * gas/nios2/cdx_jmpr.d: New.
+ * gas/nios2/cdx_jmpr.s: New.
+ * gas/nios2/cdx_ldbu.d: New.
+ * gas/nios2/cdx_ldbu.s: New.
+ * gas/nios2/cdx_ldhu.d: New.
+ * gas/nios2/cdx_ldhu.s: New.
+ * gas/nios2/cdx_ldw.d: New.
+ * gas/nios2/cdx_ldw.s: New.
+ * gas/nios2/cdx_ldwsp.d: New.
+ * gas/nios2/cdx_ldwsp.s: New.
+ * gas/nios2/cdx_mov.d: New.
+ * gas/nios2/cdx_mov.s: New.
+ * gas/nios2/cdx_neg.d: New.
+ * gas/nios2/cdx_neg.s: New.
+ * gas/nios2/cdx_not.d: New.
+ * gas/nios2/cdx_not.s: New.
+ * gas/nios2/cdx_or.d: New.
+ * gas/nios2/cdx_or.s: New.
+ * gas/nios2/cdx_pop.d: New.
+ * gas/nios2/cdx_pop.s: New.
+ * gas/nios2/cdx_push.d: New.
+ * gas/nios2/cdx_push.s: New.
+ * gas/nios2/cdx_relax.d: New.
+ * gas/nios2/cdx_relax.s: New.
+ * gas/nios2/cdx_ret.d: New.
+ * gas/nios2/cdx_ret.s: New.
+ * gas/nios2/cdx_sll.d: New.
+ * gas/nios2/cdx_sll.s: New.
+ * gas/nios2/cdx_spaddi.d: New.
+ * gas/nios2/cdx_spaddi.s: New.
+ * gas/nios2/cdx_spdeci.d: New.
+ * gas/nios2/cdx_spdeci.s: New.
+ * gas/nios2/cdx_srl.d: New.
+ * gas/nios2/cdx_srl.s: New.
+ * gas/nios2/cdx_stb.d: New.
+ * gas/nios2/cdx_stb.s: New.
+ * gas/nios2/cdx_sth.d: New.
+ * gas/nios2/cdx_sth.s: New.
+ * gas/nios2/cdx_stw.d: New.
+ * gas/nios2/cdx_stw.s: New.
+ * gas/nios2/cdx_stwsp.d: New.
+ * gas/nios2/cdx_stwsp.s: New.
+ * gas/nios2/cdx_sub.d: New.
+ * gas/nios2/cdx_sub.s: New.
+ * gas/nios2/cdx_trap.d: New.
+ * gas/nios2/cdx_trap.s: New.
+ * gas/nios2/cdx_xor.d: New.
+ * gas/nios2/cdx_xor.s: New.
+ * gas/nios2/cmp-r2.d: New.
+ * gas/nios2/comments-r2.d: New.
+ * gas/nios2/complex-r2.d: New.
+ * gas/nios2/ctl-r2.d: New.
+ * gas/nios2/custom-r2.d: New.
+ * gas/nios2/eni.d: New.
+ * gas/nios2/eni.s: New.
+ * gas/nios2/etbt-r2.d: New.
+ * gas/nios2/flushda-r2.d: New.
+ * gas/nios2/jmp-r2.d: New.
+ * gas/nios2/ldb-r2.d: New.
+ * gas/nios2/ldb-r2.s: New.
+ * gas/nios2/ldh-r2.d: New.
+ * gas/nios2/ldh-r2.s: New.
+ * gas/nios2/ldw-r2.d: New.
+ * gas/nios2/ldw-r2.s: New.
+ * gas/nios2/ldwm.d: New.
+ * gas/nios2/ldwm.s: New.
+ * gas/nios2/lineseparator-r2.d: New.
+ * gas/nios2/movia-r2.d: New.
+ * gas/nios2/mpx.d: New.
+ * gas/nios2/mpx.s: New.
+ * gas/nios2/mul-r2.d: New.
+ * gas/nios2/nop-r2.d: New.
+ * gas/nios2/nop-r2.s: New.
+ * gas/nios2/nor-r2.d: New.
+ * gas/nios2/or-r2.d: New.
+ * gas/nios2/rdprs-r2.d: New.
+ * gas/nios2/rdprs-r2.s: New.
+ * gas/nios2/registers-r2.d: New.
+ * gas/nios2/ret-r2.d: New.
+ * gas/nios2/rotate-r2.d: New.
+ * gas/nios2/stb-r2.d: New.
+ * gas/nios2/stb-r2.s: New.
+ * gas/nios2/sth-r2.d: New.
+ * gas/nios2/sth-r2.s: New.
+ * gas/nios2/stw-r2.d: New.
+ * gas/nios2/stw-r2.s: New.
+ * gas/nios2/stwm.d: New.
+ * gas/nios2/stwm.s: New.
+ * gas/nios2/sub-r2.d: New.
+ * gas/nios2/sync-r2.d: New.
+ * gas/nios2/trap-r2.d: New.
+ * gas/nios2/tret-r2.d: New.
+ * gas/nios2/wrpie.d: New.
+ * gas/nios2/wrpie.s: New.
+ * gas/nios2/wrprs-r2.d: New.
+ * gas/nios2/xor-r2.d: New.
+
2015-06-30 Amit Pawar <Amit.Pawar@amd.com>
* gas/i386/i386.exp: Add new mwaitx test cases.
diff --git a/gas/testsuite/gas/nios2/add-r2.d b/gas/testsuite/gas/nios2/add-r2.d
new file mode 100644
index 0000000..9958243
--- /dev/null
+++ b/gas/testsuite/gas/nios2/add-r2.d
@@ -0,0 +1,18 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 add
+#as: -march=r2
+#source: add.s
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c4042120 add r4,r4,r4
+0+0004 <[^>]*> 7fff2104 addi r4,r4,32767
+0+0008 <[^>]*> 80002104 addi r4,r4,-32768
+0+000c <[^>]*> 00002104 addi r4,r4,0
+0+0010 <[^>]*> ffff2104 addi r4,r4,-1
+0+0014 <[^>]*> ffff2104 addi r4,r4,-1
+0+0018 <[^>]*> 34562104 addi r4,r4,13398
+0+001c <[^>]*> c4000020 nop
diff --git a/gas/testsuite/gas/nios2/align_fill-r2.d b/gas/testsuite/gas/nios2/align_fill-r2.d
new file mode 100644
index 0000000..8e99882
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_fill-r2.d
@@ -0,0 +1,25 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 align_fill
+#as: -march=r2
+#source: align_fill.s
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> fff8dec4 addi sp,sp,-8
+0+0004 <[^>]*> 0004e6f7 stw fp,4\(sp\)
+0+0008 <[^>]*> c41c06e0 mov fp,sp
+0+000c <[^>]*> c4030020 mov r3,zero
+0+0010 <[^>]*> c4000020 nop
+0+0014 <[^>]*> c4000020 nop
+0+0018 <[^>]*> c4000020 nop
+0+001c <[^>]*> c4000020 nop
+0+0020 <[^>]*> 000118c4 addi r3,r3,1
+0+0024 <[^>]*> 006410de cmplti r2,r3,100
+0+0028 <[^>]*> fff400a2 bne r2,zero,00000020 <[^>]*>
+0+002c <[^>]*> 0004e6d7 ldw fp,4\(sp\)
+0+0030 <[^>]*> 0008dec4 addi sp,sp,8
+0+0034 <[^>]*> 140007e0 ret
+ ...
diff --git a/gas/testsuite/gas/nios2/align_text-r2.d b/gas/testsuite/gas/nios2/align_text-r2.d
new file mode 100644
index 0000000..a2f32d9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_text-r2.d
@@ -0,0 +1,24 @@
+#objdump: -dr
+#name: NIOS2 R2 align_test
+#as: -march=r2
+#source: align_text.s
+
+# Test alignment in text sections.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+00000000 <label-0x20>:
+ 0: 00000000 call 0 <label-0x20>
+ 4: c4000020 nop
+ 8: c4000020 nop
+ c: c4000020 nop
+ 10: c4000020 nop
+ 14: c4000020 nop
+ 18: c4000020 nop
+ 1c: c4000020 nop
+
+00000020 <label>:
+ 20: c4000020 nop
+00000024 <label2>:
+ ...
diff --git a/gas/testsuite/gas/nios2/aligned_text-r2.d b/gas/testsuite/gas/nios2/aligned_text-r2.d
new file mode 100644
index 0000000..a2f32d9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/aligned_text-r2.d
@@ -0,0 +1,24 @@
+#objdump: -dr
+#name: NIOS2 R2 align_test
+#as: -march=r2
+#source: align_text.s
+
+# Test alignment in text sections.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+00000000 <label-0x20>:
+ 0: 00000000 call 0 <label-0x20>
+ 4: c4000020 nop
+ 8: c4000020 nop
+ c: c4000020 nop
+ 10: c4000020 nop
+ 14: c4000020 nop
+ 18: c4000020 nop
+ 1c: c4000020 nop
+
+00000020 <label>:
+ 20: c4000020 nop
+00000024 <label2>:
+ ...
diff --git a/gas/testsuite/gas/nios2/and-r2.d b/gas/testsuite/gas/nios2/and-r2.d
new file mode 100644
index 0000000..4485b7d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/and-r2.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 and
+#as: -march=r2
+#source: and.s
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 38042120 and r4,r4,r4
+0+0004 <[^>]*> 7fff210c andi r4,r4,32767
+0+0008 <[^>]*> 8000210c andi r4,r4,32768
+0+000c <[^>]*> ffff210c andi r4,r4,65535
+0+0010 <[^>]*> 0000210c andi r4,r4,0
+0+0014 <[^>]*> 7fff212c andhi r4,r4,32767
+0+0018 <[^>]*> 8000212c andhi r4,r4,32768
+0+001c <[^>]*> ffff212c andhi r4,r4,65535
+0+0020 <[^>]*> 0000212c andhi r4,r4,0
diff --git a/gas/testsuite/gas/nios2/andc.d b/gas/testsuite/gas/nios2/andc.d
new file mode 100644
index 0000000..b708047
--- /dev/null
+++ b/gas/testsuite/gas/nios2/andc.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 andc
+#as: -march=r2
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 7fff211f andci r4,r4,32767
+0+0004 <[^>]*> 8000211f andci r4,r4,32768
+0+0008 <[^>]*> ffff211f andci r4,r4,65535
+0+000c <[^>]*> 0000211f andci r4,r4,0
+0+0010 <[^>]*> 7fff213f andchi r4,r4,32767
+0+0014 <[^>]*> 8000213f andchi r4,r4,32768
+0+0018 <[^>]*> ffff213f andchi r4,r4,65535
+0+001c <[^>]*> 0000213f andchi r4,r4,0
diff --git a/gas/testsuite/gas/nios2/andc.s b/gas/testsuite/gas/nios2/andc.s
new file mode 100644
index 0000000..c1aeadd
--- /dev/null
+++ b/gas/testsuite/gas/nios2/andc.s
@@ -0,0 +1,12 @@
+# Source file used to test the andci and andchi instructions
+
+foo:
+ andci r4,r4,0x7fff
+ andci r4,r4,0x8000
+ andci r4,r4,0xffff
+ andci r4,r4,0x0
+ andchi r4,r4,0x7fff
+ andchi r4,r4,0x8000
+ andchi r4,r4,0xffff
+ andchi r4,r4,0x0
+
diff --git a/gas/testsuite/gas/nios2/bmx.d b/gas/testsuite/gas/nios2/bmx.d
new file mode 100644
index 0000000..09f7964
--- /dev/null
+++ b/gas/testsuite/gas/nios2/bmx.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 BMX instructions
+#as: -march=r2
+
+# Test the BMX instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> cfe0f820 extract ra,zero,31,0
+0+0004 <[^>]*> cf0707e0 extract zero,ra,24,7
+0+0008 <[^>]*> cfe022a0 extract r4,r10,31,0
+0+000c <[^>]*> ce8fbae0 extract r23,r11,20,15
+0+0010 <[^>]*> 8fe0f820 insert ra,zero,31,0
+0+0014 <[^>]*> 8f0707e0 insert zero,ra,24,7
+0+0018 <[^>]*> 8fe022a0 insert r4,r10,31,0
+0+001c <[^>]*> 8e8fbae0 insert r23,r11,20,15
+0+0020 <[^>]*> afe0f820 merge ra,zero,31,0
+0+0024 <[^>]*> af0707e0 merge zero,ra,24,7
+0+0028 <[^>]*> afe022a0 merge r4,r10,31,0
+0+002c <[^>]*> ae8fbae0 merge r23,r11,20,15
diff --git a/gas/testsuite/gas/nios2/bmx.s b/gas/testsuite/gas/nios2/bmx.s
new file mode 100644
index 0000000..382ec9d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/bmx.s
@@ -0,0 +1,15 @@
+# Source file used to test the BMX instruction
+
+foo:
+ extract r31,r0,31,0
+ extract r0,r31,24,7
+ extract r4,r10,31,0
+ extract r23,r11,20,15
+ insert r31,r0,31,0
+ insert r0,r31,24,7
+ insert r4,r10,31,0
+ insert r23,r11,20,15
+ merge r31,r0,31,0
+ merge r0,r31,24,7
+ merge r4,r10,31,0
+ merge r23,r11,20,15
diff --git a/gas/testsuite/gas/nios2/branch-r2.d b/gas/testsuite/gas/nios2/branch-r2.d
new file mode 100644
index 0000000..c30f06e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/branch-r2.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 branch
+#as: -march=r2
+#source: branch.s
+
+# Test the branch instructions.
+dump.o: file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0000292a beq r4,r5,00000004 <[^>]*>
+[ ]*0: R_NIOS2_PCREL16 text_label
+0+0004 <[^>]*> 00002912 bge r4,r5,00000008 <[^>]*>
+[ ]*4: R_NIOS2_PCREL16 text_label
+0+0008 <[^>]*> 00002932 bgeu r4,r5,0000000c <[^>]*>
+[ ]*8: R_NIOS2_PCREL16 text_label
+0+000c <[^>]*> 0000291a blt r4,r5,00000010 <[^>]*>
+[ ]*c: R_NIOS2_PCREL16 text_label
+0+0010 <[^>]*> 0000293a bltu r4,r5,00000014 <[^>]*>
+[ ]*10: R_NIOS2_PCREL16 text_label
+0+0014 <[^>]*> 00002922 bne r4,r5,00000018 <[^>]*>
+[ ]*14: R_NIOS2_PCREL16 text_label
+0+0018 <[^>]*> 00000002 br 0000001c <[^>]*>
+[ ]*18: R_NIOS2_PCREL16 external_label
diff --git a/gas/testsuite/gas/nios2/break-r2.d b/gas/testsuite/gas/nios2/break-r2.d
new file mode 100644
index 0000000..5e2770c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/break-r2.d
@@ -0,0 +1,14 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 break
+#as: -march=r2
+#source: break.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> d01e0020 break 0
+0+0004 <[^>]*> d01e0020 break 0
+0+0008 <[^>]*> d3fe0020 break 31
+0+000c <[^>]*> d1de0020 break 14
+
+
diff --git a/gas/testsuite/gas/nios2/bret-r2.d b/gas/testsuite/gas/nios2/bret-r2.d
new file mode 100644
index 0000000..63792e6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/bret-r2.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 bret
+#as: -march=r2
+#source: bret.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 240007a0 bret
+
diff --git a/gas/testsuite/gas/nios2/cache-r2.d b/gas/testsuite/gas/nios2/cache-r2.d
new file mode 100644
index 0000000..5403ea4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cache-r2.d
@@ -0,0 +1,18 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 cache
+#as: -march=r2
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 380011a8 flushd -2048\(r6\)
+0+0004 <[^>]*> 37ff11a8 flushd 2047\(r6\)
+0+0008 <[^>]*> 300011a8 flushd 0\(r6\)
+0+000c <[^>]*> 3fff11a8 flushd -1\(r6\)
+0+0010 <[^>]*> 300011a8 flushd 0\(r6\)
+[ ]*10: R_NIOS2_R2_S12 .text
+0+0014 <[^>]*> 300011a8 flushd 0\(r6\)
+[ ]*14: R_NIOS2_R2_S12 external
+0+0018 <[^>]*> 300000a0 flushi r2
+0+001c <[^>]*> 10000020 flushp
+
diff --git a/gas/testsuite/gas/nios2/cache-r2.s b/gas/testsuite/gas/nios2/cache-r2.s
new file mode 100644
index 0000000..ec689aa
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cache-r2.s
@@ -0,0 +1,21 @@
+# Source file used to test the cache instruction
+foo:
+ flushd -0x800(r6)
+ flushd 0x7ff(r6)
+ flushd 0x0(r6)
+ flushd -0x001(r6)
+
+# use symbol for offset
+ flushd foo(r6)
+
+# use external symbol
+ .global external
+ flushd external(r6)
+
+# flushi
+ flushi r2
+
+#flushp
+ flushp
+
+
diff --git a/gas/testsuite/gas/nios2/call-r2.d b/gas/testsuite/gas/nios2/call-r2.d
new file mode 100644
index 0000000..bf31471
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call-r2.d
@@ -0,0 +1,13 @@
+# objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 call
+#as: -march=r2
+#source: call.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00000000 call 00000000 <[^>]*>
+[ ]*0: R_NIOS2_CALL26 .text\+0xc
+0+0004 <[^>]*> 741f02a0 callr r10
+0+0008 <[^>]*> 00000000 call 00000000 <[^>]*>
+[ ]*8: R_NIOS2_CALL26 external
diff --git a/gas/testsuite/gas/nios2/call26-r2.d b/gas/testsuite/gas/nios2/call26-r2.d
new file mode 100644
index 0000000..6b1d60b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call26-r2.d
@@ -0,0 +1,78 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 nios2-reloc-r-nios2-call26
+#as: -march=r2
+#source: call26.s
+
+# Test the branch instructions.
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+[ ]*\.\.\.
+[ ]*0: R_NIOS2_CALL26 .text\+0x100
+[ ]*4: R_NIOS2_CALL26 globalfunc
+0+0008 <[^>]*> c4000020 nop
+0+000c <[^>]*> c4000020 nop
+0+0010 <[^>]*> c4000020 nop
+0+0014 <[^>]*> c4000020 nop
+0+0018 <[^>]*> c4000020 nop
+0+001c <[^>]*> c4000020 nop
+0+0020 <[^>]*> c4000020 nop
+0+0024 <[^>]*> c4000020 nop
+0+0028 <[^>]*> c4000020 nop
+0+002c <[^>]*> c4000020 nop
+0+0030 <[^>]*> c4000020 nop
+0+0034 <[^>]*> c4000020 nop
+0+0038 <[^>]*> c4000020 nop
+0+003c <[^>]*> c4000020 nop
+0+0040 <[^>]*> c4000020 nop
+0+0044 <[^>]*> c4000020 nop
+0+0048 <[^>]*> c4000020 nop
+0+004c <[^>]*> c4000020 nop
+0+0050 <[^>]*> c4000020 nop
+0+0054 <[^>]*> c4000020 nop
+0+0058 <[^>]*> c4000020 nop
+0+005c <[^>]*> c4000020 nop
+0+0060 <[^>]*> c4000020 nop
+0+0064 <[^>]*> c4000020 nop
+0+0068 <[^>]*> c4000020 nop
+0+006c <[^>]*> c4000020 nop
+0+0070 <[^>]*> c4000020 nop
+0+0074 <[^>]*> c4000020 nop
+0+0078 <[^>]*> c4000020 nop
+0+007c <[^>]*> c4000020 nop
+0+0080 <[^>]*> c4000020 nop
+0+0084 <[^>]*> c4000020 nop
+0+0088 <[^>]*> c4000020 nop
+0+008c <[^>]*> c4000020 nop
+0+0090 <[^>]*> c4000020 nop
+0+0094 <[^>]*> c4000020 nop
+0+0098 <[^>]*> c4000020 nop
+0+009c <[^>]*> c4000020 nop
+0+00a0 <[^>]*> c4000020 nop
+0+00a4 <[^>]*> c4000020 nop
+0+00a8 <[^>]*> c4000020 nop
+0+00ac <[^>]*> c4000020 nop
+0+00b0 <[^>]*> c4000020 nop
+0+00b4 <[^>]*> c4000020 nop
+0+00b8 <[^>]*> c4000020 nop
+0+00bc <[^>]*> c4000020 nop
+0+00c0 <[^>]*> c4000020 nop
+0+00c4 <[^>]*> c4000020 nop
+0+00c8 <[^>]*> c4000020 nop
+0+00cc <[^>]*> c4000020 nop
+0+00d0 <[^>]*> c4000020 nop
+0+00d4 <[^>]*> c4000020 nop
+0+00d8 <[^>]*> c4000020 nop
+0+00dc <[^>]*> c4000020 nop
+0+00e0 <[^>]*> c4000020 nop
+0+00e4 <[^>]*> c4000020 nop
+0+00e8 <[^>]*> c4000020 nop
+0+00ec <[^>]*> c4000020 nop
+0+00f0 <[^>]*> c4000020 nop
+0+00f4 <[^>]*> c4000020 nop
+0+00f8 <[^>]*> c4000020 nop
+0+00fc <[^>]*> c4000020 nop
+0+0100 <[^>]*> c4000020 nop
+ ...
+
+
diff --git a/gas/testsuite/gas/nios2/call26_noat-r2.d b/gas/testsuite/gas/nios2/call26_noat-r2.d
new file mode 100644
index 0000000..8235e63
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call26_noat-r2.d
@@ -0,0 +1,78 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 nios2-reloc-r-nios2-call26-noat
+#as: -march=r2
+#source: call26_noat.s
+
+# Test the branch instructions.
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+[ ]*\.\.\.
+[ ]*0: R_NIOS2_CALL26_NOAT .text\+0x100
+[ ]*4: R_NIOS2_CALL26_NOAT globalfunc
+0+0008 <[^>]*> c4000020 nop
+0+000c <[^>]*> c4000020 nop
+0+0010 <[^>]*> c4000020 nop
+0+0014 <[^>]*> c4000020 nop
+0+0018 <[^>]*> c4000020 nop
+0+001c <[^>]*> c4000020 nop
+0+0020 <[^>]*> c4000020 nop
+0+0024 <[^>]*> c4000020 nop
+0+0028 <[^>]*> c4000020 nop
+0+002c <[^>]*> c4000020 nop
+0+0030 <[^>]*> c4000020 nop
+0+0034 <[^>]*> c4000020 nop
+0+0038 <[^>]*> c4000020 nop
+0+003c <[^>]*> c4000020 nop
+0+0040 <[^>]*> c4000020 nop
+0+0044 <[^>]*> c4000020 nop
+0+0048 <[^>]*> c4000020 nop
+0+004c <[^>]*> c4000020 nop
+0+0050 <[^>]*> c4000020 nop
+0+0054 <[^>]*> c4000020 nop
+0+0058 <[^>]*> c4000020 nop
+0+005c <[^>]*> c4000020 nop
+0+0060 <[^>]*> c4000020 nop
+0+0064 <[^>]*> c4000020 nop
+0+0068 <[^>]*> c4000020 nop
+0+006c <[^>]*> c4000020 nop
+0+0070 <[^>]*> c4000020 nop
+0+0074 <[^>]*> c4000020 nop
+0+0078 <[^>]*> c4000020 nop
+0+007c <[^>]*> c4000020 nop
+0+0080 <[^>]*> c4000020 nop
+0+0084 <[^>]*> c4000020 nop
+0+0088 <[^>]*> c4000020 nop
+0+008c <[^>]*> c4000020 nop
+0+0090 <[^>]*> c4000020 nop
+0+0094 <[^>]*> c4000020 nop
+0+0098 <[^>]*> c4000020 nop
+0+009c <[^>]*> c4000020 nop
+0+00a0 <[^>]*> c4000020 nop
+0+00a4 <[^>]*> c4000020 nop
+0+00a8 <[^>]*> c4000020 nop
+0+00ac <[^>]*> c4000020 nop
+0+00b0 <[^>]*> c4000020 nop
+0+00b4 <[^>]*> c4000020 nop
+0+00b8 <[^>]*> c4000020 nop
+0+00bc <[^>]*> c4000020 nop
+0+00c0 <[^>]*> c4000020 nop
+0+00c4 <[^>]*> c4000020 nop
+0+00c8 <[^>]*> c4000020 nop
+0+00cc <[^>]*> c4000020 nop
+0+00d0 <[^>]*> c4000020 nop
+0+00d4 <[^>]*> c4000020 nop
+0+00d8 <[^>]*> c4000020 nop
+0+00dc <[^>]*> c4000020 nop
+0+00e0 <[^>]*> c4000020 nop
+0+00e4 <[^>]*> c4000020 nop
+0+00e8 <[^>]*> c4000020 nop
+0+00ec <[^>]*> c4000020 nop
+0+00f0 <[^>]*> c4000020 nop
+0+00f4 <[^>]*> c4000020 nop
+0+00f8 <[^>]*> c4000020 nop
+0+00fc <[^>]*> c4000020 nop
+0+0100 <[^>]*> c4000020 nop
+ ...
+
+
diff --git a/gas/testsuite/gas/nios2/call_noat-r2.d b/gas/testsuite/gas/nios2/call_noat-r2.d
new file mode 100644
index 0000000..8f3747e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call_noat-r2.d
@@ -0,0 +1,13 @@
+# objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 call noat
+#as: -march=r2
+#source: call_noat.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00000000 call 00000000 <[^>]*>
+[ ]*0: R_NIOS2_CALL26_NOAT .text\+0xc
+0+0004 <[^>]*> 741f02a0 callr r10
+0+0008 <[^>]*> 00000000 call 00000000 <[^>]*>
+[ ]*8: R_NIOS2_CALL26_NOAT external
diff --git a/gas/testsuite/gas/nios2/cdx_add.d b/gas/testsuite/gas/nios2/cdx_add.d
new file mode 100644
index 0000000..cfc0cc7
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_add.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX add.n
+#as: -march=r2
+
+# Test the add.n and addi.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 4901 add.n r4,r4,r4
+0+0002 <[^>]*> 0911 addi.n r4,r4,1
+0+0004 <[^>]*> 1911 addi.n r4,r4,2
+0+0006 <[^>]*> 2911 addi.n r4,r4,4
+0+0008 <[^>]*> 3911 addi.n r4,r4,8
+0+000a <[^>]*> 4911 addi.n r4,r4,16
+0+000c <[^>]*> 5911 addi.n r4,r4,32
+0+000e <[^>]*> 6911 addi.n r4,r4,64
+0+0010 <[^>]*> 7911 addi.n r4,r4,128
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_add.s b/gas/testsuite/gas/nios2/cdx_add.s
new file mode 100644
index 0000000..4d8f2b2
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_add.s
@@ -0,0 +1,12 @@
+# Source file used to test the add and addi instructions.
+
+foo:
+ add.n r4,r4,r4
+ addi.n r4,r4,1
+ addi.n r4,r4,2
+ addi.n r4,r4,4
+ addi.n r4,r4,8
+ addi.n r4,r4,16
+ addi.n r4,r4,32
+ addi.n r4,r4,64
+ addi.n r4,r4,128
diff --git a/gas/testsuite/gas/nios2/cdx_and.d b/gas/testsuite/gas/nios2/cdx_and.d
new file mode 100644
index 0000000..e641dbb
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_and.d
@@ -0,0 +1,27 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX and.n
+#as: -march=r2
+
+# Test the and.n and andi.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0909 and.n r4,r4,r4
+0+0002 <[^>]*> 090b andi.n r4,r4,1
+0+0004 <[^>]*> 190b andi.n r4,r4,2
+0+0006 <[^>]*> 290b andi.n r4,r4,3
+0+0008 <[^>]*> 390b andi.n r4,r4,4
+0+000a <[^>]*> 490b andi.n r4,r4,8
+0+000c <[^>]*> 590b andi.n r4,r4,15
+0+000e <[^>]*> 690b andi.n r4,r4,16
+0+0010 <[^>]*> 790b andi.n r4,r4,31
+0+0012 <[^>]*> 890b andi.n r4,r4,32
+0+0014 <[^>]*> 990b andi.n r4,r4,63
+0+0016 <[^>]*> a90b andi.n r4,r4,127
+0+0018 <[^>]*> b90b andi.n r4,r4,128
+0+001a <[^>]*> c90b andi.n r4,r4,255
+0+001c <[^>]*> d90b andi.n r4,r4,2047
+0+001e <[^>]*> e90b andi.n r4,r4,65280
+0+0020 <[^>]*> f90b andi.n r4,r4,65535
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_and.s b/gas/testsuite/gas/nios2/cdx_and.s
new file mode 100644
index 0000000..d666fa3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_and.s
@@ -0,0 +1,20 @@
+# Source file used to test the and.n and andi.n instructions
+
+foo:
+ and.n r4,r4,r4
+ andi.n r4,r4,0x1
+ andi.n r4,r4,0x2
+ andi.n r4,r4,0x3
+ andi.n r4,r4,0x4
+ andi.n r4,r4,0x8
+ andi.n r4,r4,0xf
+ andi.n r4,r4,0x10
+ andi.n r4,r4,0x1f
+ andi.n r4,r4,0x20
+ andi.n r4,r4,0x3f
+ andi.n r4,r4,0x7f
+ andi.n r4,r4,0x80
+ andi.n r4,r4,0xff
+ andi.n r4,r4,0x7ff
+ andi.n r4,r4,0xff00
+ andi.n r4,r4,0xffff
diff --git a/gas/testsuite/gas/nios2/cdx_break.d b/gas/testsuite/gas/nios2/cdx_break.d
new file mode 100644
index 0000000..30c155b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_break.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX break
+#as: -march=r2
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c009 break.n 0
+0+0002 <[^>]*> c009 break.n 0
+0+0004 <[^>]*> c7c9 break.n 31
+0+0006 <[^>]*> c389 break.n 14
diff --git a/gas/testsuite/gas/nios2/cdx_break.s b/gas/testsuite/gas/nios2/cdx_break.s
new file mode 100644
index 0000000..b186935
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_break.s
@@ -0,0 +1,8 @@
+# Source file used to test the CDX break.n instructions
+foo:
+ break.n
+ break.n 0
+ break.n 31
+ break.n 14
+
+
diff --git a/gas/testsuite/gas/nios2/cdx_callr.d b/gas/testsuite/gas/nios2/cdx_callr.d
new file mode 100644
index 0000000..a2114cc
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_callr.d
@@ -0,0 +1,9 @@
+# objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX callr.n
+#as: -march=r2
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 8109 callr.n r4
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_callr.s b/gas/testsuite/gas/nios2/cdx_callr.s
new file mode 100644
index 0000000..84e9d69
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_callr.s
@@ -0,0 +1,6 @@
+# Source file used to test the callr instruction
+
+.text
+.set norelax
+foo:
+ callr.n r4
diff --git a/gas/testsuite/gas/nios2/cdx_jmpr.d b/gas/testsuite/gas/nios2/cdx_jmpr.d
new file mode 100644
index 0000000..95ea886
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_jmpr.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX jmpr.n
+#as: -march=r2
+
+# Test the jmpr.n instruction.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> a1c9 jmpr.n r7
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_jmpr.s b/gas/testsuite/gas/nios2/cdx_jmpr.s
new file mode 100644
index 0000000..67d54e2
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_jmpr.s
@@ -0,0 +1,6 @@
+# Source file used to test the jmpr.n instruction.
+.text
+.set nobreak
+foo:
+ jmpr.n r7
+
diff --git a/gas/testsuite/gas/nios2/cdx_ldbu.d b/gas/testsuite/gas/nios2/cdx_ldbu.d
new file mode 100644
index 0000000..acb581f
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldbu.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX ldbu.n
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0845 ldbu.n r4,0\(r17\)
+0+0002 <[^>]*> 4845 ldbu.n r4,4\(r17\)
+0+0004 <[^>]*> 7845 ldbu.n r4,7\(r17\)
+0+0006 <[^>]*> f845 ldbu.n r4,15\(r17\)
+0+0008 <[^>]*> 0945 ldbu.n r4,0\(r5\)
+0+000a <[^>]*> 4945 ldbu.n r4,4\(r5\)
+0+000c <[^>]*> 7945 ldbu.n r4,7\(r5\)
+0+000e <[^>]*> f945 ldbu.n r4,15\(r5\)
diff --git a/gas/testsuite/gas/nios2/cdx_ldbu.s b/gas/testsuite/gas/nios2/cdx_ldbu.s
new file mode 100644
index 0000000..f459366
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldbu.s
@@ -0,0 +1,11 @@
+# Source file used to test the ldbu.n instruction
+
+foo:
+ ldbu.n r4,0(r17)
+ ldbu.n r4,4(r17)
+ ldbu.n r4,7(r17)
+ ldbu.n r4,0xf(r17)
+ ldbu.n r4,0(r5)
+ ldbu.n r4,4(r5)
+ ldbu.n r4,7(r5)
+ ldbu.n r4,0xf(r5)
diff --git a/gas/testsuite/gas/nios2/cdx_ldhu.d b/gas/testsuite/gas/nios2/cdx_ldhu.d
new file mode 100644
index 0000000..efc7467
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldhu.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX ldhu.n
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 084d ldhu.n r4,0\(r17\)
+0+0002 <[^>]*> 284d ldhu.n r4,4\(r17\)
+0+0004 <[^>]*> 784d ldhu.n r4,14\(r17\)
+0+0006 <[^>]*> f84d ldhu.n r4,30\(r17\)
+0+0008 <[^>]*> 094d ldhu.n r4,0\(r5\)
+0+000a <[^>]*> 294d ldhu.n r4,4\(r5\)
+0+000c <[^>]*> 794d ldhu.n r4,14\(r5\)
+0+000e <[^>]*> f94d ldhu.n r4,30\(r5\)
diff --git a/gas/testsuite/gas/nios2/cdx_ldhu.s b/gas/testsuite/gas/nios2/cdx_ldhu.s
new file mode 100644
index 0000000..afa55d9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldhu.s
@@ -0,0 +1,11 @@
+# Source file used to test the ldhu.n instruction
+
+foo:
+ ldhu.n r4,0(r17)
+ ldhu.n r4,4(r17)
+ ldhu.n r4,0xe(r17)
+ ldhu.n r4,0x1e(r17)
+ ldhu.n r4,0(r5)
+ ldhu.n r4,4(r5)
+ ldhu.n r4,0xe(r5)
+ ldhu.n r4,0x1e(r5)
diff --git a/gas/testsuite/gas/nios2/cdx_ldw.d b/gas/testsuite/gas/nios2/cdx_ldw.d
new file mode 100644
index 0000000..d23ae46
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldw.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX ldw.n
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0855 ldw.n r4,0\(r17\)
+0+0002 <[^>]*> 1855 ldw.n r4,4\(r17\)
+0+0004 <[^>]*> 7855 ldw.n r4,28\(r17\)
+0+0006 <[^>]*> f855 ldw.n r4,60\(r17\)
+0+0008 <[^>]*> 0955 ldw.n r4,0\(r5\)
+0+000a <[^>]*> 1955 ldw.n r4,4\(r5\)
+0+000c <[^>]*> 7955 ldw.n r4,28\(r5\)
+0+000e <[^>]*> f955 ldw.n r4,60\(r5\)
diff --git a/gas/testsuite/gas/nios2/cdx_ldw.s b/gas/testsuite/gas/nios2/cdx_ldw.s
new file mode 100644
index 0000000..4a7a503
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldw.s
@@ -0,0 +1,11 @@
+# Source file used to test the ldw.n instruction
+
+foo:
+ ldw.n r4,0(r17)
+ ldw.n r4,4(r17)
+ ldw.n r4,0x1c(r17)
+ ldw.n r4,0x3c(r17)
+ ldw.n r4,0(r5)
+ ldw.n r4,4(r5)
+ ldw.n r4,0x1c(r5)
+ ldw.n r4,0x3c(r5)
diff --git a/gas/testsuite/gas/nios2/cdx_ldwsp.d b/gas/testsuite/gas/nios2/cdx_ldwsp.d
new file mode 100644
index 0000000..3b0563b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldwsp.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX ldwsp.n
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 2013 ldwsp.n r4,0\(sp\)
+0+0002 <[^>]*> 2053 ldwsp.n r4,4\(sp\)
+0+0004 <[^>]*> 23d3 ldwsp.n r4,60\(sp\)
+0+0006 <[^>]*> 27d3 ldwsp.n r4,124\(sp\)
diff --git a/gas/testsuite/gas/nios2/cdx_ldwsp.s b/gas/testsuite/gas/nios2/cdx_ldwsp.s
new file mode 100644
index 0000000..3560aa3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ldwsp.s
@@ -0,0 +1,7 @@
+# Source file used to test the ldwsp.n instruction
+
+foo:
+ ldwsp.n r4,0(sp)
+ ldwsp.n r4,4(sp)
+ ldwsp.n r4,0x3c(sp)
+ ldwsp.n r4,0x7c(sp)
diff --git a/gas/testsuite/gas/nios2/cdx_mov.d b/gas/testsuite/gas/nios2/cdx_mov.d
new file mode 100644
index 0000000..1bec020
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_mov.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX mov.n
+#as: -march=r2
+
+# Test the mov.n and movi.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 213b mov.n r4,r4
+0+0002 <[^>]*> 011b movi.n r4,0
+0+0004 <[^>]*> 031b movi.n r4,1
+0+0006 <[^>]*> 7f1b movi.n r4,63
+0+0008 <[^>]*> f91b movi.n r4,124
+0+000a <[^>]*> fb1b movi.n r4,255
+0+000c <[^>]*> fd1b movi.n r4,-2
+0+000e <[^>]*> ff1b movi.n r4,-1
diff --git a/gas/testsuite/gas/nios2/cdx_mov.s b/gas/testsuite/gas/nios2/cdx_mov.s
new file mode 100644
index 0000000..b3ebc48
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_mov.s
@@ -0,0 +1,11 @@
+# Source file used to test the mov.n mov movi.n instructions
+
+foo:
+ mov.n r4,r4
+ movi.n r4,0x0
+ movi.n r4,0x1
+ movi.n r4,0x3f
+ movi.n r4,0x7c
+ movi.n r4,0xff
+ movi.n r4,-2
+ movi.n r4,-1
diff --git a/gas/testsuite/gas/nios2/cdx_neg.d b/gas/testsuite/gas/nios2/cdx_neg.d
new file mode 100644
index 0000000..8ac99d0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_neg.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX neg.n
+#as: -march=r2
+
+# Test the neg.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 7909 neg.n r4,r4
+0+0002 <[^>]*> 7e49 neg.n r17,r7
+0+0004 <[^>]*> 73c9 neg.n r7,r17
+0+0006 <[^>]*> 7fc9 neg.n r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_neg.s b/gas/testsuite/gas/nios2/cdx_neg.s
new file mode 100644
index 0000000..27d0ed0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_neg.s
@@ -0,0 +1,7 @@
+# Source file used to test the neg.n instructions.
+
+foo:
+ neg.n r4,r4
+ neg.n r17,r7
+ neg.n r7,r17
+ neg.n r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_not.d b/gas/testsuite/gas/nios2/cdx_not.d
new file mode 100644
index 0000000..6310183
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_not.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX not.n
+#as: -march=r2
+
+# Test the not.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 6909 not.n r4,r4
+0+0002 <[^>]*> 63c9 not.n r17,r7
+0+0004 <[^>]*> 6e49 not.n r7,r17
+0+0006 <[^>]*> 6fc9 not.n r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_not.s b/gas/testsuite/gas/nios2/cdx_not.s
new file mode 100644
index 0000000..ae0f70b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_not.s
@@ -0,0 +1,7 @@
+# Source file used to test the not.n instructions.
+
+foo:
+ not.n r4,r4
+ not.n r17,r7
+ not.n r7,r17
+ not.n r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_or.d b/gas/testsuite/gas/nios2/cdx_or.d
new file mode 100644
index 0000000..259a015
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_or.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX or.n
+#as: -march=r2
+
+# Test the or.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 2909 or.n r4,r4,r4
+0+0002 <[^>]*> 2e49 or.n r17,r17,r7
+0+0004 <[^>]*> 23c9 or.n r7,r7,r17
+0+0006 <[^>]*> 2fc9 or.n r7,r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_or.s b/gas/testsuite/gas/nios2/cdx_or.s
new file mode 100644
index 0000000..cae5615
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_or.s
@@ -0,0 +1,7 @@
+# Source file used to test the or.n instructions.
+
+foo:
+ or.n r4,r4,r4
+ or.n r17,r17,r7
+ or.n r7,r7,r17
+ or.n r7,r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_pop.d b/gas/testsuite/gas/nios2/cdx_pop.d
new file mode 100644
index 0000000..0066e59
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_pop.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX pop.n
+#as: -march=r2
+
+# Test the pop.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0021 pop.n {ra},0
+0+0002 <[^>]*> 2021 pop.n {fp,ra},0
+0+0004 <[^>]*> 4021 pop.n {r16,ra},0
+0+0006 <[^>]*> 6021 pop.n {r16,fp,ra},0
+0+0008 <[^>]*> 7c21 pop.n {r16,r17,r18,r19,r20,r21,r22,r23,fp,ra},0
+0+000a <[^>]*> 0021 pop.n {ra},0
+0+000c <[^>]*> 03e1 pop.n {ra},60
+0+000e <[^>]*> 7fe1 pop.n {r16,r17,r18,r19,r20,r21,r22,r23,fp,ra},60
diff --git a/gas/testsuite/gas/nios2/cdx_pop.s b/gas/testsuite/gas/nios2/cdx_pop.s
new file mode 100644
index 0000000..d25d69a
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_pop.s
@@ -0,0 +1,11 @@
+# Source file used to test the pop.n instruction
+
+foo:
+ pop.n {ra}
+ pop.n {fp,ra}
+ pop.n {r16,ra}
+ pop.n {r16,fp,ra}
+ pop.n {r16,r17,r18,r19,r20,r21,r22,r23,fp,ra}
+ pop.n {ra},0x0
+ pop.n {ra},0x3c
+ pop.n {r16,r17,r18,r19,r20,r21,r22,r23,fp,ra},0x3c
diff --git a/gas/testsuite/gas/nios2/cdx_push.d b/gas/testsuite/gas/nios2/cdx_push.d
new file mode 100644
index 0000000..b9d4be7
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_push.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX push.n
+#as: -march=r2
+
+# Test the push.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 8021 push.n {ra},0
+0+0002 <[^>]*> a021 push.n {ra,fp},0
+0+0004 <[^>]*> c021 push.n {ra,r16},0
+0+0006 <[^>]*> e021 push.n {ra,fp,r16},0
+0+0008 <[^>]*> fc21 push.n {ra,fp,r23,r22,r21,r20,r19,r18,r17,r16},0
+0+000a <[^>]*> 8021 push.n {ra},0
+0+000c <[^>]*> 83e1 push.n {ra},60
+0+000e <[^>]*> ffe1 push.n {ra,fp,r23,r22,r21,r20,r19,r18,r17,r16},60
diff --git a/gas/testsuite/gas/nios2/cdx_push.s b/gas/testsuite/gas/nios2/cdx_push.s
new file mode 100644
index 0000000..f6ca437
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_push.s
@@ -0,0 +1,11 @@
+# Source file used to test the push.n instruction
+
+foo:
+ push.n {ra}
+ push.n {ra,fp}
+ push.n {ra,r16}
+ push.n {ra,fp,r16}
+ push.n {ra,fp,r23,r22,r21,r20,r19,r18,r17,r16}
+ push.n {ra},0x0
+ push.n {ra},0x3c
+ push.n {ra,fp,r23,r22,r21,r20,r19,r18,r17,r16},0x3c
diff --git a/gas/testsuite/gas/nios2/cdx_relax.d b/gas/testsuite/gas/nios2/cdx_relax.d
new file mode 100644
index 0000000..ce6f640
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_relax.d
@@ -0,0 +1,22 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX branch relaxation
+#as: -march=r2
+
+# Test relaxation of beqz.n, bnez.n, and br.n instructions to
+# equivalent 32-bit instructions when the branch target is out of range.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <label0> 04a3 bnez.n r2,00000006 <label1>
+0+0002 <[^>]*> 02eb beqz.n r3,00000006 <label1>
+0+0004 <[^>]*> 0003 br.n 00000006 <label1>
+0+0006 <label1> 04b800a2 bne r2,zero,000004c2 <label2>
+0+000a <[^>]*> 04b400ea beq r3,zero,000004c2 <label2>
+0+000e <[^>]*> 04b00002 br 000004c2 <label2>
+0+0012 <[^>]*> c4000020 nop
+#...
+0+04c2 <label2> fb4000a2 bne r2,zero,00000006 <label1>
+0+04c6 <[^>]*> fb3c00ea beq r3,zero,00000006 <label1>
+0+04ca <[^>]*> fb380002 br 00000006 <label1>
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_relax.s b/gas/testsuite/gas/nios2/cdx_relax.s
new file mode 100644
index 0000000..152154b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_relax.s
@@ -0,0 +1,27 @@
+# Test relaxation of beqz.n, bnez.n, and br.n instructions to
+# equivalent 32-bit instructions when the branch target is out of range.
+
+ .text
+
+# These branches are within range.
+label0:
+ bnez.n r2, label1
+ beqz.n r3, label1
+ br.n label1
+
+# These branches have an out-of-range positive offset.
+label1:
+ bnez.n r2, label2
+ beqz.n r3, label2
+ br.n label2
+
+ .rept 300
+ nop
+ .endr
+
+# These branches have an out-of-range negative offset.
+label2:
+ bnez.n r2, label1
+ beqz.n r3, label1
+ br.n label1
+
diff --git a/gas/testsuite/gas/nios2/cdx_ret.d b/gas/testsuite/gas/nios2/cdx_ret.d
new file mode 100644
index 0000000..71623c9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ret.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX ret.n
+#as: -march=r2
+
+# Test the ret.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> e009 ret.n
+ ...
\ No newline at end of file
diff --git a/gas/testsuite/gas/nios2/cdx_ret.s b/gas/testsuite/gas/nios2/cdx_ret.s
new file mode 100644
index 0000000..3ee9ab3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_ret.s
@@ -0,0 +1,4 @@
+# Source file used to test the ret.n instruction
+
+foo:
+ ret.n
diff --git a/gas/testsuite/gas/nios2/cdx_sll.d b/gas/testsuite/gas/nios2/cdx_sll.d
new file mode 100644
index 0000000..9305c5c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sll.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX sll.n
+#as: -march=r2
+
+# Test the sll.n and slli.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 4909 sll.n r4,r4,r4
+0+0002 <[^>]*> 0919 slli.n r4,r4,1
+0+0004 <[^>]*> 1919 slli.n r4,r4,2
+0+0006 <[^>]*> 2919 slli.n r4,r4,3
+0+0008 <[^>]*> 3919 slli.n r4,r4,8
+0+000a <[^>]*> 4919 slli.n r4,r4,12
+0+000c <[^>]*> 5919 slli.n r4,r4,16
+0+000e <[^>]*> 6919 slli.n r4,r4,24
+0+0010 <[^>]*> 7919 slli.n r4,r4,31
+0+0012 <[^>]*> 41c9 sll.n r7,r7,r16
+0+0014 <[^>]*> 4e09 sll.n r16,r16,r7
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_sll.s b/gas/testsuite/gas/nios2/cdx_sll.s
new file mode 100644
index 0000000..4cbcf55
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sll.s
@@ -0,0 +1,14 @@
+# Source file used to test the sll.n and slli.n instructions
+
+foo:
+ sll.n r4,r4,r4
+ slli.n r4,r4,0x1
+ slli.n r4,r4,0x2
+ slli.n r4,r4,0x3
+ slli.n r4,r4,0x8
+ slli.n r4,r4,0xc
+ slli.n r4,r4,0x10
+ slli.n r4,r4,0x18
+ slli.n r4,r4,0x1f
+ sll.n r7,r7,r16
+ sll.n r16,r16,r7
diff --git a/gas/testsuite/gas/nios2/cdx_spaddi.d b/gas/testsuite/gas/nios2/cdx_spaddi.d
new file mode 100644
index 0000000..196b83d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_spaddi.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX spaddi.n
+#as: -march=r2
+
+# Test the spaddi.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 007d spaddi.n r17,0
+0+0002 <[^>]*> 01fd spaddi.n r7,0
+0+0004 <[^>]*> 7e7d spaddi.n r17,252
+0+0006 <[^>]*> 7ffd spaddi.n r7,252
diff --git a/gas/testsuite/gas/nios2/cdx_spaddi.s b/gas/testsuite/gas/nios2/cdx_spaddi.s
new file mode 100644
index 0000000..eeaa3d4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_spaddi.s
@@ -0,0 +1,7 @@
+# Source file used to test the spaddi.n instruction
+
+foo:
+ spaddi.n r17,0
+ spaddi.n r7,0
+ spaddi.n r17,252
+ spaddi.n r7,252
diff --git a/gas/testsuite/gas/nios2/cdx_spdeci.d b/gas/testsuite/gas/nios2/cdx_spdeci.d
new file mode 100644
index 0000000..b21caa7
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_spdeci.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX spdeci.n
+#as: -march=r2
+
+# Test the spdeci.n and spinci.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 8029 spdeci.n 0
+0+0002 <[^>]*> 9fe9 spdeci.n 508
+0+0004 <[^>]*> 0029 spinci.n 0
+0+0006 <[^>]*> 1fe9 spinci.n 508
diff --git a/gas/testsuite/gas/nios2/cdx_spdeci.s b/gas/testsuite/gas/nios2/cdx_spdeci.s
new file mode 100644
index 0000000..746c0b6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_spdeci.s
@@ -0,0 +1,7 @@
+# Source file used to test the spdeci.n and spinci.n instructions
+
+foo:
+ spdeci.n 0
+ spdeci.n 0x1fc
+ spinci.n 0
+ spinci.n 0x1fc
diff --git a/gas/testsuite/gas/nios2/cdx_srl.d b/gas/testsuite/gas/nios2/cdx_srl.d
new file mode 100644
index 0000000..ea7a1d1
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_srl.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX srl.n
+#as: -march=r2
+
+# Test the srl.n and srli.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 5909 srl.n r4,r4,r4
+0+0002 <[^>]*> 8919 srli.n r4,r4,1
+0+0004 <[^>]*> 9919 srli.n r4,r4,2
+0+0006 <[^>]*> a919 srli.n r4,r4,3
+0+0008 <[^>]*> b919 srli.n r4,r4,8
+0+000a <[^>]*> c919 srli.n r4,r4,12
+0+000c <[^>]*> d919 srli.n r4,r4,16
+0+000e <[^>]*> e919 srli.n r4,r4,24
+0+0010 <[^>]*> f919 srli.n r4,r4,31
+0+0012 <[^>]*> 51c9 srl.n r7,r7,r16
+0+0014 <[^>]*> 5e09 srl.n r16,r16,r7
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_srl.s b/gas/testsuite/gas/nios2/cdx_srl.s
new file mode 100644
index 0000000..36f8357
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_srl.s
@@ -0,0 +1,14 @@
+# Source file used to test the srl.n and srli.n instructions
+
+foo:
+ srl.n r4,r4,r4
+ srli.n r4,r4,0x1
+ srli.n r4,r4,0x2
+ srli.n r4,r4,0x3
+ srli.n r4,r4,0x8
+ srli.n r4,r4,0xc
+ srli.n r4,r4,0x10
+ srli.n r4,r4,0x18
+ srli.n r4,r4,0x1f
+ srl.n r7,r7,r16
+ srl.n r16,r16,r7
diff --git a/gas/testsuite/gas/nios2/cdx_stb.d b/gas/testsuite/gas/nios2/cdx_stb.d
new file mode 100644
index 0000000..eb7e2df
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stb.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX stb.n
+#as: -march=r2
+
+# Test the stb.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0865 stb.n r4,0\(r17\)
+0+0002 <[^>]*> 4865 stb.n r4,4\(r17\)
+0+0004 <[^>]*> 7865 stb.n r4,7\(r17\)
+0+0006 <[^>]*> f865 stb.n r4,15\(r17\)
+0+0008 <[^>]*> 0965 stb.n r4,0\(r5\)
+0+000a <[^>]*> 4965 stb.n r4,4\(r5\)
+0+000c <[^>]*> 7965 stb.n r4,7\(r5\)
+0+000e <[^>]*> f965 stb.n r4,15\(r5\)
+0+0010 <[^>]*> 801d stbz.n zero,0\(r16\)
+0+0012 <[^>]*> 801d stbz.n zero,0\(r16\)
+0+0014 <[^>]*> fe1d stbz.n zero,63\(r16\)
+0+0016 <[^>]*> ffdd stbz.n zero,63\(r7\)
diff --git a/gas/testsuite/gas/nios2/cdx_stb.s b/gas/testsuite/gas/nios2/cdx_stb.s
new file mode 100644
index 0000000..3f79c68
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stb.s
@@ -0,0 +1,15 @@
+# Source file used to test the stb.n instruction
+
+foo:
+ stb.n r4,0(r17)
+ stb.n r4,4(r17)
+ stb.n r4,0x7(r17)
+ stb.n r4,0xf(r17)
+ stb.n r4,0(r5)
+ stb.n r4,4(r5)
+ stb.n r4,0x7(r5)
+ stb.n r4,0xf(r5)
+ stbz.n zero,0(r16)
+ stbz.n r0,0(r16)
+ stbz.n zero,63(r16)
+ stbz.n zero,63(r7)
diff --git a/gas/testsuite/gas/nios2/cdx_sth.d b/gas/testsuite/gas/nios2/cdx_sth.d
new file mode 100644
index 0000000..cb2077c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sth.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX sth.n
+#as: -march=r2
+
+# Test the sth.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 086d sth.n r4,0\(r17\)
+0+0002 <[^>]*> 286d sth.n r4,4\(r17\)
+0+0004 <[^>]*> 786d sth.n r4,14\(r17\)
+0+0006 <[^>]*> f86d sth.n r4,30\(r17\)
+0+0008 <[^>]*> 096d sth.n r4,0\(r5\)
+0+000a <[^>]*> 296d sth.n r4,4\(r5\)
+0+000c <[^>]*> 796d sth.n r4,14\(r5\)
+0+000e <[^>]*> f96d sth.n r4,30\(r5\)
diff --git a/gas/testsuite/gas/nios2/cdx_sth.s b/gas/testsuite/gas/nios2/cdx_sth.s
new file mode 100644
index 0000000..6a5ca66
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sth.s
@@ -0,0 +1,11 @@
+# Source file used to test the sth.n instruction
+
+foo:
+ sth.n r4,0(r17)
+ sth.n r4,4(r17)
+ sth.n r4,0xe(r17)
+ sth.n r4,0x1e(r17)
+ sth.n r4,0(r5)
+ sth.n r4,4(r5)
+ sth.n r4,0xe(r5)
+ sth.n r4,0x1e(r5)
diff --git a/gas/testsuite/gas/nios2/cdx_stw.d b/gas/testsuite/gas/nios2/cdx_stw.d
new file mode 100644
index 0000000..cc70958
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stw.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX stw.n
+#as: -march=r2
+
+# Test the stw.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0875 stw.n r4,0\(r17\)
+0+0002 <[^>]*> 1875 stw.n r4,4\(r17\)
+0+0004 <[^>]*> 7875 stw.n r4,28\(r17\)
+0+0006 <[^>]*> f875 stw.n r4,60\(r17\)
+0+0008 <[^>]*> 0975 stw.n r4,0\(r5\)
+0+000a <[^>]*> 1975 stw.n r4,4\(r5\)
+0+000c <[^>]*> 7975 stw.n r4,28\(r5\)
+0+000e <[^>]*> f975 stw.n r4,60\(r5\)
+0+0010 <[^>]*> 001d stwz.n zero,0\(r16\)
+0+0012 <[^>]*> 001d stwz.n zero,0\(r16\)
+0+0014 <[^>]*> 7e1d stwz.n zero,252\(r16\)
+0+0016 <[^>]*> 7fdd stwz.n zero,252\(r7\)
diff --git a/gas/testsuite/gas/nios2/cdx_stw.s b/gas/testsuite/gas/nios2/cdx_stw.s
new file mode 100644
index 0000000..d17fd6a
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stw.s
@@ -0,0 +1,15 @@
+# Source file used to test the stw.n instruction
+
+foo:
+ stw.n r4,0(r17)
+ stw.n r4,4(r17)
+ stw.n r4,0x1c(r17)
+ stw.n r4,0x3c(r17)
+ stw.n r4,0(r5)
+ stw.n r4,4(r5)
+ stw.n r4,0x1c(r5)
+ stw.n r4,0x3c(r5)
+ stwz.n zero,0(r16)
+ stwz.n r0,0(r16)
+ stwz.n zero,252(r16)
+ stwz.n zero,252(r7)
diff --git a/gas/testsuite/gas/nios2/cdx_stwsp.d b/gas/testsuite/gas/nios2/cdx_stwsp.d
new file mode 100644
index 0000000..bc89b6c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stwsp.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX stwsp.n
+#as: -march=r2
+
+# Test the stwsp.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 2033 stwsp.n r4,0\(sp\)
+0+0002 <[^>]*> 2073 stwsp.n r4,4\(sp\)
+0+0004 <[^>]*> 23f3 stwsp.n r4,60\(sp\)
+0+0006 <[^>]*> 27f3 stwsp.n r4,124\(sp\)
diff --git a/gas/testsuite/gas/nios2/cdx_stwsp.s b/gas/testsuite/gas/nios2/cdx_stwsp.s
new file mode 100644
index 0000000..6ed8be3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_stwsp.s
@@ -0,0 +1,7 @@
+# Source file used to test the stwsp.n instruction
+
+foo:
+ stwsp.n r4,0(sp)
+ stwsp.n r4,4(sp)
+ stwsp.n r4,0x3c(sp)
+ stwsp.n r4,0x7c(sp)
diff --git a/gas/testsuite/gas/nios2/cdx_sub.d b/gas/testsuite/gas/nios2/cdx_sub.d
new file mode 100644
index 0000000..54434b0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sub.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX sub.n
+#as: -march=r2
+
+# Test the sub.n and subi.n instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c901 sub.n r4,r4,r4
+0+0002 <[^>]*> 8911 subi.n r4,r4,1
+0+0004 <[^>]*> 9911 subi.n r4,r4,2
+0+0006 <[^>]*> a911 subi.n r4,r4,4
+0+0008 <[^>]*> b911 subi.n r4,r4,8
+0+000a <[^>]*> c911 subi.n r4,r4,16
+0+000c <[^>]*> d911 subi.n r4,r4,32
+0+000e <[^>]*> e911 subi.n r4,r4,64
+0+0010 <[^>]*> f911 subi.n r4,r4,128
+ ...
diff --git a/gas/testsuite/gas/nios2/cdx_sub.s b/gas/testsuite/gas/nios2/cdx_sub.s
new file mode 100644
index 0000000..53470ee
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_sub.s
@@ -0,0 +1,12 @@
+# Source file used to test the sub and subi instructions.
+
+foo:
+ sub.n r4,r4,r4
+ subi.n r4,r4,1
+ subi.n r4,r4,2
+ subi.n r4,r4,4
+ subi.n r4,r4,8
+ subi.n r4,r4,16
+ subi.n r4,r4,32
+ subi.n r4,r4,64
+ subi.n r4,r4,128
diff --git a/gas/testsuite/gas/nios2/cdx_trap.d b/gas/testsuite/gas/nios2/cdx_trap.d
new file mode 100644
index 0000000..bd65d01
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_trap.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX trap
+#as: -march=r2
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> d009 trap.n 0
+0+0002 <[^>]*> d009 trap.n 0
+0+0004 <[^>]*> d7c9 trap.n 31
+0+0006 <[^>]*> d389 trap.n 14
diff --git a/gas/testsuite/gas/nios2/cdx_trap.s b/gas/testsuite/gas/nios2/cdx_trap.s
new file mode 100644
index 0000000..1714edb
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_trap.s
@@ -0,0 +1,8 @@
+# Source file used to test the CDX trap.n instructions
+foo:
+ trap.n
+ trap.n 0
+ trap.n 31
+ trap.n 14
+
+
diff --git a/gas/testsuite/gas/nios2/cdx_xor.d b/gas/testsuite/gas/nios2/cdx_xor.d
new file mode 100644
index 0000000..fa47dbf
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_xor.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 CDX xor.n
+#as: -march=r2
+
+# Test the xor.n instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 3909 xor.n r4,r4,r4
+0+0002 <[^>]*> 3e49 xor.n r17,r17,r7
+0+0004 <[^>]*> 33c9 xor.n r7,r7,r17
+0+0006 <[^>]*> 3fc9 xor.n r7,r7,r7
diff --git a/gas/testsuite/gas/nios2/cdx_xor.s b/gas/testsuite/gas/nios2/cdx_xor.s
new file mode 100644
index 0000000..20e9776
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cdx_xor.s
@@ -0,0 +1,7 @@
+# Source file used to test the xor.n instructions.
+
+foo:
+ xor.n r4,r4,r4
+ xor.n r17,r17,r7
+ xor.n r7,r7,r17
+ xor.n r7,r7,r7
diff --git a/gas/testsuite/gas/nios2/cmp-r2.d b/gas/testsuite/gas/nios2/cmp-r2.d
new file mode 100644
index 0000000..247bdf2
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cmp-r2.d
@@ -0,0 +1,26 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 cmp
+#as: -march=r2
+#source: cmp.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> a00b18a0 cmpeq r11,r2,r3
+0+0004 <[^>]*> 400b18a0 cmpge r11,r2,r3
+0+0008 <[^>]*> c00b18a0 cmpgeu r11,r2,r3
+0+000c <[^>]*> 600b18a0 cmplt r11,r2,r3
+0+0010 <[^>]*> e00b18a0 cmpltu r11,r2,r3
+0+0014 <[^>]*> 800b18a0 cmpne r11,r2,r3
+0+0018 <[^>]*> 00005896 cmpgei r11,r2,0
+[ ]*18: R_NIOS2_S16 value
+0+001c <[^>]*> 000058b6 cmpgeui r11,r2,0
+[ ]*1c: R_NIOS2_U16 value\+0x200
+0+0020 <[^>]*> 0000589e cmplti r11,r2,0
+[ ]*20: R_NIOS2_S16 value
+0+0024 <[^>]*> 000058be cmpltui r11,r2,0
+[ ]*24: R_NIOS2_U16 value\+0x200
+0+0028 <[^>]*> 7fff5896 cmpgei r11,r2,32767
+0+002c <[^>]*> 800058b6 cmpgeui r11,r2,32768
+0+0030 <[^>]*> 8000589e cmplti r11,r2,-32768
+0+0034 <[^>]*> ffff58be cmpltui r11,r2,65535
diff --git a/gas/testsuite/gas/nios2/comments-r2.d b/gas/testsuite/gas/nios2/comments-r2.d
new file mode 100644
index 0000000..5511242
--- /dev/null
+++ b/gas/testsuite/gas/nios2/comments-r2.d
@@ -0,0 +1,28 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 comments
+#as: -march=r2
+#source: comments.s
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00180002 br 0000001c <start>
+0+0004 <[^>]*> 00000002 br 00000008 <abort>
+0+0008 <[^>]*> 00001814 movui r3,0
+0+000c <[^>]*> 00011014 movui r2,1
+0+0010 <[^>]*> 00001814 movui r3,0
+0+0014 <[^>]*> 00001014 movui r2,0
+0+0018 <[^>]*> 00280002 br 00000044 <exit>
+0+001c <[^>]*> fffc1084 addi r2,r2,-4
+0+0020 <[^>]*> 00015814 movui r11,1
+0+0024 <[^>]*> 00002814 movui r5,0
+0+0028 <[^>]*> 00003014 movui r6,0
+0+002c <[^>]*> 00000002 br 00000030 <ldst>
+0+0030 <[^>]*> f00c1014 movui r2,61452
+0+0034 <[^>]*> facea014 movui r20,64206
+0+0038 <[^>]*> 0000a0b7 stw r20,0\(r2\)
+0+003c <[^>]*> 0000a897 ldw r21,0\(r2\)
+0+0040 <[^>]*> ffcc0002 br 00000010 <end>
+0+0044 <[^>]*> fffc0002 br 00000044 <exit>
diff --git a/gas/testsuite/gas/nios2/complex-r2.d b/gas/testsuite/gas/nios2/complex-r2.d
new file mode 100644
index 0000000..8b51be1
--- /dev/null
+++ b/gas/testsuite/gas/nios2/complex-r2.d
@@ -0,0 +1,14 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 complex
+#as: -march=r2
+#source: complex.s
+
+# Test complex expression parsing
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ffff10d7 ldw r2,-1\(r3\)
+0+0004 <[^>]*> 000110d7 ldw r2,1\(r3\)
+0+0008 <[^>]*> 000010d7 ldw r2,0\(r3\)
+ 8: R_NIOS2_S16 stack_top-0x1
diff --git a/gas/testsuite/gas/nios2/ctl-r2.d b/gas/testsuite/gas/nios2/ctl-r2.d
new file mode 100644
index 0000000..27edd3d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ctl-r2.d
@@ -0,0 +1,22 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 ctl
+#as: -march=r2
+#source: ctl.s
+
+# Test the ctl instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 9be80020 rdctl r8,ctl31
+0+0004 <[^>]*> 9bc80020 rdctl r8,ctl30
+0+0008 <[^>]*> 9ba80020 rdctl r8,ctl29
+0+000c <[^>]*> 98080020 rdctl r8,status
+0+0010 <[^>]*> 98480020 rdctl r8,bstatus
+0+0014 <[^>]*> 98280020 rdctl r8,estatus
+0+0018 <[^>]*> bbe00220 wrctl ctl31,r8
+0+001c <[^>]*> bbc00220 wrctl ctl30,r8
+0+0020 <[^>]*> bba00220 wrctl ctl29,r8
+0+0024 <[^>]*> b8000220 wrctl status,r8
+0+0028 <[^>]*> b8400220 wrctl bstatus,r8
+0+002c <[^>]*> b8200220 wrctl estatus,r8
diff --git a/gas/testsuite/gas/nios2/custom-r2.d b/gas/testsuite/gas/nios2/custom-r2.d
new file mode 100644
index 0000000..005258e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/custom-r2.d
@@ -0,0 +1,15 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 custom
+#as: -march=r2
+#source: custom.s
+
+# Test the custom instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00eb18b0 custom 0,r11,r2,r3
+0+0004 <[^>]*> ffeb18b0 custom 255,r11,r2,r3
+0+0008 <[^>]*> 966118b0 custom 150,c1,r2,r3
+0+000c <[^>]*> 184118b0 custom 24,c1,c2,r3
+0+0010 <[^>]*> 380118b0 custom 56,c1,c2,c3
diff --git a/gas/testsuite/gas/nios2/eni.d b/gas/testsuite/gas/nios2/eni.d
new file mode 100644
index 0000000..905a72b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/eni.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 eni
+#as: -march=r2
+
+# Test the eni instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 20000020 eni 0
+0+0004 <[^>]*> 20000020 eni 0
+0+0008 <[^>]*> 20200020 eni 1
diff --git a/gas/testsuite/gas/nios2/eni.s b/gas/testsuite/gas/nios2/eni.s
new file mode 100644
index 0000000..5c136c5
--- /dev/null
+++ b/gas/testsuite/gas/nios2/eni.s
@@ -0,0 +1,7 @@
+# Source file used to test the eni instruction.
+
+foo:
+ eni
+ eni 0
+ eni 1
+
\ No newline at end of file
diff --git a/gas/testsuite/gas/nios2/etbt-r2.d b/gas/testsuite/gas/nios2/etbt-r2.d
new file mode 100644
index 0000000..d778f0b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/etbt-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 etbt
+#as: -march=r2
+#source: etbt.s
+
+# Test the et, bt registers
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c4183660 add et,bt,r6
+0+0004 <[^>]*> c4183660 add et,bt,r6
diff --git a/gas/testsuite/gas/nios2/flushda-r2.d b/gas/testsuite/gas/nios2/flushda-r2.d
new file mode 100644
index 0000000..34444ee
--- /dev/null
+++ b/gas/testsuite/gas/nios2/flushda-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 flushda
+#as: -march=r2
+#source: flushda.s
+
+# Test the jmp instruction.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 300c18a8 flushda 12\(r2\)
+
diff --git a/gas/testsuite/gas/nios2/jmp-r2.d b/gas/testsuite/gas/nios2/jmp-r2.d
new file mode 100644
index 0000000..b57a9b6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/jmp-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 jmp
+#as: -march=r2
+#source: jmp.s
+
+# Test the jmp instruction.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 34000660 jmp bt
+
diff --git a/gas/testsuite/gas/nios2/ldb-r2.d b/gas/testsuite/gas/nios2/ldb-r2.d
new file mode 100644
index 0000000..76989fa
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldb-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 ldb
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00002007 ldb r4,0\(zero\)
+0+0004 <[^>]*> 00042007 ldb r4,4\(zero\)
+0+0008 <[^>]*> 7ffc2007 ldb r4,32764\(zero\)
+0+000c <[^>]*> 80002007 ldb r4,-32768\(zero\)
+0+0010 <[^>]*> 00002147 ldb r4,0\(r5\)
+0+0014 <[^>]*> 00042147 ldb r4,4\(r5\)
+0+0018 <[^>]*> 7ffc2147 ldb r4,32764\(r5\)
+0+001c <[^>]*> 80002147 ldb r4,-32768\(r5\)
+0+0020 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> 00002007 ldb r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> 00002147 ldb r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> 00002028 ldbio r4,0\(zero\)
+0+00d0 <[^>]*> 00042028 ldbio r4,4\(zero\)
+0+00d4 <[^>]*> 07fc2028 ldbio r4,2044\(zero\)
+0+00d8 <[^>]*> 08002028 ldbio r4,-2048\(zero\)
+0+00dc <[^>]*> 00002168 ldbio r4,0\(r5\)
+0+00e0 <[^>]*> 00042168 ldbio r4,4\(r5\)
+0+00e4 <[^>]*> 07fc2168 ldbio r4,2044\(r5\)
+0+00e8 <[^>]*> 08002168 ldbio r4,-2048\(r5\)
+0+00ec <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x4000
+0+0108 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x4004
+0+0124 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss\+0x3800
+0+0140 <[^>]*> 00002028 ldbio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x4000
+0+0160 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x4004
+0+017c <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 00002168 ldbio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss\+0x3800
diff --git a/gas/testsuite/gas/nios2/ldb-r2.s b/gas/testsuite/gas/nios2/ldb-r2.s
new file mode 100644
index 0000000..8d567bf
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldb-r2.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
+ .extern big_external_data_label,0x4000
+ .extern small_external_data_label,4
+ .comm big_external_common,0x4000
+ .comm small_external_common,4
+ .lcomm big_local_common,0x4000
+ .lcomm small_local_common,4
+
+# the small symbols should have space allocated in the sbss section
+# but this is not yet supported in the assembler, so space is allocated
+# in the .bss section and the relocations are not gp-relative. this will
+# be updated when gp-relative relocations are added
+ .text
+ ldb r4,0(r0)
+ ldb r4,4(r0)
+ ldb r4,0x7ffc(r0)
+ ldb r4,-0x8000(r0)
+ ldb r4,0(r5)
+ ldb r4,4(r5)
+ ldb r4,0x7ffc(r5)
+ ldb r4,-0x8000(r5)
+ ldb r4,data_label(r0)
+ ldb r4,big_external_data_label(r0)
+ ldb r4,small_external_data_label(r0)
+ ldb r4,big_external_common(r0)
+ ldb r4,small_external_common(r0)
+ ldb r4,big_local_common(r0)
+ ldb r4,small_local_common(r0)
+ ldb r4,data_label+4(r0)
+ ldb r4,big_external_data_label+4(r0)
+ ldb r4,small_external_data_label+4(r0)
+ ldb r4,big_external_common+4(r0)
+ ldb r4,small_external_common+4(r0)
+ ldb r4,big_local_common+4(r0)
+ ldb r4,small_local_common+4(r0)
+ ldb r4,data_label-0x8000(r0)
+ ldb r4,big_external_data_label-0x8000(r0)
+ ldb r4,small_external_data_label-0x8000(r0)
+ ldb r4,big_external_common-0x8000(r0)
+ ldb r4,small_external_common-0x8000(r0)
+ ldb r4,big_local_common-0x8000(r0)
+ ldb r4,small_local_common-0x8000(r0)
+ ldb r4,data_label+0x10000(r0)
+ ldb r4,data_label(r5)
+ ldb r4,big_external_data_label(r5)
+ ldb r4,small_external_data_label(r5)
+ ldb r4,big_external_common(r5)
+ ldb r4,small_external_common(r5)
+ ldb r4,big_local_common(r5)
+ ldb r4,small_local_common(r5)
+ ldb r4,data_label+4(r5)
+ ldb r4,big_external_data_label+4(r5)
+ ldb r4,small_external_data_label+4(r5)
+ ldb r4,big_external_common+4(r5)
+ ldb r4,small_external_common+4(r5)
+ ldb r4,big_local_common+4(r5)
+ ldb r4,small_local_common+4(r5)
+ ldb r4,data_label-0x8000(r5)
+ ldb r4,big_external_data_label-0x8000(r5)
+ ldb r4,small_external_data_label-0x8000(r5)
+ ldb r4,big_external_common-0x8000(r5)
+ ldb r4,small_external_common-0x8000(r5)
+ ldb r4,big_local_common-0x8000(r5)
+ ldb r4,small_local_common-0x8000(r5)
+
+ ldbio r4,0(r0)
+ ldbio r4,4(r0)
+ ldbio r4,0x7fc(r0)
+ ldbio r4,-0x800(r0)
+ ldbio r4,0(r5)
+ ldbio r4,4(r5)
+ ldbio r4,0x7fc(r5)
+ ldbio r4,-0x800(r5)
+ ldbio r4,data_label(r0)
+ ldbio r4,big_external_data_label(r0)
+ ldbio r4,small_external_data_label(r0)
+ ldbio r4,big_external_common(r0)
+ ldbio r4,small_external_common(r0)
+ ldbio r4,big_local_common(r0)
+ ldbio r4,small_local_common(r0)
+ ldbio r4,data_label+4(r0)
+ ldbio r4,big_external_data_label+4(r0)
+ ldbio r4,small_external_data_label+4(r0)
+ ldbio r4,big_external_common+4(r0)
+ ldbio r4,small_external_common+4(r0)
+ ldbio r4,big_local_common+4(r0)
+ ldbio r4,small_local_common+4(r0)
+ ldbio r4,data_label-0x800(r0)
+ ldbio r4,big_external_data_label-0x800(r0)
+ ldbio r4,small_external_data_label-0x800(r0)
+ ldbio r4,big_external_common-0x800(r0)
+ ldbio r4,small_external_common-0x800(r0)
+ ldbio r4,big_local_common-0x800(r0)
+ ldbio r4,small_local_common-0x800(r0)
+ ldbio r4,data_label+0x10000(r0)
+ ldbio r4,data_label(r5)
+ ldbio r4,big_external_data_label(r5)
+ ldbio r4,small_external_data_label(r5)
+ ldbio r4,big_external_common(r5)
+ ldbio r4,small_external_common(r5)
+ ldbio r4,big_local_common(r5)
+ ldbio r4,small_local_common(r5)
+ ldbio r4,data_label+4(r5)
+ ldbio r4,big_external_data_label+4(r5)
+ ldbio r4,small_external_data_label+4(r5)
+ ldbio r4,big_external_common+4(r5)
+ ldbio r4,small_external_common+4(r5)
+ ldbio r4,big_local_common+4(r5)
+ ldbio r4,small_local_common+4(r5)
+ ldbio r4,data_label-0x800(r5)
+ ldbio r4,big_external_data_label-0x800(r5)
+ ldbio r4,small_external_data_label-0x800(r5)
+ ldbio r4,big_external_common-0x800(r5)
+ ldbio r4,small_external_common-0x800(r5)
+ ldbio r4,big_local_common-0x800(r5)
+ ldbio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/ldh-r2.d b/gas/testsuite/gas/nios2/ldh-r2.d
new file mode 100644
index 0000000..d62f2c8
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldh-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 ldh
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0000200f ldh r4,0\(zero\)
+0+0004 <[^>]*> 0004200f ldh r4,4\(zero\)
+0+0008 <[^>]*> 07fc200f ldh r4,2044\(zero\)
+0+000c <[^>]*> f800200f ldh r4,-2048\(zero\)
+0+0010 <[^>]*> 0000214f ldh r4,0\(r5\)
+0+0014 <[^>]*> 0004214f ldh r4,4\(r5\)
+0+0018 <[^>]*> 07fc214f ldh r4,2044\(r5\)
+0+001c <[^>]*> f800214f ldh r4,-2048\(r5\)
+0+0020 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x400
+0+003c <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x404
+0+0058 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x800
+0+005c <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x800
+0+0060 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x800
+0+0064 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x800
+0+0068 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x800
+0+006c <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x800
+0+0070 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x400
+0+0074 <[^>]*> 0000200f ldh r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x400
+0+0094 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x404
+0+00b0 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x800
+0+00b4 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x800
+0+00b8 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x800
+0+00bc <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x800
+0+00c0 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x800
+0+00c4 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x800
+0+00c8 <[^>]*> 0000214f ldh r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x400
+0+00cc <[^>]*> 40002028 ldhio r4,0\(zero\)
+0+00d0 <[^>]*> 40042028 ldhio r4,4\(zero\)
+0+00d4 <[^>]*> 47fc2028 ldhio r4,2044\(zero\)
+0+00d8 <[^>]*> 48002028 ldhio r4,-2048\(zero\)
+0+00dc <[^>]*> 40002168 ldhio r4,0\(r5\)
+0+00e0 <[^>]*> 40042168 ldhio r4,4\(r5\)
+0+00e4 <[^>]*> 47fc2168 ldhio r4,2044\(r5\)
+0+00e8 <[^>]*> 48002168 ldhio r4,-2048\(r5\)
+0+00ec <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x400
+0+0108 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x404
+0+0124 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss-0x400
+0+0140 <[^>]*> 40002028 ldhio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x400
+0+0160 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x404
+0+017c <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 40002168 ldhio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss-0x400
diff --git a/gas/testsuite/gas/nios2/ldh-r2.s b/gas/testsuite/gas/nios2/ldh-r2.s
new file mode 100644
index 0000000..04098f4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldh-r2.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
+ .extern big_external_data_label,0x400
+ .extern small_external_data_label,4
+ .comm big_external_common,0x400
+ .comm small_external_common,4
+ .lcomm big_local_common,0x400
+ .lcomm small_local_common,4
+
+# the small symbols should have space allocated in the sbss section
+# but this is not yet supported in the assembler, so space is allocated
+# in the .bss section and the relocations are not gp-relative. this will
+# be updated when gp-relative relocations are added
+ .text
+ ldh r4,0(r0)
+ ldh r4,4(r0)
+ ldh r4,0x7fc(r0)
+ ldh r4,-0x800(r0)
+ ldh r4,0(r5)
+ ldh r4,4(r5)
+ ldh r4,0x7fc(r5)
+ ldh r4,-0x800(r5)
+ ldh r4,data_label(r0)
+ ldh r4,big_external_data_label(r0)
+ ldh r4,small_external_data_label(r0)
+ ldh r4,big_external_common(r0)
+ ldh r4,small_external_common(r0)
+ ldh r4,big_local_common(r0)
+ ldh r4,small_local_common(r0)
+ ldh r4,data_label+4(r0)
+ ldh r4,big_external_data_label+4(r0)
+ ldh r4,small_external_data_label+4(r0)
+ ldh r4,big_external_common+4(r0)
+ ldh r4,small_external_common+4(r0)
+ ldh r4,big_local_common+4(r0)
+ ldh r4,small_local_common+4(r0)
+ ldh r4,data_label-0x800(r0)
+ ldh r4,big_external_data_label-0x800(r0)
+ ldh r4,small_external_data_label-0x800(r0)
+ ldh r4,big_external_common-0x800(r0)
+ ldh r4,small_external_common-0x800(r0)
+ ldh r4,big_local_common-0x800(r0)
+ ldh r4,small_local_common-0x800(r0)
+ ldh r4,data_label+0x10000(r0)
+ ldh r4,data_label(r5)
+ ldh r4,big_external_data_label(r5)
+ ldh r4,small_external_data_label(r5)
+ ldh r4,big_external_common(r5)
+ ldh r4,small_external_common(r5)
+ ldh r4,big_local_common(r5)
+ ldh r4,small_local_common(r5)
+ ldh r4,data_label+4(r5)
+ ldh r4,big_external_data_label+4(r5)
+ ldh r4,small_external_data_label+4(r5)
+ ldh r4,big_external_common+4(r5)
+ ldh r4,small_external_common+4(r5)
+ ldh r4,big_local_common+4(r5)
+ ldh r4,small_local_common+4(r5)
+ ldh r4,data_label-0x800(r5)
+ ldh r4,big_external_data_label-0x800(r5)
+ ldh r4,small_external_data_label-0x800(r5)
+ ldh r4,big_external_common-0x800(r5)
+ ldh r4,small_external_common-0x800(r5)
+ ldh r4,big_local_common-0x800(r5)
+ ldh r4,small_local_common-0x800(r5)
+
+ ldhio r4,0(r0)
+ ldhio r4,4(r0)
+ ldhio r4,0x7fc(r0)
+ ldhio r4,-0x800(r0)
+ ldhio r4,0(r5)
+ ldhio r4,4(r5)
+ ldhio r4,0x7fc(r5)
+ ldhio r4,-0x800(r5)
+ ldhio r4,data_label(r0)
+ ldhio r4,big_external_data_label(r0)
+ ldhio r4,small_external_data_label(r0)
+ ldhio r4,big_external_common(r0)
+ ldhio r4,small_external_common(r0)
+ ldhio r4,big_local_common(r0)
+ ldhio r4,small_local_common(r0)
+ ldhio r4,data_label+4(r0)
+ ldhio r4,big_external_data_label+4(r0)
+ ldhio r4,small_external_data_label+4(r0)
+ ldhio r4,big_external_common+4(r0)
+ ldhio r4,small_external_common+4(r0)
+ ldhio r4,big_local_common+4(r0)
+ ldhio r4,small_local_common+4(r0)
+ ldhio r4,data_label-0x800(r0)
+ ldhio r4,big_external_data_label-0x800(r0)
+ ldhio r4,small_external_data_label-0x800(r0)
+ ldhio r4,big_external_common-0x800(r0)
+ ldhio r4,small_external_common-0x800(r0)
+ ldhio r4,big_local_common-0x800(r0)
+ ldhio r4,small_local_common-0x800(r0)
+ ldhio r4,data_label+0x10000(r0)
+ ldhio r4,data_label(r5)
+ ldhio r4,big_external_data_label(r5)
+ ldhio r4,small_external_data_label(r5)
+ ldhio r4,big_external_common(r5)
+ ldhio r4,small_external_common(r5)
+ ldhio r4,big_local_common(r5)
+ ldhio r4,small_local_common(r5)
+ ldhio r4,data_label+4(r5)
+ ldhio r4,big_external_data_label+4(r5)
+ ldhio r4,small_external_data_label+4(r5)
+ ldhio r4,big_external_common+4(r5)
+ ldhio r4,small_external_common+4(r5)
+ ldhio r4,big_local_common+4(r5)
+ ldhio r4,small_local_common+4(r5)
+ ldhio r4,data_label-0x800(r5)
+ ldhio r4,big_external_data_label-0x800(r5)
+ ldhio r4,small_external_data_label-0x800(r5)
+ ldhio r4,big_external_common-0x800(r5)
+ ldhio r4,small_external_common-0x800(r5)
+ ldhio r4,big_local_common-0x800(r5)
+ ldhio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/ldw-r2.d b/gas/testsuite/gas/nios2/ldw-r2.d
new file mode 100644
index 0000000..cdf52f3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldw-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 ldw
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00002017 ldw r4,0\(zero\)
+0+0004 <[^>]*> 00042017 ldw r4,4\(zero\)
+0+0008 <[^>]*> 07fc2017 ldw r4,2044\(zero\)
+0+000c <[^>]*> f8002017 ldw r4,-2048\(zero\)
+0+0010 <[^>]*> 00002157 ldw r4,0\(r5\)
+0+0014 <[^>]*> 00042157 ldw r4,4\(r5\)
+0+0018 <[^>]*> 07fc2157 ldw r4,2044\(r5\)
+0+001c <[^>]*> f8002157 ldw r4,-2048\(r5\)
+0+0020 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x400
+0+003c <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x404
+0+0058 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x800
+0+005c <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x800
+0+0060 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x800
+0+0064 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x800
+0+0068 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x800
+0+006c <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x800
+0+0070 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x400
+0+0074 <[^>]*> 00002017 ldw r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x400
+0+0094 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x404
+0+00b0 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x800
+0+00b4 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x800
+0+00b8 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x800
+0+00bc <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x800
+0+00c0 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x800
+0+00c4 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x800
+0+00c8 <[^>]*> 00002157 ldw r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x400
+0+00cc <[^>]*> 80002028 ldwio r4,0\(zero\)
+0+00d0 <[^>]*> 80042028 ldwio r4,4\(zero\)
+0+00d4 <[^>]*> 87fc2028 ldwio r4,2044\(zero\)
+0+00d8 <[^>]*> 88002028 ldwio r4,-2048\(zero\)
+0+00dc <[^>]*> 80002168 ldwio r4,0\(r5\)
+0+00e0 <[^>]*> 80042168 ldwio r4,4\(r5\)
+0+00e4 <[^>]*> 87fc2168 ldwio r4,2044\(r5\)
+0+00e8 <[^>]*> 88002168 ldwio r4,-2048\(r5\)
+0+00ec <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x400
+0+0108 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x404
+0+0124 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss-0x400
+0+0140 <[^>]*> 80002028 ldwio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x400
+0+0160 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x404
+0+017c <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 80002168 ldwio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss-0x400
diff --git a/gas/testsuite/gas/nios2/ldw-r2.s b/gas/testsuite/gas/nios2/ldw-r2.s
new file mode 100644
index 0000000..33db49b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldw-r2.s
@@ -0,0 +1,117 @@
+ .data
+data_label:
+ .extern big_external_data_label,0x400
+ .extern small_external_data_label,4
+ .comm big_external_common,0x400
+ .comm small_external_common,4
+ .lcomm big_local_common,0x400
+ .lcomm small_local_common,4
+
+# the small symbols should have space allocated in the sbss section
+# but this is not yet supported in the assembler, so space is allocated
+# in the .bss section and the relocations are not gp-relative. this will
+# be updated when gp-relative relocations are added
+ .text
+ ldw r4,0(r0)
+ ldw r4,4(r0)
+ ldw r4,0x7fc(r0)
+ ldw r4,-0x800(r0)
+ ldw r4,0(r5)
+ ldw r4,4(r5)
+ ldw r4,0x7fc(r5)
+ ldw r4,-0x800(r5)
+ ldw r4,data_label(r0)
+ ldw r4,big_external_data_label(r0)
+ ldw r4,small_external_data_label(r0)
+ ldw r4,big_external_common(r0)
+ ldw r4,small_external_common(r0)
+ ldw r4,big_local_common(r0)
+ ldw r4,small_local_common(r0)
+ ldw r4,data_label+4(r0)
+ ldw r4,big_external_data_label+4(r0)
+ ldw r4,small_external_data_label+4(r0)
+ ldw r4,big_external_common+4(r0)
+ ldw r4,small_external_common+4(r0)
+ ldw r4,big_local_common+4(r0)
+ ldw r4,small_local_common+4(r0)
+ ldw r4,data_label-0x800(r0)
+ ldw r4,big_external_data_label-0x800(r0)
+ ldw r4,small_external_data_label-0x800(r0)
+ ldw r4,big_external_common-0x800(r0)
+ ldw r4,small_external_common-0x800(r0)
+ ldw r4,big_local_common-0x800(r0)
+ ldw r4,small_local_common-0x800(r0)
+ ldw r4,data_label+0x10000(r0)
+ ldw r4,data_label(r5)
+ ldw r4,big_external_data_label(r5)
+ ldw r4,small_external_data_label(r5)
+ ldw r4,big_external_common(r5)
+ ldw r4,small_external_common(r5)
+ ldw r4,big_local_common(r5)
+ ldw r4,small_local_common(r5)
+ ldw r4,data_label+4(r5)
+ ldw r4,big_external_data_label+4(r5)
+ ldw r4,small_external_data_label+4(r5)
+ ldw r4,big_external_common+4(r5)
+ ldw r4,small_external_common+4(r5)
+ ldw r4,big_local_common+4(r5)
+ ldw r4,small_local_common+4(r5)
+ ldw r4,data_label-0x800(r5)
+ ldw r4,big_external_data_label-0x800(r5)
+ ldw r4,small_external_data_label-0x800(r5)
+ ldw r4,big_external_common-0x800(r5)
+ ldw r4,small_external_common-0x800(r5)
+ ldw r4,big_loc[...]
[diff truncated at 100000 bytes]