aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2015-07-01 16:11:47 -0700
committerSandra Loosemore <sandra@codesourcery.com>2015-07-01 16:11:47 -0700
commit0cb5a38a5be39be9e18a1090418d3be97d6b8678 (patch)
treec8db11455d76af9dc6cfb738c89a0b95d197bfa9 /gas
parentc8c8175b623c597cf18442ff1e13456beb41931d (diff)
downloadgdb-0cb5a38a5be39be9e18a1090418d3be97d6b8678.zip
gdb-0cb5a38a5be39be9e18a1090418d3be97d6b8678.tar.gz
gdb-0cb5a38a5be39be9e18a1090418d3be97d6b8678.tar.bz2
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.
Diffstat (limited to 'gas')
-rw-r--r--gas/testsuite/ChangeLog126
-rw-r--r--gas/testsuite/gas/nios2/add-r2.d18
-rw-r--r--gas/testsuite/gas/nios2/align_fill-r2.d25
-rw-r--r--gas/testsuite/gas/nios2/align_text-r2.d24
-rw-r--r--gas/testsuite/gas/nios2/aligned_text-r2.d24
-rw-r--r--gas/testsuite/gas/nios2/and-r2.d19
-rw-r--r--gas/testsuite/gas/nios2/andc.d17
-rw-r--r--gas/testsuite/gas/nios2/andc.s12
-rw-r--r--gas/testsuite/gas/nios2/bmx.d21
-rw-r--r--gas/testsuite/gas/nios2/bmx.s15
-rw-r--r--gas/testsuite/gas/nios2/branch-r2.d23
-rw-r--r--gas/testsuite/gas/nios2/break-r2.d14
-rw-r--r--gas/testsuite/gas/nios2/bret-r2.d10
-rw-r--r--gas/testsuite/gas/nios2/cache-r2.d18
-rw-r--r--gas/testsuite/gas/nios2/cache-r2.s21
-rw-r--r--gas/testsuite/gas/nios2/call-r2.d13
-rw-r--r--gas/testsuite/gas/nios2/call26-r2.d78
-rw-r--r--gas/testsuite/gas/nios2/call26_noat-r2.d78
-rw-r--r--gas/testsuite/gas/nios2/call_noat-r2.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_add.d19
-rw-r--r--gas/testsuite/gas/nios2/cdx_add.s12
-rw-r--r--gas/testsuite/gas/nios2/cdx_and.d27
-rw-r--r--gas/testsuite/gas/nios2/cdx_and.s20
-rw-r--r--gas/testsuite/gas/nios2/cdx_break.d11
-rw-r--r--gas/testsuite/gas/nios2/cdx_break.s8
-rw-r--r--gas/testsuite/gas/nios2/cdx_callr.d9
-rw-r--r--gas/testsuite/gas/nios2/cdx_callr.s6
-rw-r--r--gas/testsuite/gas/nios2/cdx_jmpr.d11
-rw-r--r--gas/testsuite/gas/nios2/cdx_jmpr.s6
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldbu.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldbu.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldhu.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldhu.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldw.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldw.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldwsp.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_ldwsp.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_mov.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_mov.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_neg.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_neg.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_not.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_not.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_or.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_or.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_pop.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_pop.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_push.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_push.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_relax.d22
-rw-r--r--gas/testsuite/gas/nios2/cdx_relax.s27
-rw-r--r--gas/testsuite/gas/nios2/cdx_ret.d11
-rw-r--r--gas/testsuite/gas/nios2/cdx_ret.s4
-rw-r--r--gas/testsuite/gas/nios2/cdx_sll.d21
-rw-r--r--gas/testsuite/gas/nios2/cdx_sll.s14
-rw-r--r--gas/testsuite/gas/nios2/cdx_spaddi.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_spaddi.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_spdeci.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_spdeci.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_srl.d21
-rw-r--r--gas/testsuite/gas/nios2/cdx_srl.s14
-rw-r--r--gas/testsuite/gas/nios2/cdx_stb.d21
-rw-r--r--gas/testsuite/gas/nios2/cdx_stb.s15
-rw-r--r--gas/testsuite/gas/nios2/cdx_sth.d17
-rw-r--r--gas/testsuite/gas/nios2/cdx_sth.s11
-rw-r--r--gas/testsuite/gas/nios2/cdx_stw.d21
-rw-r--r--gas/testsuite/gas/nios2/cdx_stw.s15
-rw-r--r--gas/testsuite/gas/nios2/cdx_stwsp.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_stwsp.s7
-rw-r--r--gas/testsuite/gas/nios2/cdx_sub.d19
-rw-r--r--gas/testsuite/gas/nios2/cdx_sub.s12
-rw-r--r--gas/testsuite/gas/nios2/cdx_trap.d11
-rw-r--r--gas/testsuite/gas/nios2/cdx_trap.s8
-rw-r--r--gas/testsuite/gas/nios2/cdx_xor.d13
-rw-r--r--gas/testsuite/gas/nios2/cdx_xor.s7
-rw-r--r--gas/testsuite/gas/nios2/cmp-r2.d26
-rw-r--r--gas/testsuite/gas/nios2/comments-r2.d28
-rw-r--r--gas/testsuite/gas/nios2/complex-r2.d14
-rw-r--r--gas/testsuite/gas/nios2/ctl-r2.d22
-rw-r--r--gas/testsuite/gas/nios2/custom-r2.d15
-rw-r--r--gas/testsuite/gas/nios2/eni.d12
-rw-r--r--gas/testsuite/gas/nios2/eni.s7
-rw-r--r--gas/testsuite/gas/nios2/etbt-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/flushda-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/jmp-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/ldb-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/ldb-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/ldh-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/ldh-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/ldw-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/ldw-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/ldwm.d37
-rw-r--r--gas/testsuite/gas/nios2/ldwm.s31
-rw-r--r--gas/testsuite/gas/nios2/lineseparator-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/movia-r2.d22
-rw-r--r--gas/testsuite/gas/nios2/mpx.d14
-rw-r--r--gas/testsuite/gas/nios2/mpx.s9
-rw-r--r--gas/testsuite/gas/nios2/mul-r2.d21
-rw-r--r--gas/testsuite/gas/nios2/nop-r2.d11
-rw-r--r--gas/testsuite/gas/nios2/nop-r2.s8
-rw-r--r--gas/testsuite/gas/nios2/nor-r2.d11
-rw-r--r--gas/testsuite/gas/nios2/or-r2.d13
-rw-r--r--gas/testsuite/gas/nios2/rdprs-r2.d32
-rw-r--r--gas/testsuite/gas/nios2/rdprs-r2.s28
-rw-r--r--gas/testsuite/gas/nios2/registers-r2.d53
-rw-r--r--gas/testsuite/gas/nios2/ret-r2.d10
-rw-r--r--gas/testsuite/gas/nios2/rotate-r2.d19
-rw-r--r--gas/testsuite/gas/nios2/stb-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/stb-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/sth-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/sth-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/stw-r2.d197
-rw-r--r--gas/testsuite/gas/nios2/stw-r2.s117
-rw-r--r--gas/testsuite/gas/nios2/stwm.d35
-rw-r--r--gas/testsuite/gas/nios2/stwm.s29
-rw-r--r--gas/testsuite/gas/nios2/sub-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/sync-r2.d10
-rw-r--r--gas/testsuite/gas/nios2/trap-r2.d12
-rw-r--r--gas/testsuite/gas/nios2/tret-r2.d9
-rw-r--r--gas/testsuite/gas/nios2/wrpie.d20
-rw-r--r--gas/testsuite/gas/nios2/wrpie.s16
-rw-r--r--gas/testsuite/gas/nios2/wrprs-r2.d21
-rw-r--r--gas/testsuite/gas/nios2/xor-r2.d13
123 files changed, 3862 insertions, 0 deletions
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_local_common-0x800(r5)
+ ldw r4,small_local_common-0x800(r5)
+
+ ldwio r4,0(r0)
+ ldwio r4,4(r0)
+ ldwio r4,0x7fc(r0)
+ ldwio r4,-0x800(r0)
+ ldwio r4,0(r5)
+ ldwio r4,4(r5)
+ ldwio r4,0x7fc(r5)
+ ldwio r4,-0x800(r5)
+ ldwio r4,data_label(r0)
+ ldwio r4,big_external_data_label(r0)
+ ldwio r4,small_external_data_label(r0)
+ ldwio r4,big_external_common(r0)
+ ldwio r4,small_external_common(r0)
+ ldwio r4,big_local_common(r0)
+ ldwio r4,small_local_common(r0)
+ ldwio r4,data_label+4(r0)
+ ldwio r4,big_external_data_label+4(r0)
+ ldwio r4,small_external_data_label+4(r0)
+ ldwio r4,big_external_common+4(r0)
+ ldwio r4,small_external_common+4(r0)
+ ldwio r4,big_local_common+4(r0)
+ ldwio r4,small_local_common+4(r0)
+ ldwio r4,data_label-0x800(r0)
+ ldwio r4,big_external_data_label-0x800(r0)
+ ldwio r4,small_external_data_label-0x800(r0)
+ ldwio r4,big_external_common-0x800(r0)
+ ldwio r4,small_external_common-0x800(r0)
+ ldwio r4,big_local_common-0x800(r0)
+ ldwio r4,small_local_common-0x800(r0)
+ ldwio r4,data_label+0x10000(r0)
+ ldwio r4,data_label(r5)
+ ldwio r4,big_external_data_label(r5)
+ ldwio r4,small_external_data_label(r5)
+ ldwio r4,big_external_common(r5)
+ ldwio r4,small_external_common(r5)
+ ldwio r4,big_local_common(r5)
+ ldwio r4,small_local_common(r5)
+ ldwio r4,data_label+4(r5)
+ ldwio r4,big_external_data_label+4(r5)
+ ldwio r4,small_external_data_label+4(r5)
+ ldwio r4,big_external_common+4(r5)
+ ldwio r4,small_external_common+4(r5)
+ ldwio r4,big_local_common+4(r5)
+ ldwio r4,small_local_common+4(r5)
+ ldwio r4,data_label-0x800(r5)
+ ldwio r4,big_external_data_label-0x800(r5)
+ ldwio r4,small_external_data_label-0x800(r5)
+ ldwio r4,big_external_common-0x800(r5)
+ ldwio r4,small_external_common-0x800(r5)
+ ldwio r4,big_local_common-0x800(r5)
+ ldwio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/ldwm.d b/gas/testsuite/gas/nios2/ldwm.d
new file mode 100644
index 0000000..ae82a67
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldwm.d
@@ -0,0 +1,37 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 LDWM instructions
+#as: -march=r2
+
+# Test the LDWM instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> c00105e8 ldwm \{r2\},--\(r23\)
+0+0004 <[^>]*> c00205e8 ldwm \{r3\},--\(r23\)
+0+0008 <[^>]*> c00405e8 ldwm \{r4\},--\(r23\)
+0+000c <[^>]*> c00805e8 ldwm \{r5\},--\(r23\)
+0+0010 <[^>]*> c01005e8 ldwm \{r6\},--\(r23\)
+0+0014 <[^>]*> c02005e8 ldwm \{r7\},--\(r23\)
+0+0018 <[^>]*> c04005e8 ldwm \{r8\},--\(r23\)
+0+001c <[^>]*> c08005e8 ldwm \{r9\},--\(r23\)
+0+0020 <[^>]*> c10005e8 ldwm \{r10\},--\(r23\)
+0+0024 <[^>]*> c20005e8 ldwm \{r11\},--\(r23\)
+0+0028 <[^>]*> c40005e8 ldwm \{r12\},--\(r23\)
+0+002c <[^>]*> c80005e8 ldwm \{r13\},--\(r23\)
+0+0030 <[^>]*> c00128a8 ldwm \{r14\},\(r2\)\+\+
+0+0034 <[^>]*> c00328a8 ldwm \{r14,r15\},\(r2\)\+\+
+0+0038 <[^>]*> c00728a8 ldwm \{r14,r15,r16\},\(r2\)\+\+
+0+003c <[^>]*> c00f28a8 ldwm \{r14,r15,r16,r17\},\(r2\)\+\+
+0+0040 <[^>]*> c01f28a8 ldwm \{r14,r15,r16,r17,r18\},\(r2\)\+\+
+0+0044 <[^>]*> c03f28a8 ldwm \{r14,r15,r16,r17,r18,r19\},\(r2\)\+\+
+0+0048 <[^>]*> c07f28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20\},\(r2\)\+\+
+0+004c <[^>]*> c0ff28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20,r21\},\(r2\)\+\+
+0+0050 <[^>]*> c1ff28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22\},\(r2\)\+\+
+0+0054 <[^>]*> c3ff28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23\},\(r2\)\+\+
+0+0058 <[^>]*> c7ff28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp\},\(r2\)\+\+
+0+005c <[^>]*> cfff28a8 ldwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp,ra\},\(r2\)\+\+
+0+0060 <[^>]*> c2210b68 ldwm \{r2,r7,r11\},\(r13\)\+\+
+0+0064 <[^>]*> c2214b68 ldwm \{r2,r7,r11\},\(r13\)\+\+,ret
+0+0068 <[^>]*> c2211b68 ldwm \{r2,r7,r11\},\(r13\)\+\+,writeback
+0+006c <[^>]*> c2215b68 ldwm \{r2,r7,r11\},\(r13\)\+\+,writeback,ret
diff --git a/gas/testsuite/gas/nios2/ldwm.s b/gas/testsuite/gas/nios2/ldwm.s
new file mode 100644
index 0000000..e656601
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldwm.s
@@ -0,0 +1,31 @@
+# Source file used to test the LDWM instruction
+
+foo:
+ ldwm {r2},--(r23)
+ ldwm {r3},--(r23)
+ ldwm {r4},--(r23)
+ ldwm {r5},--(r23)
+ ldwm {r6},--(r23)
+ ldwm {r7},--(r23)
+ ldwm {r8},--(r23)
+ ldwm {r9},--(r23)
+ ldwm {r10},--(r23)
+ ldwm {r11},--(r23)
+ ldwm {r12},--(r23)
+ ldwm {r13},--(r23)
+ ldwm {r14},(r2)++
+ ldwm {r14,r15},(r2)++
+ ldwm {r14,r15,r16},(r2)++
+ ldwm {r14,r15,r16,r17},(r2)++
+ ldwm {r14,r15,r16,r17,r18},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20,r21},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20,r21,r22},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp},(r2)++
+ ldwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp,ra},(r2)++
+ ldwm {r2,r7,r11},(r13)++
+ ldwm {r2,r7,r11},(r13)++,ret
+ ldwm {r2,r7,r11},(r13)++,writeback
+ ldwm {r2,r7,r11},(r13)++,ret,writeback
diff --git a/gas/testsuite/gas/nios2/lineseparator-r2.d b/gas/testsuite/gas/nios2/lineseparator-r2.d
new file mode 100644
index 0000000..264f296
--- /dev/null
+++ b/gas/testsuite/gas/nios2/lineseparator-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 lineseparator
+#as: -march=r2
+#source: lineseparator.s
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0x0+0000 c4050120 mov r5,r4
+0x0+0004 c4040160 mov r4,r5
diff --git a/gas/testsuite/gas/nios2/movia-r2.d b/gas/testsuite/gas/nios2/movia-r2.d
new file mode 100644
index 0000000..e4c78a8
--- /dev/null
+++ b/gas/testsuite/gas/nios2/movia-r2.d
@@ -0,0 +1,22 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 movia
+#as: -march=r2
+#source: movia.s
+
+# Test the movia instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 80811034 movhi r2,32897
+0+0004 <[^>]*> 80801084 addi r2,r2,-32640
+0+0008 <[^>]*> 00001834 movhi r3,0
+ 8: R_NIOS2_HIADJ16 sym-0x80000000
+0+000c <[^>]*> 000018c4 addi r3,r3,0
+ c: R_NIOS2_LO16 sym-0x80000000
+0+0010 <[^>]*> 00002034 movhi r4,0
+ 10: R_NIOS2_HIADJ16 sym-0x7fffffff
+0+0014 <[^>]*> 00002104 addi r4,r4,0
+ 14: R_NIOS2_LO16 sym-0x7fffffff
+0+0018 <[^>]*> 00001034 movhi r2,0
+0+001c <[^>]*> fff01084 addi r2,r2,-16
diff --git a/gas/testsuite/gas/nios2/mpx.d b/gas/testsuite/gas/nios2/mpx.d
new file mode 100644
index 0000000..5d03d27
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mpx.d
@@ -0,0 +1,14 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 mpx
+#as: -march=r2
+
+# Test the MPX instructions
+
+.*: +file format elf32-littlenios2
+Disassembly of section .text:
+0+0000 <[^>]*> dc000020 ldsex zero,\(zero\)
+0+0004 <[^>]*> dc0007e0 ldsex zero,\(ra\)
+0+0008 <[^>]*> dc1f0020 ldsex ra,\(zero\)
+0+000c <[^>]*> fc000020 stsex zero,zero,\(zero\)
+0+0010 <[^>]*> fc1fffe0 stsex ra,ra,\(ra\)
+0+0014 <[^>]*> fc04fc20 stsex r4,ra,\(r16\)
diff --git a/gas/testsuite/gas/nios2/mpx.s b/gas/testsuite/gas/nios2/mpx.s
new file mode 100644
index 0000000..925c307
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mpx.s
@@ -0,0 +1,9 @@
+# Source file used to test the BMX instruction
+
+foo:
+ ldsex r0,(r0)
+ ldsex r0,(r31)
+ ldsex r31,(r0)
+ stsex r0,r0,(r0)
+ stsex r31,r31,(r31)
+ stsex r4,r31,(r16)
diff --git a/gas/testsuite/gas/nios2/mul-r2.d b/gas/testsuite/gas/nios2/mul-r2.d
new file mode 100644
index 0000000..1e68d53
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mul-r2.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 mul
+#as: -march=r2
+#source: mul.s
+
+# Test the mul macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 9c043160 mul r4,r5,r6
+0+0004 <[^>]*> 00002164 muli r4,r5,0
+0+0008 <[^>]*> 00012164 muli r4,r5,1
+0+000c <[^>]*> 80002164 muli r4,r5,-32768
+0+0010 <[^>]*> 7fff2164 muli r4,r5,32767
+0+0014 <[^>]*> 00002164 muli r4,r5,0
+[ ]*14: R_NIOS2_S16 undefined_symbol
+0+0018 <[^>]*> 40402164 muli r4,r5,16448
+0+001c <[^>]*> 7c043160 mulxss r4,r5,r6
+0+0020 <[^>]*> 5c043160 mulxsu r4,r5,r6
+0+0024 <[^>]*> 1c043160 mulxuu r4,r5,r6
diff --git a/gas/testsuite/gas/nios2/nop-r2.d b/gas/testsuite/gas/nios2/nop-r2.d
new file mode 100644
index 0000000..a323106
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nop-r2.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 nop.n
+#as: -march=r2
+
+# Test the nop.n pseudo-instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 003b nop.n
+ ...
diff --git a/gas/testsuite/gas/nios2/nop-r2.s b/gas/testsuite/gas/nios2/nop-r2.s
new file mode 100644
index 0000000..f6fd527
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nop-r2.s
@@ -0,0 +1,8 @@
+ .section .text
+ .align 2
+ .global foo
+ .type foo, @function
+foo:
+ nop.n
+ .section .text
+ .size foo, .-foo
diff --git a/gas/testsuite/gas/nios2/nor-r2.d b/gas/testsuite/gas/nios2/nor-r2.d
new file mode 100644
index 0000000..a136dbb
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nor-r2.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 nor
+#as: -march=r2
+#source: nor.s
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 18065220 nor r6,r8,r10
diff --git a/gas/testsuite/gas/nios2/or-r2.d b/gas/testsuite/gas/nios2/or-r2.d
new file mode 100644
index 0000000..dfa10f8
--- /dev/null
+++ b/gas/testsuite/gas/nios2/or-r2.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 or
+#as: -march=r2
+#source: or.s
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 58065220 or r6,r8,r10
+0+0004 <[^>]*> ffff31f4 orhi r6,r7,65535
+0+0008 <[^>]*> ffff31d4 ori r6,r7,65535
diff --git a/gas/testsuite/gas/nios2/rdprs-r2.d b/gas/testsuite/gas/nios2/rdprs-r2.d
new file mode 100644
index 0000000..5caebcc
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rdprs-r2.d
@@ -0,0 +1,32 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 rdprs
+#as: -march=r2
+
+# Test the rdprs instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 70000028 rdprs zero,zero,0
+0+0004 <[^>]*> 70010028 rdprs zero,zero,1
+0+0008 <[^>]*> 70020028 rdprs zero,zero,2
+0+000c <[^>]*> 70040028 rdprs zero,zero,4
+0+0010 <[^>]*> 70080028 rdprs zero,zero,8
+0+0014 <[^>]*> 70100028 rdprs zero,zero,16
+0+0018 <[^>]*> 70200028 rdprs zero,zero,32
+0+001c <[^>]*> 70400028 rdprs zero,zero,64
+0+0020 <[^>]*> 70800028 rdprs zero,zero,128
+0+0024 <[^>]*> 71000028 rdprs zero,zero,256
+0+0028 <[^>]*> 72000028 rdprs zero,zero,512
+0+002c <[^>]*> 74000028 rdprs zero,zero,1024
+0+0030 <[^>]*> 78000028 rdprs zero,zero,-2048
+0+0034 <[^>]*> 70000828 rdprs at,zero,0
+0+0038 <[^>]*> 70001028 rdprs r2,zero,0
+0+003c <[^>]*> 70002028 rdprs r4,zero,0
+0+0040 <[^>]*> 70004028 rdprs r8,zero,0
+0+0044 <[^>]*> 70008028 rdprs r16,zero,0
+0+0048 <[^>]*> 70000068 rdprs zero,at,0
+0+004c <[^>]*> 700000a8 rdprs zero,r2,0
+0+0050 <[^>]*> 70000128 rdprs zero,r4,0
+0+0054 <[^>]*> 70000228 rdprs zero,r8,0
+0+0058 <[^>]*> 70000428 rdprs zero,r16,0
diff --git a/gas/testsuite/gas/nios2/rdprs-r2.s b/gas/testsuite/gas/nios2/rdprs-r2.s
new file mode 100644
index 0000000..47d4840
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rdprs-r2.s
@@ -0,0 +1,28 @@
+# Source file used to test the rdprs instruction
+
+.set noat
+
+foo:
+ rdprs zero, zero, 0
+ rdprs zero, zero, 1
+ rdprs zero, zero, 2
+ rdprs zero, zero, 4
+ rdprs zero, zero, 8
+ rdprs zero, zero, 16
+ rdprs zero, zero, 32
+ rdprs zero, zero, 64
+ rdprs zero, zero, 128
+ rdprs zero, zero, 256
+ rdprs zero, zero, 512
+ rdprs zero, zero, 1024
+ rdprs zero, zero, -2048
+ rdprs at, zero, 0
+ rdprs r2, zero, 0
+ rdprs r4, zero, 0
+ rdprs r8, zero, 0
+ rdprs r16, zero, 0
+ rdprs zero, at, 0
+ rdprs zero, r2, 0
+ rdprs zero, r4, 0
+ rdprs zero, r8, 0
+ rdprs zero, r16, 0
diff --git a/gas/testsuite/gas/nios2/registers-r2.d b/gas/testsuite/gas/nios2/registers-r2.d
new file mode 100644
index 0000000..95ad979
--- /dev/null
+++ b/gas/testsuite/gas/nios2/registers-r2.d
@@ -0,0 +1,53 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 registers
+#as: -march=r2
+#source: registers.s
+
+# Test the register names
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 007b0004 movi zero,123
+0+0004 <[^>]*> 007b0804 movi at,123
+0+0008 <[^>]*> 007b1004 movi r2,123
+0+000c <[^>]*> 007b1804 movi r3,123
+0+0010 <[^>]*> 007b2004 movi r4,123
+0+0014 <[^>]*> 007b2804 movi r5,123
+0+0018 <[^>]*> 007b3004 movi r6,123
+0+001c <[^>]*> 007b3804 movi r7,123
+0+0020 <[^>]*> 007b4004 movi r8,123
+0+0024 <[^>]*> 007b4804 movi r9,123
+0+0028 <[^>]*> 007b5004 movi r10,123
+0+002c <[^>]*> 007b5804 movi r11,123
+0+0030 <[^>]*> 007b6004 movi r12,123
+0+0034 <[^>]*> 007b6804 movi r13,123
+0+0038 <[^>]*> 007b7004 movi r14,123
+0+003c <[^>]*> 007b7804 movi r15,123
+0+0040 <[^>]*> 007b8004 movi r16,123
+0+0044 <[^>]*> 007b8804 movi r17,123
+0+0048 <[^>]*> 007b9004 movi r18,123
+0+004c <[^>]*> 007b9804 movi r19,123
+0+0050 <[^>]*> 007ba004 movi r20,123
+0+0054 <[^>]*> 007ba804 movi r21,123
+0+0058 <[^>]*> 007bb004 movi r22,123
+0+005c <[^>]*> 007bb804 movi r23,123
+0+0060 <[^>]*> 007bc004 movi et,123
+0+0064 <[^>]*> 007bc804 movi bt,123
+0+0068 <[^>]*> 007bd004 movi gp,123
+0+006c <[^>]*> 007bd804 movi sp,123
+0+0070 <[^>]*> 007be004 movi fp,123
+0+0074 <[^>]*> 007be804 movi ea,123
+0+0078 <[^>]*> 007bf004 movi sstatus,123
+0+007c <[^>]*> 007bf804 movi ra,123
+0+0080 <[^>]*> 007b0004 movi zero,123
+0+0084 <[^>]*> 007b0804 movi at,123
+0+0088 <[^>]*> 007bc004 movi et,123
+0+008c <[^>]*> 007bc804 movi bt,123
+0+0090 <[^>]*> 007bd004 movi gp,123
+0+0094 <[^>]*> 007bd804 movi sp,123
+0+0098 <[^>]*> 007be004 movi fp,123
+0+009c <[^>]*> 007be804 movi ea,123
+0+00a0 <[^>]*> 007bf004 movi sstatus,123
+0+00a4 <[^>]*> 007bf004 movi sstatus,123
+0+00a8 <[^>]*> 007bf804 movi ra,123
diff --git a/gas/testsuite/gas/nios2/ret-r2.d b/gas/testsuite/gas/nios2/ret-r2.d
new file mode 100644
index 0000000..72d537f
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ret-r2.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 ret
+#as: -march=r2
+#source: ret.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 140007e0 ret
+
diff --git a/gas/testsuite/gas/nios2/rotate-r2.d b/gas/testsuite/gas/nios2/rotate-r2.d
new file mode 100644
index 0000000..625e2dd
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rotate-r2.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 rotate
+#source: rotate.s
+#as: -march=r2
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0c042120 rol r4,r4,r4
+0+0004 <[^>]*> 0be40120 roli r4,r4,31
+0+0008 <[^>]*> 2c042120 ror r4,r4,r4
+0+000c <[^>]*> 4c042120 sll r4,r4,r4
+0+0010 <[^>]*> 4b040120 slli r4,r4,24
+0+0014 <[^>]*> ec042120 sra r4,r4,r4
+0+0018 <[^>]*> e9440120 srai r4,r4,10
+0+001c <[^>]*> 6c042120 srl r4,r4,r4
+0+0020 <[^>]*> 68a40120 srli r4,r4,5
diff --git a/gas/testsuite/gas/nios2/stb-r2.d b/gas/testsuite/gas/nios2/stb-r2.d
new file mode 100644
index 0000000..d0285cb
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stb-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 stb
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00002027 stb r4,0\(zero\)
+0+0004 <[^>]*> 00042027 stb r4,4\(zero\)
+0+0008 <[^>]*> 07fc2027 stb r4,2044\(zero\)
+0+000c <[^>]*> f8002027 stb r4,-2048\(zero\)
+0+0010 <[^>]*> 00002167 stb r4,0\(r5\)
+0+0014 <[^>]*> 00042167 stb r4,4\(r5\)
+0+0018 <[^>]*> 07fc2167 stb r4,2044\(r5\)
+0+001c <[^>]*> f8002167 stb r4,-2048\(r5\)
+0+0020 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x400
+0+003c <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x404
+0+0058 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x800
+0+005c <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x800
+0+0060 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x800
+0+0064 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x800
+0+0068 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x800
+0+006c <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x800
+0+0070 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x400
+0+0074 <[^>]*> 00002027 stb r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x400
+0+0094 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x404
+0+00b0 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x800
+0+00b4 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x800
+0+00b8 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x800
+0+00bc <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x800
+0+00c0 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x800
+0+00c4 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x800
+0+00c8 <[^>]*> 00002167 stb r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x400
+0+00cc <[^>]*> 10002028 stbio r4,0\(zero\)
+0+00d0 <[^>]*> 10042028 stbio r4,4\(zero\)
+0+00d4 <[^>]*> 17fc2028 stbio r4,2044\(zero\)
+0+00d8 <[^>]*> 18002028 stbio r4,-2048\(zero\)
+0+00dc <[^>]*> 10002168 stbio r4,0\(r5\)
+0+00e0 <[^>]*> 10042168 stbio r4,4\(r5\)
+0+00e4 <[^>]*> 17fc2168 stbio r4,2044\(r5\)
+0+00e8 <[^>]*> 18002168 stbio r4,-2048\(r5\)
+0+00ec <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x400
+0+0108 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x404
+0+0124 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss-0x400
+0+0140 <[^>]*> 10002028 stbio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x400
+0+0160 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x404
+0+017c <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 10002168 stbio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss-0x400
diff --git a/gas/testsuite/gas/nios2/stb-r2.s b/gas/testsuite/gas/nios2/stb-r2.s
new file mode 100644
index 0000000..a19daf7
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stb-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
+ stb r4,0(r0)
+ stb r4,4(r0)
+ stb r4,0x7fc(r0)
+ stb r4,-0x800(r0)
+ stb r4,0(r5)
+ stb r4,4(r5)
+ stb r4,0x7fc(r5)
+ stb r4,-0x800(r5)
+ stb r4,data_label(r0)
+ stb r4,big_external_data_label(r0)
+ stb r4,small_external_data_label(r0)
+ stb r4,big_external_common(r0)
+ stb r4,small_external_common(r0)
+ stb r4,big_local_common(r0)
+ stb r4,small_local_common(r0)
+ stb r4,data_label+4(r0)
+ stb r4,big_external_data_label+4(r0)
+ stb r4,small_external_data_label+4(r0)
+ stb r4,big_external_common+4(r0)
+ stb r4,small_external_common+4(r0)
+ stb r4,big_local_common+4(r0)
+ stb r4,small_local_common+4(r0)
+ stb r4,data_label-0x800(r0)
+ stb r4,big_external_data_label-0x800(r0)
+ stb r4,small_external_data_label-0x800(r0)
+ stb r4,big_external_common-0x800(r0)
+ stb r4,small_external_common-0x800(r0)
+ stb r4,big_local_common-0x800(r0)
+ stb r4,small_local_common-0x800(r0)
+ stb r4,data_label+0x10000(r0)
+ stb r4,data_label(r5)
+ stb r4,big_external_data_label(r5)
+ stb r4,small_external_data_label(r5)
+ stb r4,big_external_common(r5)
+ stb r4,small_external_common(r5)
+ stb r4,big_local_common(r5)
+ stb r4,small_local_common(r5)
+ stb r4,data_label+4(r5)
+ stb r4,big_external_data_label+4(r5)
+ stb r4,small_external_data_label+4(r5)
+ stb r4,big_external_common+4(r5)
+ stb r4,small_external_common+4(r5)
+ stb r4,big_local_common+4(r5)
+ stb r4,small_local_common+4(r5)
+ stb r4,data_label-0x800(r5)
+ stb r4,big_external_data_label-0x800(r5)
+ stb r4,small_external_data_label-0x800(r5)
+ stb r4,big_external_common-0x800(r5)
+ stb r4,small_external_common-0x800(r5)
+ stb r4,big_local_common-0x800(r5)
+ stb r4,small_local_common-0x800(r5)
+
+ stbio r4,0(r0)
+ stbio r4,4(r0)
+ stbio r4,0x7fc(r0)
+ stbio r4,-0x800(r0)
+ stbio r4,0(r5)
+ stbio r4,4(r5)
+ stbio r4,0x7fc(r5)
+ stbio r4,-0x800(r5)
+ stbio r4,data_label(r0)
+ stbio r4,big_external_data_label(r0)
+ stbio r4,small_external_data_label(r0)
+ stbio r4,big_external_common(r0)
+ stbio r4,small_external_common(r0)
+ stbio r4,big_local_common(r0)
+ stbio r4,small_local_common(r0)
+ stbio r4,data_label+4(r0)
+ stbio r4,big_external_data_label+4(r0)
+ stbio r4,small_external_data_label+4(r0)
+ stbio r4,big_external_common+4(r0)
+ stbio r4,small_external_common+4(r0)
+ stbio r4,big_local_common+4(r0)
+ stbio r4,small_local_common+4(r0)
+ stbio r4,data_label-0x800(r0)
+ stbio r4,big_external_data_label-0x800(r0)
+ stbio r4,small_external_data_label-0x800(r0)
+ stbio r4,big_external_common-0x800(r0)
+ stbio r4,small_external_common-0x800(r0)
+ stbio r4,big_local_common-0x800(r0)
+ stbio r4,small_local_common-0x800(r0)
+ stbio r4,data_label+0x10000(r0)
+ stbio r4,data_label(r5)
+ stbio r4,big_external_data_label(r5)
+ stbio r4,small_external_data_label(r5)
+ stbio r4,big_external_common(r5)
+ stbio r4,small_external_common(r5)
+ stbio r4,big_local_common(r5)
+ stbio r4,small_local_common(r5)
+ stbio r4,data_label+4(r5)
+ stbio r4,big_external_data_label+4(r5)
+ stbio r4,small_external_data_label+4(r5)
+ stbio r4,big_external_common+4(r5)
+ stbio r4,small_external_common+4(r5)
+ stbio r4,big_local_common+4(r5)
+ stbio r4,small_local_common+4(r5)
+ stbio r4,data_label-0x800(r5)
+ stbio r4,big_external_data_label-0x800(r5)
+ stbio r4,small_external_data_label-0x800(r5)
+ stbio r4,big_external_common-0x800(r5)
+ stbio r4,small_external_common-0x800(r5)
+ stbio r4,big_local_common-0x800(r5)
+ stbio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/sth-r2.d b/gas/testsuite/gas/nios2/sth-r2.d
new file mode 100644
index 0000000..c51d99c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sth-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 sth
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0000202f sth r4,0\(zero\)
+0+0004 <[^>]*> 0004202f sth r4,4\(zero\)
+0+0008 <[^>]*> 07fc202f sth r4,2044\(zero\)
+0+000c <[^>]*> f800202f sth r4,-2048\(zero\)
+0+0010 <[^>]*> 0000216f sth r4,0\(r5\)
+0+0014 <[^>]*> 0004216f sth r4,4\(r5\)
+0+0018 <[^>]*> 07fc216f sth r4,2044\(r5\)
+0+001c <[^>]*> f800216f sth r4,-2048\(r5\)
+0+0020 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x400
+0+003c <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x404
+0+0058 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x800
+0+005c <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x800
+0+0060 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x800
+0+0064 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x800
+0+0068 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x800
+0+006c <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x800
+0+0070 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x400
+0+0074 <[^>]*> 0000202f sth r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x400
+0+0094 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x404
+0+00b0 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x800
+0+00b4 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x800
+0+00b8 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x800
+0+00bc <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x800
+0+00c0 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x800
+0+00c4 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x800
+0+00c8 <[^>]*> 0000216f sth r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x400
+0+00cc <[^>]*> 50002028 sthio r4,0\(zero\)
+0+00d0 <[^>]*> 50042028 sthio r4,4\(zero\)
+0+00d4 <[^>]*> 57fc2028 sthio r4,2044\(zero\)
+0+00d8 <[^>]*> 58002028 sthio r4,-2048\(zero\)
+0+00dc <[^>]*> 50002168 sthio r4,0\(r5\)
+0+00e0 <[^>]*> 50042168 sthio r4,4\(r5\)
+0+00e4 <[^>]*> 57fc2168 sthio r4,2044\(r5\)
+0+00e8 <[^>]*> 58002168 sthio r4,-2048\(r5\)
+0+00ec <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x400
+0+0108 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x404
+0+0124 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss-0x400
+0+0140 <[^>]*> 50002028 sthio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x400
+0+0160 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x404
+0+017c <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 50002168 sthio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss-0x400
diff --git a/gas/testsuite/gas/nios2/sth-r2.s b/gas/testsuite/gas/nios2/sth-r2.s
new file mode 100644
index 0000000..abbdf9b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sth-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
+ sth r4,0(r0)
+ sth r4,4(r0)
+ sth r4,0x7fc(r0)
+ sth r4,-0x800(r0)
+ sth r4,0(r5)
+ sth r4,4(r5)
+ sth r4,0x7fc(r5)
+ sth r4,-0x800(r5)
+ sth r4,data_label(r0)
+ sth r4,big_external_data_label(r0)
+ sth r4,small_external_data_label(r0)
+ sth r4,big_external_common(r0)
+ sth r4,small_external_common(r0)
+ sth r4,big_local_common(r0)
+ sth r4,small_local_common(r0)
+ sth r4,data_label+4(r0)
+ sth r4,big_external_data_label+4(r0)
+ sth r4,small_external_data_label+4(r0)
+ sth r4,big_external_common+4(r0)
+ sth r4,small_external_common+4(r0)
+ sth r4,big_local_common+4(r0)
+ sth r4,small_local_common+4(r0)
+ sth r4,data_label-0x800(r0)
+ sth r4,big_external_data_label-0x800(r0)
+ sth r4,small_external_data_label-0x800(r0)
+ sth r4,big_external_common-0x800(r0)
+ sth r4,small_external_common-0x800(r0)
+ sth r4,big_local_common-0x800(r0)
+ sth r4,small_local_common-0x800(r0)
+ sth r4,data_label+0x10000(r0)
+ sth r4,data_label(r5)
+ sth r4,big_external_data_label(r5)
+ sth r4,small_external_data_label(r5)
+ sth r4,big_external_common(r5)
+ sth r4,small_external_common(r5)
+ sth r4,big_local_common(r5)
+ sth r4,small_local_common(r5)
+ sth r4,data_label+4(r5)
+ sth r4,big_external_data_label+4(r5)
+ sth r4,small_external_data_label+4(r5)
+ sth r4,big_external_common+4(r5)
+ sth r4,small_external_common+4(r5)
+ sth r4,big_local_common+4(r5)
+ sth r4,small_local_common+4(r5)
+ sth r4,data_label-0x800(r5)
+ sth r4,big_external_data_label-0x800(r5)
+ sth r4,small_external_data_label-0x800(r5)
+ sth r4,big_external_common-0x800(r5)
+ sth r4,small_external_common-0x800(r5)
+ sth r4,big_local_common-0x800(r5)
+ sth r4,small_local_common-0x800(r5)
+
+ sthio r4,0(r0)
+ sthio r4,4(r0)
+ sthio r4,0x7fc(r0)
+ sthio r4,-0x800(r0)
+ sthio r4,0(r5)
+ sthio r4,4(r5)
+ sthio r4,0x7fc(r5)
+ sthio r4,-0x800(r5)
+ sthio r4,data_label(r0)
+ sthio r4,big_external_data_label(r0)
+ sthio r4,small_external_data_label(r0)
+ sthio r4,big_external_common(r0)
+ sthio r4,small_external_common(r0)
+ sthio r4,big_local_common(r0)
+ sthio r4,small_local_common(r0)
+ sthio r4,data_label+4(r0)
+ sthio r4,big_external_data_label+4(r0)
+ sthio r4,small_external_data_label+4(r0)
+ sthio r4,big_external_common+4(r0)
+ sthio r4,small_external_common+4(r0)
+ sthio r4,big_local_common+4(r0)
+ sthio r4,small_local_common+4(r0)
+ sthio r4,data_label-0x800(r0)
+ sthio r4,big_external_data_label-0x800(r0)
+ sthio r4,small_external_data_label-0x800(r0)
+ sthio r4,big_external_common-0x800(r0)
+ sthio r4,small_external_common-0x800(r0)
+ sthio r4,big_local_common-0x800(r0)
+ sthio r4,small_local_common-0x800(r0)
+ sthio r4,data_label+0x10000(r0)
+ sthio r4,data_label(r5)
+ sthio r4,big_external_data_label(r5)
+ sthio r4,small_external_data_label(r5)
+ sthio r4,big_external_common(r5)
+ sthio r4,small_external_common(r5)
+ sthio r4,big_local_common(r5)
+ sthio r4,small_local_common(r5)
+ sthio r4,data_label+4(r5)
+ sthio r4,big_external_data_label+4(r5)
+ sthio r4,small_external_data_label+4(r5)
+ sthio r4,big_external_common+4(r5)
+ sthio r4,small_external_common+4(r5)
+ sthio r4,big_local_common+4(r5)
+ sthio r4,small_local_common+4(r5)
+ sthio r4,data_label-0x800(r5)
+ sthio r4,big_external_data_label-0x800(r5)
+ sthio r4,small_external_data_label-0x800(r5)
+ sthio r4,big_external_common-0x800(r5)
+ sthio r4,small_external_common-0x800(r5)
+ sthio r4,big_local_common-0x800(r5)
+ sthio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/stw-r2.d b/gas/testsuite/gas/nios2/stw-r2.d
new file mode 100644
index 0000000..718739f
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stw-r2.d
@@ -0,0 +1,197 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 stw
+#as: -march=r2
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00002037 stw r4,0\(zero\)
+0+0004 <[^>]*> 00042037 stw r4,4\(zero\)
+0+0008 <[^>]*> 07fc2037 stw r4,2044\(zero\)
+0+000c <[^>]*> f8002037 stw r4,-2048\(zero\)
+0+0010 <[^>]*> 00002177 stw r4,0\(r5\)
+0+0014 <[^>]*> 00042177 stw r4,4\(r5\)
+0+0018 <[^>]*> 07fc2177 stw r4,2044\(r5\)
+0+001c <[^>]*> f8002177 stw r4,-2048\(r5\)
+0+0020 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x400
+0+003c <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x404
+0+0058 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x800
+0+005c <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x800
+0+0060 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x800
+0+0064 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x800
+0+0068 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x800
+0+006c <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x800
+0+0070 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x400
+0+0074 <[^>]*> 00002037 stw r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x400
+0+0094 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x404
+0+00b0 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x800
+0+00b4 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x800
+0+00b8 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x800
+0+00bc <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x800
+0+00c0 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x800
+0+00c4 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x800
+0+00c8 <[^>]*> 00002177 stw r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x400
+0+00cc <[^>]*> 90002028 stwio r4,0\(zero\)
+0+00d0 <[^>]*> 90042028 stwio r4,4\(zero\)
+0+00d4 <[^>]*> 97fc2028 stwio r4,2044\(zero\)
+0+00d8 <[^>]*> 98002028 stwio r4,-2048\(zero\)
+0+00dc <[^>]*> 90002168 stwio r4,0\(r5\)
+0+00e0 <[^>]*> 90042168 stwio r4,4\(r5\)
+0+00e4 <[^>]*> 97fc2168 stwio r4,2044\(r5\)
+0+00e8 <[^>]*> 98002168 stwio r4,-2048\(r5\)
+0+00ec <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*ec: R_NIOS2_R2_S12 .data
+0+00f0 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*f0: R_NIOS2_R2_S12 big_external_data_label
+0+00f4 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*f4: R_NIOS2_R2_S12 small_external_data_label
+0+00f8 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*f8: R_NIOS2_R2_S12 big_external_common
+0+00fc <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*fc: R_NIOS2_R2_S12 small_external_common
+0+0100 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*100: R_NIOS2_R2_S12 .bss
+0+0104 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*104: R_NIOS2_R2_S12 .bss\+0x400
+0+0108 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*108: R_NIOS2_R2_S12 .data\+0x4
+0+010c <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*10c: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0110 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*110: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+0114 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*114: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0118 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*118: R_NIOS2_R2_S12 small_external_common\+0x4
+0+011c <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*11c: R_NIOS2_R2_S12 .bss\+0x4
+0+0120 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*120: R_NIOS2_R2_S12 .bss\+0x404
+0+0124 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*124: R_NIOS2_R2_S12 .data-0x800
+0+0128 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*128: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+012c <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*12c: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0130 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*130: R_NIOS2_R2_S12 big_external_common-0x800
+0+0134 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*134: R_NIOS2_R2_S12 small_external_common-0x800
+0+0138 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*138: R_NIOS2_R2_S12 .bss-0x800
+0+013c <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*13c: R_NIOS2_R2_S12 .bss-0x400
+0+0140 <[^>]*> 90002028 stwio r4,0\(zero\)
+[ ]*140: R_NIOS2_R2_S12 .data\+0x10000
+0+0144 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*144: R_NIOS2_R2_S12 .data
+0+0148 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*148: R_NIOS2_R2_S12 big_external_data_label
+0+014c <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*14c: R_NIOS2_R2_S12 small_external_data_label
+0+0150 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*150: R_NIOS2_R2_S12 big_external_common
+0+0154 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*154: R_NIOS2_R2_S12 small_external_common
+0+0158 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*158: R_NIOS2_R2_S12 .bss
+0+015c <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*15c: R_NIOS2_R2_S12 .bss\+0x400
+0+0160 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*160: R_NIOS2_R2_S12 .data\+0x4
+0+0164 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*164: R_NIOS2_R2_S12 big_external_data_label\+0x4
+0+0168 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*168: R_NIOS2_R2_S12 small_external_data_label\+0x4
+0+016c <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*16c: R_NIOS2_R2_S12 big_external_common\+0x4
+0+0170 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*170: R_NIOS2_R2_S12 small_external_common\+0x4
+0+0174 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*174: R_NIOS2_R2_S12 .bss\+0x4
+0+0178 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*178: R_NIOS2_R2_S12 .bss\+0x404
+0+017c <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*17c: R_NIOS2_R2_S12 .data-0x800
+0+0180 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*180: R_NIOS2_R2_S12 big_external_data_label-0x800
+0+0184 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*184: R_NIOS2_R2_S12 small_external_data_label-0x800
+0+0188 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*188: R_NIOS2_R2_S12 big_external_common-0x800
+0+018c <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*18c: R_NIOS2_R2_S12 small_external_common-0x800
+0+0190 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*190: R_NIOS2_R2_S12 .bss-0x800
+0+0194 <[^>]*> 90002168 stwio r4,0\(r5\)
+[ ]*194: R_NIOS2_R2_S12 .bss-0x400
diff --git a/gas/testsuite/gas/nios2/stw-r2.s b/gas/testsuite/gas/nios2/stw-r2.s
new file mode 100644
index 0000000..761c817
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stw-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
+ stw r4,0(r0)
+ stw r4,4(r0)
+ stw r4,0x7fc(r0)
+ stw r4,-0x800(r0)
+ stw r4,0(r5)
+ stw r4,4(r5)
+ stw r4,0x7fc(r5)
+ stw r4,-0x800(r5)
+ stw r4,data_label(r0)
+ stw r4,big_external_data_label(r0)
+ stw r4,small_external_data_label(r0)
+ stw r4,big_external_common(r0)
+ stw r4,small_external_common(r0)
+ stw r4,big_local_common(r0)
+ stw r4,small_local_common(r0)
+ stw r4,data_label+4(r0)
+ stw r4,big_external_data_label+4(r0)
+ stw r4,small_external_data_label+4(r0)
+ stw r4,big_external_common+4(r0)
+ stw r4,small_external_common+4(r0)
+ stw r4,big_local_common+4(r0)
+ stw r4,small_local_common+4(r0)
+ stw r4,data_label-0x800(r0)
+ stw r4,big_external_data_label-0x800(r0)
+ stw r4,small_external_data_label-0x800(r0)
+ stw r4,big_external_common-0x800(r0)
+ stw r4,small_external_common-0x800(r0)
+ stw r4,big_local_common-0x800(r0)
+ stw r4,small_local_common-0x800(r0)
+ stw r4,data_label+0x10000(r0)
+ stw r4,data_label(r5)
+ stw r4,big_external_data_label(r5)
+ stw r4,small_external_data_label(r5)
+ stw r4,big_external_common(r5)
+ stw r4,small_external_common(r5)
+ stw r4,big_local_common(r5)
+ stw r4,small_local_common(r5)
+ stw r4,data_label+4(r5)
+ stw r4,big_external_data_label+4(r5)
+ stw r4,small_external_data_label+4(r5)
+ stw r4,big_external_common+4(r5)
+ stw r4,small_external_common+4(r5)
+ stw r4,big_local_common+4(r5)
+ stw r4,small_local_common+4(r5)
+ stw r4,data_label-0x800(r5)
+ stw r4,big_external_data_label-0x800(r5)
+ stw r4,small_external_data_label-0x800(r5)
+ stw r4,big_external_common-0x800(r5)
+ stw r4,small_external_common-0x800(r5)
+ stw r4,big_local_common-0x800(r5)
+ stw r4,small_local_common-0x800(r5)
+
+ stwio r4,0(r0)
+ stwio r4,4(r0)
+ stwio r4,0x7fc(r0)
+ stwio r4,-0x800(r0)
+ stwio r4,0(r5)
+ stwio r4,4(r5)
+ stwio r4,0x7fc(r5)
+ stwio r4,-0x800(r5)
+ stwio r4,data_label(r0)
+ stwio r4,big_external_data_label(r0)
+ stwio r4,small_external_data_label(r0)
+ stwio r4,big_external_common(r0)
+ stwio r4,small_external_common(r0)
+ stwio r4,big_local_common(r0)
+ stwio r4,small_local_common(r0)
+ stwio r4,data_label+4(r0)
+ stwio r4,big_external_data_label+4(r0)
+ stwio r4,small_external_data_label+4(r0)
+ stwio r4,big_external_common+4(r0)
+ stwio r4,small_external_common+4(r0)
+ stwio r4,big_local_common+4(r0)
+ stwio r4,small_local_common+4(r0)
+ stwio r4,data_label-0x800(r0)
+ stwio r4,big_external_data_label-0x800(r0)
+ stwio r4,small_external_data_label-0x800(r0)
+ stwio r4,big_external_common-0x800(r0)
+ stwio r4,small_external_common-0x800(r0)
+ stwio r4,big_local_common-0x800(r0)
+ stwio r4,small_local_common-0x800(r0)
+ stwio r4,data_label+0x10000(r0)
+ stwio r4,data_label(r5)
+ stwio r4,big_external_data_label(r5)
+ stwio r4,small_external_data_label(r5)
+ stwio r4,big_external_common(r5)
+ stwio r4,small_external_common(r5)
+ stwio r4,big_local_common(r5)
+ stwio r4,small_local_common(r5)
+ stwio r4,data_label+4(r5)
+ stwio r4,big_external_data_label+4(r5)
+ stwio r4,small_external_data_label+4(r5)
+ stwio r4,big_external_common+4(r5)
+ stwio r4,small_external_common+4(r5)
+ stwio r4,big_local_common+4(r5)
+ stwio r4,small_local_common+4(r5)
+ stwio r4,data_label-0x800(r5)
+ stwio r4,big_external_data_label-0x800(r5)
+ stwio r4,small_external_data_label-0x800(r5)
+ stwio r4,big_external_common-0x800(r5)
+ stwio r4,small_external_common-0x800(r5)
+ stwio r4,big_local_common-0x800(r5)
+ stwio r4,small_local_common-0x800(r5)
diff --git a/gas/testsuite/gas/nios2/stwm.d b/gas/testsuite/gas/nios2/stwm.d
new file mode 100644
index 0000000..f107218
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stwm.d
@@ -0,0 +1,35 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 STWM instructions
+#as: -march=r2
+
+# Test the STWM instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> d00105e8 stwm \{r2\},--\(r23\)
+0+0004 <[^>]*> d00205e8 stwm \{r3\},--\(r23\)
+0+0008 <[^>]*> d00405e8 stwm \{r4\},--\(r23\)
+0+000c <[^>]*> d00805e8 stwm \{r5\},--\(r23\)
+0+0010 <[^>]*> d01005e8 stwm \{r6\},--\(r23\)
+0+0014 <[^>]*> d02005e8 stwm \{r7\},--\(r23\)
+0+0018 <[^>]*> d04005e8 stwm \{r8\},--\(r23\)
+0+001c <[^>]*> d08005e8 stwm \{r9\},--\(r23\)
+0+0020 <[^>]*> d10005e8 stwm \{r10\},--\(r23\)
+0+0024 <[^>]*> d20005e8 stwm \{r11\},--\(r23\)
+0+0028 <[^>]*> d40005e8 stwm \{r12\},--\(r23\)
+0+002c <[^>]*> d80005e8 stwm \{r13\},--\(r23\)
+0+0030 <[^>]*> d00128a8 stwm \{r14\},\(r2\)\+\+
+0+0034 <[^>]*> d00328a8 stwm \{r14,r15\},\(r2\)\+\+
+0+0038 <[^>]*> d00728a8 stwm \{r14,r15,r16\},\(r2\)\+\+
+0+003c <[^>]*> d00f28a8 stwm \{r14,r15,r16,r17\},\(r2\)\+\+
+0+0040 <[^>]*> d01f28a8 stwm \{r14,r15,r16,r17,r18\},\(r2\)\+\+
+0+0044 <[^>]*> d03f28a8 stwm \{r14,r15,r16,r17,r18,r19\},\(r2\)\+\+
+0+0048 <[^>]*> d07f28a8 stwm \{r14,r15,r16,r17,r18,r19,r20\},\(r2\)\+\+
+0+004c <[^>]*> d0ff28a8 stwm \{r14,r15,r16,r17,r18,r19,r20,r21\},\(r2\)\+\+
+0+0050 <[^>]*> d1ff28a8 stwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22\},\(r2\)\+\+
+0+0054 <[^>]*> d3ff28a8 stwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23\},\(r2\)\+\+
+0+0058 <[^>]*> d7ff28a8 stwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp\},\(r2\)\+\+
+0+005c <[^>]*> dfff28a8 stwm \{r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp,ra\},\(r2\)\+\+
+0+0060 <[^>]*> d2210b68 stwm \{r2,r7,r11\},\(r13\)\+\+
+0+0064 <[^>]*> d2211b68 stwm \{r2,r7,r11\},\(r13\)\+\+,writeback
diff --git a/gas/testsuite/gas/nios2/stwm.s b/gas/testsuite/gas/nios2/stwm.s
new file mode 100644
index 0000000..cefad83
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stwm.s
@@ -0,0 +1,29 @@
+# Source file used to test the SDWM instruction
+
+foo:
+ stwm {r2},--(r23)
+ stwm {r3},--(r23)
+ stwm {r4},--(r23)
+ stwm {r5},--(r23)
+ stwm {r6},--(r23)
+ stwm {r7},--(r23)
+ stwm {r8},--(r23)
+ stwm {r9},--(r23)
+ stwm {r10},--(r23)
+ stwm {r11},--(r23)
+ stwm {r12},--(r23)
+ stwm {r13},--(r23)
+ stwm {r14},(r2)++
+ stwm {r14,r15},(r2)++
+ stwm {r14,r15,r16},(r2)++
+ stwm {r14,r15,r16,r17},(r2)++
+ stwm {r14,r15,r16,r17,r18},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20,r21},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20,r21,r22},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp},(r2)++
+ stwm {r14,r15,r16,r17,r18,r19,r20,r21,r22,r23,fp,ra},(r2)++
+ stwm {r2,r7,r11},(r13)++
+ stwm {r2,r7,r11},(r13)++,writeback
diff --git a/gas/testsuite/gas/nios2/sub-r2.d b/gas/testsuite/gas/nios2/sub-r2.d
new file mode 100644
index 0000000..153824b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sub-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 sub
+#as: -march=r2
+#source: sub.s
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> e4042120 sub r4,r4,r4
+
diff --git a/gas/testsuite/gas/nios2/sync-r2.d b/gas/testsuite/gas/nios2/sync-r2.d
new file mode 100644
index 0000000..21f9336
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sync-r2.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 sync
+#as: -march=r2
+#source: sync.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section \.text:
+0+0000 <[^>]*> d8000020 sync
+
diff --git a/gas/testsuite/gas/nios2/trap-r2.d b/gas/testsuite/gas/nios2/trap-r2.d
new file mode 100644
index 0000000..beb6ca3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/trap-r2.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 trap
+#as: -march=r2
+#source: trap.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> b41d0020 trap 0
+0+0004 <[^>]*> b41d0020 trap 0
+0+0008 <[^>]*> b7fd0020 trap 31
+0+000c <[^>]*> b5dd0020 trap 14
diff --git a/gas/testsuite/gas/nios2/tret-r2.d b/gas/testsuite/gas/nios2/tret-r2.d
new file mode 100644
index 0000000..0e66d90
--- /dev/null
+++ b/gas/testsuite/gas/nios2/tret-r2.d
@@ -0,0 +1,9 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 tret
+#as: -march=r2
+#source: tret.s
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 0400f760 eret
diff --git a/gas/testsuite/gas/nios2/wrpie.d b/gas/testsuite/gas/nios2/wrpie.d
new file mode 100644
index 0000000..f45610f
--- /dev/null
+++ b/gas/testsuite/gas/nios2/wrpie.d
@@ -0,0 +1,20 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 wrpie
+#as: -march=r2
+
+# Test the wrpie instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 00000020 wrpie zero,zero
+0+0004 <[^>]*> 00010020 wrpie at,zero
+0+0008 <[^>]*> 00020020 wrpie r2,zero
+0+000c <[^>]*> 00040020 wrpie r4,zero
+0+0010 <[^>]*> 00080020 wrpie r8,zero
+0+0014 <[^>]*> 00100020 wrpie r16,zero
+0+0018 <[^>]*> 00000060 wrpie zero,at
+0+001c <[^>]*> 000000a0 wrpie zero,r2
+0+0020 <[^>]*> 00000120 wrpie zero,r4
+0+0024 <[^>]*> 00000220 wrpie zero,r8
+0+0028 <[^>]*> 00000420 wrpie zero,r16
diff --git a/gas/testsuite/gas/nios2/wrpie.s b/gas/testsuite/gas/nios2/wrpie.s
new file mode 100644
index 0000000..3718115
--- /dev/null
+++ b/gas/testsuite/gas/nios2/wrpie.s
@@ -0,0 +1,16 @@
+# Source file used to test the WRPIE instruction
+
+.set noat
+
+foo:
+ wrpie zero, zero
+ wrpie at, zero
+ wrpie r2, zero
+ wrpie r4, zero
+ wrpie r8, zero
+ wrpie r16, zero
+ wrpie zero, at
+ wrpie zero, r2
+ wrpie zero, r4
+ wrpie zero, r8
+ wrpie zero, r16
diff --git a/gas/testsuite/gas/nios2/wrprs-r2.d b/gas/testsuite/gas/nios2/wrprs-r2.d
new file mode 100644
index 0000000..f3d4dff
--- /dev/null
+++ b/gas/testsuite/gas/nios2/wrprs-r2.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 wrprs
+#as: -march=r2
+#source: wrprs.s
+
+# Test the wrprs instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 50000020 wrprs zero,zero
+0+0004 <[^>]*> 50010020 wrprs at,zero
+0+0008 <[^>]*> 50020020 wrprs r2,zero
+0+000c <[^>]*> 50040020 wrprs r4,zero
+0+0010 <[^>]*> 50080020 wrprs r8,zero
+0+0014 <[^>]*> 50100020 wrprs r16,zero
+0+0018 <[^>]*> 50000060 wrprs zero,at
+0+001c <[^>]*> 500000a0 wrprs zero,r2
+0+0020 <[^>]*> 50000120 wrprs zero,r4
+0+0024 <[^>]*> 50000220 wrprs zero,r8
+0+0028 <[^>]*> 50000420 wrprs zero,r16
diff --git a/gas/testsuite/gas/nios2/xor-r2.d b/gas/testsuite/gas/nios2/xor-r2.d
new file mode 100644
index 0000000..14148c7
--- /dev/null
+++ b/gas/testsuite/gas/nios2/xor-r2.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name: NIOS2 R2 xor
+#as: -march=r2
+#source: xor.s
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> 78065220 xor r6,r8,r10
+0+0004 <[^>]*> ffff31fc xorhi r6,r7,65535
+0+0008 <[^>]*> ffff31dc xori r6,r7,65535