summaryrefslogtreecommitdiffstats
path: root/gas/testsuite/gas
diff options
context:
space:
mode:
authorSandra Loosemore <sandra@codesourcery.com>2013-02-06 23:22:26 +0000
committerSandra Loosemore <sandra@codesourcery.com>2013-02-06 23:22:26 +0000
commit36591ba149edf6c6608d931a6d53bb99849fdc99 (patch)
tree9ca2405118dd7414b90a8fffb09eb1d5023dfd96 /gas/testsuite/gas
parent574b0b3165dfa8ce1bdc2a41ae73148b6d8ea6be (diff)
downloadppe42-binutils-36591ba149edf6c6608d931a6d53bb99849fdc99.tar.gz
ppe42-binutils-36591ba149edf6c6608d931a6d53bb99849fdc99.zip
2013-02-06 Sandra Loosemore <sandra@codesourcery.com>
Andrew Jenner <andrew@codesourcery.com> Based on patches from Altera Corporation. bfd/ * Makefile.am (ALL_MACHINES): Add cpu-nios2.lo. (ALL_MACHINES_CFILES): Add cpu-nios2.c. (BFD_BACKENDS): Add elf32-nios2.lo. (BFD32_BACKENDS_CFILES): Add elf32-nios2.c. * Makefile.in: Regenerated. * configure.in: Add entries for bfd_elf32_bignios2_vec and bfd_elf32_littlenios2_vec. * configure: Regenerated. * config.bfd: Add cases for nios2. * archures.c (enum bfd_architecture): Add bfd_arch_nios2. (bfd_mach_nios2): Define. (bfd_nios2_arch): Declare. (bfd_archures_list): Add bfd_nios2_arch. * targets.c (bfd_elf32_bignios2_vec): Declare. (bfd_elf32_littlenios2_vec): Declare. (_bfd_target_vector): Add entries for bfd_elf32_bignios2_vec and bfd_elf32_littlenios2_vec. * elf-bfd.h (enum elf_target_id): Add NIOS2_ELF_DATA. * reloc.c (enum bfd_reloc_code_real): Add Nios II relocations. * bfd-in2.h: Regenerated. * libbfd.h: Regenerated. * cpu-nios2.c: New file. * elf32-nios2.c: New file. opcodes/ * Makefile.am (TARGET_LIBOPCODES_CFILES): Add nios2-dis.c and nios2-opc.c. * Makefile.in: Regenerated. * configure.in: Add case for bfd_nios2_arch. * configure: Regenerated. * disassemble.c (ARCH_nios2): Define. (disassembler): Add case for bfd_arch_nios2. * nios2-dis.c: New file. * nios2-opc.c: New file. include/ * dis-asm.h (print_insn_big_nios2): Declare. (print_insn_little_nios2): Declare. include/elf * nios2.h: New file. include/opcode/ * nios2.h: New file. gas/ * Makefile.am (TARGET_CPU_CFILES): Add config/tc-nios2.c. (TARGET_CPU_HFILES): Add config/tc-nios2.h. * Makefile.in: Regenerated. * configure.tgt: Add case for nios2*-linux*. * config/obj-elf.c: Conditionally include elf/nios2.h. * config/tc-nios2.c: New file. * config/tc-nios2.h: New file. * doc/Makefile.am (CPU_DOCS): Add c-nios2.texi. * doc/Makefile.in: Regenerated. * doc/all.texi: Set NIOSII. * doc/as.texinfo (Overview): Add Nios II options. (Machine Dependencies): Include c-nios2.texi. * doc/c-nios2.texi: New file. * NEWS: Note Altera Nios II support. gas/testsuite/ * gas/nios2/add.d: New. * gas/nios2/add.s: New. * gas/nios2/align_fill.d: New. * gas/nios2/align_fill.s: New. * gas/nios2/align_text.d: New. * gas/nios2/align_text.s: New. * gas/nios2/and.d: New. * gas/nios2/and.s: New. * gas/nios2/branch.d: New. * gas/nios2/branch.s: New. * gas/nios2/break.d: New. * gas/nios2/break.s: New. * gas/nios2/bret.d: New. * gas/nios2/bret.s: New. * gas/nios2/cache.d: New. * gas/nios2/cache.s: New. * gas/nios2/call26.d: New. * gas/nios2/call26.s: New. * gas/nios2/call.d: New. * gas/nios2/call.s: New. * gas/nios2/cmp.d: New. * gas/nios2/cmp.s: New. * gas/nios2/comments.d: New. * gas/nios2/comments.s: New. * gas/nios2/complex.d: New. * gas/nios2/complex.s: New. * gas/nios2/ctl.d: New. * gas/nios2/ctl.s: New. * gas/nios2/custom.d: New. * gas/nios2/custom.s: New. * gas/nios2/etbt.d: New. * gas/nios2/etbt.s: New. * gas/nios2/flushda.d: New. * gas/nios2/flushda.s: New. * gas/nios2/illegal.l: New. * gas/nios2/illegal.s: New. * gas/nios2/jmp.d: New. * gas/nios2/jmp.s: New. * gas/nios2/ldb.d: New. * gas/nios2/ldb.s: New. * gas/nios2/ldh.d: New. * gas/nios2/ldh.s: New. * gas/nios2/ldw.d: New. * gas/nios2/ldw.s: New. * gas/nios2/lineseparator.d: New. * gas/nios2/lineseparator.s: New. * gas/nios2/mov.d: New. * gas/nios2/movia.d: New. * gas/nios2/movia.s: New. * gas/nios2/movi.d: New. * gas/nios2/movi.s: New. * gas/nios2/mov.s: New. * gas/nios2/mul.d: New. * gas/nios2/mul.s: New. * gas/nios2/nios2.exp: New. * gas/nios2/nor.d: New. * gas/nios2/nor.s: New. * gas/nios2/or.d: New. * gas/nios2/or.s: New. * gas/nios2/ret.d: New. * gas/nios2/ret.s: New. * gas/nios2/rol.d: New. * gas/nios2/rol.s: New. * gas/nios2/rotate.d: New. * gas/nios2/rotate.s: New. * gas/nios2/stb.d: New. * gas/nios2/stb.s: New. * gas/nios2/sth.d: New. * gas/nios2/sth.s: New. * gas/nios2/stw.d: New. * gas/nios2/stw.s: New. * gas/nios2/sub.d: New. * gas/nios2/sub.s: New. * gas/nios2/sync.d: New. * gas/nios2/sync.s: New. * gas/nios2/trap.d: New. * gas/nios2/trap.s: New. * gas/nios2/tret.d: New. * gas/nios2/tret.s: New. * gas/nios2/warn_noat.l: New. * gas/nios2/warn_noat.s: New. * gas/nios2/warn_nobreak.l: New. * gas/nios2/warn_nobreak.s: New. * gas/nios2/xor.d: New. * gas/nios2/xor.s: New. ld/ * Makefile.am (enios2elf.c): New rule. * Makefile.in: Regenerated. * configure.tgt: Add case for nios2*-*-*. * emulparams/nios2elf.sh: New file. * NEWS: Note Altera Nios II support. ld/testsuite/ * ld-nios2/emit-relocs-1a.s: New. * ld-nios2/emit-relocs-1b.s: New. * ld-nios2/emit-relocs-1.d: New. * ld-nios2/emit-relocs-1.ld: New. * ld-nios2/gprel.d: New. * ld-nios2/gprel.s: New. * ld-nios2/hilo16.d: New. * ld-nios2/hilo16.s: New. * ld-nios2/hilo16_symbol.s: New. * ld-nios2/imm5.d: New. * ld-nios2/imm5.s: New. * ld-nios2/imm5_symbol.s: New. * ld-nios2/nios2.exp: New. * ld-nios2/pcrel16.d: New. * ld-nios2/pcrel16_label.s: New. * ld-nios2/pcrel16.s: New. * ld-nios2/relax_callr.d: New. * ld-nios2/relax_callr.ld: New. * ld-nios2/relax_callr.s: New. * ld-nios2/relax_cjmp.d: New. * ld-nios2/relax_cjmp.s: New. * ld-nios2/relax_jmp.ld: New. * ld-nios2/relax_section.d: New. * ld-nios2/relax_section.s: New. * ld-nios2/relax_ujmp.d: New. * ld-nios2/relax_ujmp.s: New. * ld-nios2/reloc.d: New. * ld-nios2/reloc.s: New. * ld-nios2/reloc_symbol.s: New. * ld-nios2/s16.d: New. * ld-nios2/s16.s: New. * ld-nios2/s16_symbol.s: New. * ld-nios2/u16.d: New. * ld-nios2/u16.s: New. * ld-nios2/u16_symbol.s: New. * ld-elf/indirect.exp: Skip on targets that don't support -shared -fPIC. * ld-elfcomm/elfcomm.exp: Build with -G0 for nios2. * ld-plugin/lto.exp: Skip shared library tests on targets that don't support them. Skip execution tests on non-native targets. binutils/ * readelf.c: Include elf/nios2.h. (dump_relocations): Add case for EM_ALTERA_NIOS2. (get_nios2_dynamic_type): New. (get_dynamic_type): Add case for EM_ALTERA_NIOS2. (is_32bit_abs_reloc): Fix EM_ALTERA_NIOS2 case. (is_16bit_abs_reloc): Likewise. (is_none_reloc): Add EM_ALTERA_NIOS2 and EM_NIOS32 cases. * NEWS: Note Altera Nios II support. * MAINTAINERS: Add Nios II maintainers.
Diffstat (limited to 'gas/testsuite/gas')
-rw-r--r--gas/testsuite/gas/nios2/add.d16
-rw-r--r--gas/testsuite/gas/nios2/add.s13
-rw-r--r--gas/testsuite/gas/nios2/align_fill.d23
-rw-r--r--gas/testsuite/gas/nios2/align_fill.s20
-rw-r--r--gas/testsuite/gas/nios2/align_text.d22
-rw-r--r--gas/testsuite/gas/nios2/align_text.s15
-rw-r--r--gas/testsuite/gas/nios2/and.d17
-rw-r--r--gas/testsuite/gas/nios2/and.s13
-rw-r--r--gas/testsuite/gas/nios2/branch.d21
-rw-r--r--gas/testsuite/gas/nios2/branch.s15
-rw-r--r--gas/testsuite/gas/nios2/break.d12
-rw-r--r--gas/testsuite/gas/nios2/break.s8
-rw-r--r--gas/testsuite/gas/nios2/bret.d8
-rw-r--r--gas/testsuite/gas/nios2/bret.s5
-rw-r--r--gas/testsuite/gas/nios2/cache.d17
-rw-r--r--gas/testsuite/gas/nios2/cache.s21
-rw-r--r--gas/testsuite/gas/nios2/call.d11
-rw-r--r--gas/testsuite/gas/nios2/call.s13
-rw-r--r--gas/testsuite/gas/nios2/call26.d76
-rw-r--r--gas/testsuite/gas/nios2/call26.s12
-rw-r--r--gas/testsuite/gas/nios2/cmp.d24
-rw-r--r--gas/testsuite/gas/nios2/cmp.s22
-rw-r--r--gas/testsuite/gas/nios2/comments.d26
-rw-r--r--gas/testsuite/gas/nios2/comments.s28
-rw-r--r--gas/testsuite/gas/nios2/complex.d12
-rw-r--r--gas/testsuite/gas/nios2/complex.s5
-rw-r--r--gas/testsuite/gas/nios2/ctl.d20
-rw-r--r--gas/testsuite/gas/nios2/ctl.s18
-rw-r--r--gas/testsuite/gas/nios2/custom.d13
-rw-r--r--gas/testsuite/gas/nios2/custom.s8
-rw-r--r--gas/testsuite/gas/nios2/etbt.d10
-rw-r--r--gas/testsuite/gas/nios2/etbt.s4
-rw-r--r--gas/testsuite/gas/nios2/flushda.d10
-rw-r--r--gas/testsuite/gas/nios2/flushda.s6
-rw-r--r--gas/testsuite/gas/nios2/illegal.l14
-rw-r--r--gas/testsuite/gas/nios2/illegal.s17
-rw-r--r--gas/testsuite/gas/nios2/jmp.d10
-rw-r--r--gas/testsuite/gas/nios2/jmp.s6
-rw-r--r--gas/testsuite/gas/nios2/ldb.d196
-rw-r--r--gas/testsuite/gas/nios2/ldb.s117
-rw-r--r--gas/testsuite/gas/nios2/ldh.d196
-rw-r--r--gas/testsuite/gas/nios2/ldh.s117
-rw-r--r--gas/testsuite/gas/nios2/ldw.d196
-rw-r--r--gas/testsuite/gas/nios2/ldw.s117
-rw-r--r--gas/testsuite/gas/nios2/lineseparator.d10
-rw-r--r--gas/testsuite/gas/nios2/lineseparator.s4
-rw-r--r--gas/testsuite/gas/nios2/mov.d11
-rw-r--r--gas/testsuite/gas/nios2/mov.s5
-rw-r--r--gas/testsuite/gas/nios2/movi.d13
-rw-r--r--gas/testsuite/gas/nios2/movi.s21
-rw-r--r--gas/testsuite/gas/nios2/movia.d18
-rw-r--r--gas/testsuite/gas/nios2/movia.s6
-rw-r--r--gas/testsuite/gas/nios2/mul.d19
-rw-r--r--gas/testsuite/gas/nios2/mul.s15
-rw-r--r--gas/testsuite/gas/nios2/nios2.exp75
-rw-r--r--gas/testsuite/gas/nios2/nor.d9
-rw-r--r--gas/testsuite/gas/nios2/nor.s5
-rw-r--r--gas/testsuite/gas/nios2/or.d11
-rw-r--r--gas/testsuite/gas/nios2/or.s7
-rw-r--r--gas/testsuite/gas/nios2/ret.d8
-rw-r--r--gas/testsuite/gas/nios2/ret.s5
-rw-r--r--gas/testsuite/gas/nios2/rol.d40
-rw-r--r--gas/testsuite/gas/nios2/rol.s15
-rw-r--r--gas/testsuite/gas/nios2/rotate.d17
-rw-r--r--gas/testsuite/gas/nios2/rotate.s13
-rw-r--r--gas/testsuite/gas/nios2/stb.d196
-rw-r--r--gas/testsuite/gas/nios2/stb.s117
-rw-r--r--gas/testsuite/gas/nios2/sth.d196
-rw-r--r--gas/testsuite/gas/nios2/sth.s117
-rw-r--r--gas/testsuite/gas/nios2/stw.d196
-rw-r--r--gas/testsuite/gas/nios2/stw.s117
-rw-r--r--gas/testsuite/gas/nios2/sub.d10
-rw-r--r--gas/testsuite/gas/nios2/sub.s4
-rw-r--r--gas/testsuite/gas/nios2/sync.d8
-rw-r--r--gas/testsuite/gas/nios2/sync.s5
-rw-r--r--gas/testsuite/gas/nios2/trap.d7
-rw-r--r--gas/testsuite/gas/nios2/trap.s3
-rw-r--r--gas/testsuite/gas/nios2/tret.d8
-rw-r--r--gas/testsuite/gas/nios2/tret.s5
-rw-r--r--gas/testsuite/gas/nios2/warn_noat.l5
-rw-r--r--gas/testsuite/gas/nios2/warn_noat.s8
-rw-r--r--gas/testsuite/gas/nios2/warn_nobreak.l9
-rw-r--r--gas/testsuite/gas/nios2/warn_nobreak.s12
-rw-r--r--gas/testsuite/gas/nios2/xor.d11
-rw-r--r--gas/testsuite/gas/nios2/xor.s7
85 files changed, 2918 insertions, 0 deletions
diff --git a/gas/testsuite/gas/nios2/add.d b/gas/testsuite/gas/nios2/add.d
new file mode 100644
index 0000000000..ba3d27fb18
--- /dev/null
+++ b/gas/testsuite/gas/nios2/add.d
@@ -0,0 +1,16 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 add
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> add r4,r4,r4
+0+0004 <[^>]*> addi r4,r4,32767
+0+0008 <[^>]*> addi r4,r4,-32768
+0+000c <[^>]*> addi r4,r4,0
+0+0010 <[^>]*> addi r4,r4,-1
+0+0014 <[^>]*> addi r4,r4,-1
+0+0018 <[^>]*> addi r4,r4,13398
+0+001c <[^>]*> nop
diff --git a/gas/testsuite/gas/nios2/add.s b/gas/testsuite/gas/nios2/add.s
new file mode 100644
index 0000000000..5b72a82741
--- /dev/null
+++ b/gas/testsuite/gas/nios2/add.s
@@ -0,0 +1,13 @@
+# Source file used to test the add and addi instructions.
+
+foo:
+ add r4,r4,r4
+ addi r4,r4,0x7fff
+ addi r4,r4,-0x8000
+ addi r4,r4,0x0
+ addi r4,r4,-0x01
+ subi r4,r4,0x01
+ addi r4,r4,0x3456
+
+# should disassemble to add r0,0,r0
+ nop
diff --git a/gas/testsuite/gas/nios2/align_fill.d b/gas/testsuite/gas/nios2/align_fill.d
new file mode 100644
index 0000000000..90a9e5fbaa
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_fill.d
@@ -0,0 +1,23 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 align_fill
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> addi sp,sp,-8
+0+0004 <[^>]*> stw fp,4\(sp\)
+0+0008 <[^>]*> mov fp,sp
+0+000c <[^>]*> mov r3,zero
+0+0010 <[^>]*> nop
+0+0014 <[^>]*> nop
+0+0018 <[^>]*> nop
+0+001c <[^>]*> nop
+0+0020 <[^>]*> addi r3,r3,1
+0+0024 <[^>]*> cmplti r2,r3,100
+0+0028 <[^>]*> bne r2,zero,0+0020 <[^>*]*>
+0+002c <[^>]*> ldw fp,4\(sp\)
+0+0030 <[^>]*> addi sp,sp,8
+0+0034 <[^>]*> ret
+ ...
diff --git a/gas/testsuite/gas/nios2/align_fill.s b/gas/testsuite/gas/nios2/align_fill.s
new file mode 100644
index 0000000000..5683839546
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_fill.s
@@ -0,0 +1,20 @@
+ .file "a.c"
+ .section .text
+ .align 3
+ .global x
+ .type x, @function
+x:
+ addi sp, sp, -8
+ stw fp, 4(sp)
+ mov fp, sp
+ mov r3, zero
+ .align 5
+.L6:
+ addi r3, r3, 1
+ cmplti r2, r3, 100
+ bne r2, zero, .L6
+ ldw fp, 4(sp)
+ addi sp, sp, 8
+ ret
+ .size x, .-x
+ .ident "GCC: (GNU) 3.3.3 (Altera Nios II 1.0 b302)"
diff --git a/gas/testsuite/gas/nios2/align_text.d b/gas/testsuite/gas/nios2/align_text.d
new file mode 100644
index 0000000000..80611e76c6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_text.d
@@ -0,0 +1,22 @@
+#objdump: -dr
+#name: NIOS2 align_test
+
+# Test alignment in text sections.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+00000000 <label-0x20>:
+ 0: 00000000 call 0 <label-0x20>
+ 4: 0001883a nop
+ 8: 0001883a nop
+ c: 0001883a nop
+ 10: 0001883a nop
+ 14: 0001883a nop
+ 18: 0001883a nop
+ 1c: 0001883a nop
+
+00000020 <label>:
+ 20: 0001883a nop
+00000024 <label2>:
+ ...
diff --git a/gas/testsuite/gas/nios2/align_text.s b/gas/testsuite/gas/nios2/align_text.s
new file mode 100644
index 0000000000..d073b6f279
--- /dev/null
+++ b/gas/testsuite/gas/nios2/align_text.s
@@ -0,0 +1,15 @@
+ .asciz "" # empty string
+ .align 2
+
+ nop
+ nop
+ label:
+ .align 5
+ nop
+ label2:
+ .section mysection
+ .align 2
+
+
+
+
diff --git a/gas/testsuite/gas/nios2/and.d b/gas/testsuite/gas/nios2/and.d
new file mode 100644
index 0000000000..350ca6921e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/and.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 and
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> and r4,r4,r4
+0+0004 <[^>]*> andi r4,r4,32767
+0+0008 <[^>]*> andi r4,r4,32768
+0+000c <[^>]*> andi r4,r4,65535
+0+0010 <[^>]*> andi r4,r4,0
+0+0014 <[^>]*> andhi r4,r4,32767
+0+0018 <[^>]*> andhi r4,r4,32768
+0+001c <[^>]*> andhi r4,r4,65535
+0+0020 <[^>]*> andhi r4,r4,0
diff --git a/gas/testsuite/gas/nios2/and.s b/gas/testsuite/gas/nios2/and.s
new file mode 100644
index 0000000000..946a8b881a
--- /dev/null
+++ b/gas/testsuite/gas/nios2/and.s
@@ -0,0 +1,13 @@
+# Source file used to test the and, andhi and andi instructions
+
+foo:
+ and r4,r4,r4
+ andi r4,r4,0x7fff
+ andi r4,r4,0x8000
+ andi r4,r4,0xffff
+ andi r4,r4,0x0
+ andhi r4,r4,0x7fff
+ andhi r4,r4,0x8000
+ andhi r4,r4,0xffff
+ andhi r4,r4,0x0
+
diff --git a/gas/testsuite/gas/nios2/branch.d b/gas/testsuite/gas/nios2/branch.d
new file mode 100644
index 0000000000..08d20f356d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/branch.d
@@ -0,0 +1,21 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 branch
+
+# Test the branch instructions.
+dump.o: file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> beq r4,r5,00000004 <text_label\+0x4>
+[ ]*0: R_NIOS2_PCREL16 text_label
+0+0004 <[^>]*> bge r4,r5,00000008 <text_label\+0x8>
+[ ]*4: R_NIOS2_PCREL16 text_label
+0+0008 <[^>]*> bgeu r4,r5,0000000c <text_label\+0xc>
+[ ]*8: R_NIOS2_PCREL16 text_label
+0+000c <[^>]*> blt r4,r5,00000010 <text_label\+0x10>
+[ ]*c: R_NIOS2_PCREL16 text_label
+0+0010 <[^>]*> bltu r4,r5,00000014 <text_label\+0x14>
+[ ]*10: R_NIOS2_PCREL16 text_label
+0+0014 <[^>]*> bne r4,r5,00000018 <text_label\+0x18>
+[ ]*14: R_NIOS2_PCREL16 text_label
+0+0018 <[^>]*> br 0000001c <text_label\+0x1c>
+[ ]*18: R_NIOS2_PCREL16 external_label
diff --git a/gas/testsuite/gas/nios2/branch.s b/gas/testsuite/gas/nios2/branch.s
new file mode 100644
index 0000000000..0853167ee0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/branch.s
@@ -0,0 +1,15 @@
+# Source file used to test the beq macro.
+ .globl text_label
+ .text
+.set norelax
+text_label:
+ beq r4,r5,text_label
+ bge r4,r5,text_label
+ bgeu r4,r5,text_label
+ blt r4,r5,text_label
+ bltu r4,r5,text_label
+ bne r4,r5,text_label
+
+# Branch to an external label.
+ br external_label
+
diff --git a/gas/testsuite/gas/nios2/break.d b/gas/testsuite/gas/nios2/break.d
new file mode 100644
index 0000000000..be487bb3d4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/break.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 break
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> break 0
+0+0004 <[^>]*> break 0
+0+0008 <[^>]*> break 31
+0+000c <[^>]*> break 14
+
+
diff --git a/gas/testsuite/gas/nios2/break.s b/gas/testsuite/gas/nios2/break.s
new file mode 100644
index 0000000000..88d3422e74
--- /dev/null
+++ b/gas/testsuite/gas/nios2/break.s
@@ -0,0 +1,8 @@
+# Source file used to test the 20-bit break instructions
+foo:
+ break
+ break 0
+ break 31
+ break 14
+
+
diff --git a/gas/testsuite/gas/nios2/bret.d b/gas/testsuite/gas/nios2/bret.d
new file mode 100644
index 0000000000..a12530b5f6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/bret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 bret
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> bret
+
diff --git a/gas/testsuite/gas/nios2/bret.s b/gas/testsuite/gas/nios2/bret.s
new file mode 100644
index 0000000000..d368e6441e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/bret.s
@@ -0,0 +1,5 @@
+# Source file used to test the bret instructions
+foo:
+ bret
+
+
diff --git a/gas/testsuite/gas/nios2/cache.d b/gas/testsuite/gas/nios2/cache.d
new file mode 100644
index 0000000000..7c278d8db3
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cache.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 cache
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> flushd -32768\(r6\)
+0+0004 <[^>]*> flushd 32767\(r6\)
+0+0008 <[^>]*> flushd 0\(r6\)
+0+000c <[^>]*> flushd -1\(r6\)
+0+0010 <[^>]*> flushd 0\(r6\)
+[ ]*10: R_NIOS2_S16 .text
+0+0014 <[^>]*> flushd 0\(r6\)
+[ ]*14: R_NIOS2_S16 external
+0+0018 <[^>]*> flushi r2
+0+001c <[^>]*> flushp
+
diff --git a/gas/testsuite/gas/nios2/cache.s b/gas/testsuite/gas/nios2/cache.s
new file mode 100644
index 0000000000..1701c191bc
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cache.s
@@ -0,0 +1,21 @@
+# Source file used to test the cache instruction
+foo:
+ flushd -0x8000(r6)
+ flushd 0x7fff(r6)
+ flushd 0x0(r6)
+ flushd -0x0001(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.d b/gas/testsuite/gas/nios2/call.d
new file mode 100644
index 0000000000..cfa6aec905
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call.d
@@ -0,0 +1,11 @@
+# objdump: -dr --prefix-addresses
+#name: NIOS2 call
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> call 00000000 <foo>
+[ ]*0: R_NIOS2_CALL26 .text\+0xc
+0+0004 <[^>]*> callr r10
+0+0008 <[^>]*> call 00000000 <foo>
+[ ]*8: R_NIOS2_CALL26 external
diff --git a/gas/testsuite/gas/nios2/call.s b/gas/testsuite/gas/nios2/call.s
new file mode 100644
index 0000000000..39409b7de0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call.s
@@ -0,0 +1,13 @@
+# Source file used to test the call and callr instructions
+.text
+.set norelax
+foo:
+ call func1
+ callr r10
+# use external symbol
+ .global external
+ call external
+func1:
+
+
+
diff --git a/gas/testsuite/gas/nios2/call26.d b/gas/testsuite/gas/nios2/call26.d
new file mode 100644
index 0000000000..63364ef670
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call26.d
@@ -0,0 +1,76 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 nios2-reloc-r-nios2-call26
+
+# 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 <[^>]*> nop
+0+000c <[^>]*> nop
+0+0010 <[^>]*> nop
+0+0014 <[^>]*> nop
+0+0018 <[^>]*> nop
+0+001c <[^>]*> nop
+0+0020 <[^>]*> nop
+0+0024 <[^>]*> nop
+0+0028 <[^>]*> nop
+0+002c <[^>]*> nop
+0+0030 <[^>]*> nop
+0+0034 <[^>]*> nop
+0+0038 <[^>]*> nop
+0+003c <[^>]*> nop
+0+0040 <[^>]*> nop
+0+0044 <[^>]*> nop
+0+0048 <[^>]*> nop
+0+004c <[^>]*> nop
+0+0050 <[^>]*> nop
+0+0054 <[^>]*> nop
+0+0058 <[^>]*> nop
+0+005c <[^>]*> nop
+0+0060 <[^>]*> nop
+0+0064 <[^>]*> nop
+0+0068 <[^>]*> nop
+0+006c <[^>]*> nop
+0+0070 <[^>]*> nop
+0+0074 <[^>]*> nop
+0+0078 <[^>]*> nop
+0+007c <[^>]*> nop
+0+0080 <[^>]*> nop
+0+0084 <[^>]*> nop
+0+0088 <[^>]*> nop
+0+008c <[^>]*> nop
+0+0090 <[^>]*> nop
+0+0094 <[^>]*> nop
+0+0098 <[^>]*> nop
+0+009c <[^>]*> nop
+0+00a0 <[^>]*> nop
+0+00a4 <[^>]*> nop
+0+00a8 <[^>]*> nop
+0+00ac <[^>]*> nop
+0+00b0 <[^>]*> nop
+0+00b4 <[^>]*> nop
+0+00b8 <[^>]*> nop
+0+00bc <[^>]*> nop
+0+00c0 <[^>]*> nop
+0+00c4 <[^>]*> nop
+0+00c8 <[^>]*> nop
+0+00cc <[^>]*> nop
+0+00d0 <[^>]*> nop
+0+00d4 <[^>]*> nop
+0+00d8 <[^>]*> nop
+0+00dc <[^>]*> nop
+0+00e0 <[^>]*> nop
+0+00e4 <[^>]*> nop
+0+00e8 <[^>]*> nop
+0+00ec <[^>]*> nop
+0+00f0 <[^>]*> nop
+0+00f4 <[^>]*> nop
+0+00f8 <[^>]*> nop
+0+00fc <[^>]*> nop
+0+0100 <[^>]*> nop
+ ...
+
+
diff --git a/gas/testsuite/gas/nios2/call26.s b/gas/testsuite/gas/nios2/call26.s
new file mode 100644
index 0000000000..dd128a7030
--- /dev/null
+++ b/gas/testsuite/gas/nios2/call26.s
@@ -0,0 +1,12 @@
+# Test for Nios II 32-bit relocations
+
+.global globalfunc
+.text
+.set norelax
+start:
+ call localfunc
+ call globalfunc
+
+.align 8
+localfunc:
+ nop
diff --git a/gas/testsuite/gas/nios2/cmp.d b/gas/testsuite/gas/nios2/cmp.d
new file mode 100644
index 0000000000..43d9d68c85
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cmp.d
@@ -0,0 +1,24 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 cmp
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> cmpeq r11,r2,r3
+0+0004 <[^>]*> cmpge r11,r2,r3
+0+0008 <[^>]*> cmpgeu r11,r2,r3
+0+000c <[^>]*> cmplt r11,r2,r3
+0+0010 <[^>]*> cmpltu r11,r2,r3
+0+0014 <[^>]*> cmpne r11,r2,r3
+0+0018 <[^>]*> cmpgei r11,r2,0
+[ ]*18: R_NIOS2_S16 value
+0+001c <[^>]*> cmpgeui r11,r2,0
+[ ]*1c: R_NIOS2_U16 value\+0x200
+0+0020 <[^>]*> cmplti r11,r2,0
+[ ]*20: R_NIOS2_S16 value
+0+0024 <[^>]*> cmpltui r11,r2,0
+[ ]*24: R_NIOS2_U16 value\+0x200
+0+0028 <[^>]*> cmpgei r11,r2,32767
+0+002c <[^>]*> cmpgeui r11,r2,32768
+0+0030 <[^>]*> cmplti r11,r2,-32768
+0+0034 <[^>]*> cmpltui r11,r2,65535
diff --git a/gas/testsuite/gas/nios2/cmp.s b/gas/testsuite/gas/nios2/cmp.s
new file mode 100644
index 0000000000..6f7c15b443
--- /dev/null
+++ b/gas/testsuite/gas/nios2/cmp.s
@@ -0,0 +1,22 @@
+# Source file used to test the compare instructions
+foo:
+ cmpeq r11,r2,r3
+ cmpge r11,r2,r3
+ cmpgeu r11,r2,r3
+ cmplt r11,r2,r3
+ cmpltu r11,r2,r3
+ cmpne r11,r2,r3
+# test that cmp generates relocations correctly
+ cmpgei r11,r2,value
+ cmpgeui r11,r2,value+0x200
+ cmplti r11,r2,value
+ cmpltui r11,r2,value+0x200
+
+ cmpgei r11,r2,0x7fff
+ cmpgeui r11,r2,0x8000
+ cmplti r11,r2,-0x8000
+ cmpltui r11,r2,0xFFFF
+.global value
+
+
+
diff --git a/gas/testsuite/gas/nios2/comments.d b/gas/testsuite/gas/nios2/comments.d
new file mode 100644
index 0000000000..890dcc20db
--- /dev/null
+++ b/gas/testsuite/gas/nios2/comments.d
@@ -0,0 +1,26 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 comments
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> br 0000001c <start>
+0+0004 <[^>]*> br 00000008 <abort>
+0+0008 <[^>]*> movui r3,0
+0+000c <[^>]*> movui r2,1
+0+0010 <[^>]*> movui r3,0
+0+0014 <[^>]*> movui r2,0
+0+0018 <[^>]*> br 00000044 <exit>
+0+001c <[^>]*> addi r2,r2,-4
+0+0020 <[^>]*> movui r11,1
+0+0024 <[^>]*> movui r5,0
+0+0028 <[^>]*> movui r6,0
+0+002c <[^>]*> br 00000030 <ldst>
+0+0030 <[^>]*> movui r2,61452
+0+0034 <[^>]*> movui r20,64206
+0+0038 <[^>]*> stw r20,0\(r2\)
+0+003c <[^>]*> ldw r21,0\(r2\)
+0+0040 <[^>]*> br 00000010 <end>
+0+0044 <[^>]*> br 00000044 <exit>
diff --git a/gas/testsuite/gas/nios2/comments.s b/gas/testsuite/gas/nios2/comments.s
new file mode 100644
index 0000000000..7ab2027829
--- /dev/null
+++ b/gas/testsuite/gas/nios2/comments.s
@@ -0,0 +1,28 @@
+.set norelax
+_main: br start
+trap:
+ br abort
+.globl _main
+abort: movui r3, 0x0
+ movui r2, 0x1
+
+end: movui r3, 0x0
+ movui r2, 0x0
+ br exit
+
+start:
+ addi r2, r2, -4 # test for ve numbers
+ movui r11, 0x1
+ ori r5, r0, %lo(0x0) # r5 = 0x0
+ ori r6, r0, %lo(0x0) # r6 = 0x0
+ br ldst
+
+ldst:
+ movui r2, 0xF00C
+ movui r20, 0xFACE
+ stw r20,(r2)
+ ldw r21, (r2)
+ br end
+
+
+exit: br exit
diff --git a/gas/testsuite/gas/nios2/complex.d b/gas/testsuite/gas/nios2/complex.d
new file mode 100644
index 0000000000..f32115b546
--- /dev/null
+++ b/gas/testsuite/gas/nios2/complex.d
@@ -0,0 +1,12 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 complex
+
+# Test complex expression parsing
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ldw r2,-1\(r3\)
+0+0004 <[^>]*> ldw r2,1\(r3\)
+0+0008 <[^>]*> ldw r2,0\(r3\)
+ 8: R_NIOS2_S16 stack_top-0x1
diff --git a/gas/testsuite/gas/nios2/complex.s b/gas/testsuite/gas/nios2/complex.s
new file mode 100644
index 0000000000..65141f9d62
--- /dev/null
+++ b/gas/testsuite/gas/nios2/complex.s
@@ -0,0 +1,5 @@
+foo:
+ ldw r2, (2-3)(r3)
+ ldw r2, 2 + (2-3)(r3)
+ ldw r2, 2 + (stack_top-3)(r3)
+
diff --git a/gas/testsuite/gas/nios2/ctl.d b/gas/testsuite/gas/nios2/ctl.d
new file mode 100644
index 0000000000..f698ce60be
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ctl.d
@@ -0,0 +1,20 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ctl
+
+# Test the ctl instructions
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> rdctl r8,ctl31
+0+0004 <[^>]*> rdctl r8,ctl30
+0+0008 <[^>]*> rdctl r8,ctl29
+0+000c <[^>]*> rdctl r8,status
+0+0010 <[^>]*> rdctl r8,bstatus
+0+0014 <[^>]*> rdctl r8,estatus
+0+0018 <[^>]*> wrctl ctl31,r8
+0+001c <[^>]*> wrctl ctl30,r8
+0+0020 <[^>]*> wrctl ctl29,r8
+0+0024 <[^>]*> wrctl status,r8
+0+0028 <[^>]*> wrctl bstatus,r8
+0+002c <[^>]*> wrctl estatus,r8
diff --git a/gas/testsuite/gas/nios2/ctl.s b/gas/testsuite/gas/nios2/ctl.s
new file mode 100644
index 0000000000..dc6c98399c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ctl.s
@@ -0,0 +1,18 @@
+# Source file used to test the nor instruction
+
+foo:
+ rdctl r8,ctl31
+ rdctl r8,ctl30
+ rdctl r8,ctl29
+ rdctl r8,status
+ rdctl r8,bstatus
+ rdctl r8,estatus
+ wrctl ctl31,r8
+ wrctl ctl30,r8
+ wrctl ctl29,r8
+ wrctl status,r8
+ wrctl bstatus,r8
+ wrctl estatus,r8
+
+
+
diff --git a/gas/testsuite/gas/nios2/custom.d b/gas/testsuite/gas/nios2/custom.d
new file mode 100644
index 0000000000..c1e17beae9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/custom.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 custom
+
+# Test the custom instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> custom 0,r11,r2,r3
+0+0004 <[^>]*> custom 255,r11,r2,r3
+0+0008 <[^>]*> custom 150,c1,r2,r3
+0+000c <[^>]*> custom 24,c1,c2,r3
+0+0010 <[^>]*> custom 56,c1,c2,c3
diff --git a/gas/testsuite/gas/nios2/custom.s b/gas/testsuite/gas/nios2/custom.s
new file mode 100644
index 0000000000..903122ab45
--- /dev/null
+++ b/gas/testsuite/gas/nios2/custom.s
@@ -0,0 +1,8 @@
+# test progam for assembling user instructions
+
+foo:
+ custom 0, r11, r2, r3
+ custom 255, r11, r2, r3
+ custom 150, c1, r2, r3
+ custom 0x18, c1, c2, r3
+ custom 070, c1, c2, c3
diff --git a/gas/testsuite/gas/nios2/etbt.d b/gas/testsuite/gas/nios2/etbt.d
new file mode 100644
index 0000000000..58b8e32639
--- /dev/null
+++ b/gas/testsuite/gas/nios2/etbt.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 etbt
+
+# Test the et, bt registers
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> add et,bt,r6
+0+0004 <[^>]*> add et,bt,r6
diff --git a/gas/testsuite/gas/nios2/etbt.s b/gas/testsuite/gas/nios2/etbt.s
new file mode 100644
index 0000000000..3e5fc24a3e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/etbt.s
@@ -0,0 +1,4 @@
+.set nobreak
+foo:
+ add r24, r25, r6
+ add et, bt, r6
diff --git a/gas/testsuite/gas/nios2/flushda.d b/gas/testsuite/gas/nios2/flushda.d
new file mode 100644
index 0000000000..f3b5e3ef56
--- /dev/null
+++ b/gas/testsuite/gas/nios2/flushda.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 flushda
+
+# Test the jmp instruction.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> flushda 12\(r2\)
+
diff --git a/gas/testsuite/gas/nios2/flushda.s b/gas/testsuite/gas/nios2/flushda.s
new file mode 100644
index 0000000000..3a3247484b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/flushda.s
@@ -0,0 +1,6 @@
+# Source file used to test the flushda instruction.
+.text
+.set nobreak
+foo:
+ flushda 12(r2)
+
diff --git a/gas/testsuite/gas/nios2/illegal.l b/gas/testsuite/gas/nios2/illegal.l
new file mode 100644
index 0000000000..6248567b95
--- /dev/null
+++ b/gas/testsuite/gas/nios2/illegal.l
@@ -0,0 +1,14 @@
+.*illegal.s: Assembler messages:
+.*illegal.s:5: Error: unknown register r56
+.*illegal.s:8: Error: expecting \( near 0x1000
+.*illegal.s:8: Error: missing argument
+.*illegal.s:9: Error: expecting \) near r5
+.*illegal.s:10: Error: expecting \( near 0x1000r5\)
+.*illegal.s:10: Error: missing argument
+.*illegal.s:11: Error: expecting \( near 0x1000,r5
+.*illegal.s:11: Error: missing argument
+.*illegal.s:12: Error: unknown register 0x1000
+.*illegal.s:14: Error: unrecognised instruction fop
+.*illegal.s:16: Error: too many arguments
+.*illegal.s:17: Error: too many arguments
+.*illegal.s:17: Error: unknown register r2,r4
diff --git a/gas/testsuite/gas/nios2/illegal.s b/gas/testsuite/gas/nios2/illegal.s
new file mode 100644
index 0000000000..75b6d89f20
--- /dev/null
+++ b/gas/testsuite/gas/nios2/illegal.s
@@ -0,0 +1,17 @@
+# Source file used to test illegal operands.
+
+foo:
+# Illegal registers
+ add r3,r4,r56
+ add r4,r0,r2
+# Illegal syntax
+ ldw r4,0x1000
+ ldw r4,0x1000(r5
+ ldw r4,0x1000r5)
+ ldw r4,0x1000,r5
+ ldw r4,(0x1000)r5
+# Illegal opcodes
+ fop r3,r4,r5
+# Extra operands
+ nop Crapola
+ add r2, r2, r2, r4
diff --git a/gas/testsuite/gas/nios2/jmp.d b/gas/testsuite/gas/nios2/jmp.d
new file mode 100644
index 0000000000..b8727b3140
--- /dev/null
+++ b/gas/testsuite/gas/nios2/jmp.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 jmp
+
+# Test the jmp instruction.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> jmp bt
+
diff --git a/gas/testsuite/gas/nios2/jmp.s b/gas/testsuite/gas/nios2/jmp.s
new file mode 100644
index 0000000000..8d859f2b6c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/jmp.s
@@ -0,0 +1,6 @@
+# Source file used to test the jmp instruction.
+.text
+.set nobreak
+foo:
+ jmp r25
+
diff --git a/gas/testsuite/gas/nios2/ldb.d b/gas/testsuite/gas/nios2/ldb.d
new file mode 100644
index 0000000000..5a417b814e
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldb.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldb
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ldb r4,0\(zero\)
+0+0004 <[^>]*> ldb r4,4\(zero\)
+0+0008 <[^>]*> ldb r4,32764\(zero\)
+0+000c <[^>]*> ldb r4,-32768\(zero\)
+0+0010 <[^>]*> ldb r4,0\(r5\)
+0+0014 <[^>]*> ldb r4,4\(r5\)
+0+0018 <[^>]*> ldb r4,32764\(r5\)
+0+001c <[^>]*> ldb r4,-32768\(r5\)
+0+0020 <[^>]*> ldb r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> ldb r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> ldb r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> ldb r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> ldb r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> ldb r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> ldb r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> ldb r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> ldb r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> ldb r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> ldb r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> ldb r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> ldb r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> ldb r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> ldb r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> ldb r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> ldb r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> ldb r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> ldb r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> ldb r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> ldb r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> ldb r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> ldb r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> ldb r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> ldb r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> ldb r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> ldb r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> ldb r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> ldb r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> ldb r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> ldb r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> ldb r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> ldb r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> ldb r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> ldb r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> ldb r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> ldb r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> ldb r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> ldb r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> ldb r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> ldb r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> ldb r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> ldb r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> ldbio r4,0\(zero\)
+0+00d0 <[^>]*> ldbio r4,4\(zero\)
+0+00d4 <[^>]*> ldbio r4,32764\(zero\)
+0+00d8 <[^>]*> ldbio r4,-32768\(zero\)
+0+00dc <[^>]*> ldbio r4,0\(r5\)
+0+00e0 <[^>]*> ldbio r4,4\(r5\)
+0+00e4 <[^>]*> ldbio r4,32764\(r5\)
+0+00e8 <[^>]*> ldbio r4,-32768\(r5\)
+0+00ec <[^>]*> ldbio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> ldbio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> ldbio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> ldbio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> ldbio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> ldbio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> ldbio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> ldbio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> ldbio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> ldbio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> ldbio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> ldbio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> ldbio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> ldbio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> ldbio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> ldbio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> ldbio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> ldbio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> ldbio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> ldbio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> ldbio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> ldbio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> ldbio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> ldbio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> ldbio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> ldbio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> ldbio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> ldbio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> ldbio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> ldbio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> ldbio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> ldbio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> ldbio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> ldbio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> ldbio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> ldbio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> ldbio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> ldbio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> ldbio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> ldbio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> ldbio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> ldbio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> ldbio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/ldb.s b/gas/testsuite/gas/nios2/ldb.s
new file mode 100644
index 0000000000..71c51f1857
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldb.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,0x7ffc(r0)
+ ldbio r4,-0x8000(r0)
+ ldbio r4,0(r5)
+ ldbio r4,4(r5)
+ ldbio r4,0x7ffc(r5)
+ ldbio r4,-0x8000(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-0x8000(r0)
+ ldbio r4,big_external_data_label-0x8000(r0)
+ ldbio r4,small_external_data_label-0x8000(r0)
+ ldbio r4,big_external_common-0x8000(r0)
+ ldbio r4,small_external_common-0x8000(r0)
+ ldbio r4,big_local_common-0x8000(r0)
+ ldbio r4,small_local_common-0x8000(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-0x8000(r5)
+ ldbio r4,big_external_data_label-0x8000(r5)
+ ldbio r4,small_external_data_label-0x8000(r5)
+ ldbio r4,big_external_common-0x8000(r5)
+ ldbio r4,small_external_common-0x8000(r5)
+ ldbio r4,big_local_common-0x8000(r5)
+ ldbio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/ldh.d b/gas/testsuite/gas/nios2/ldh.d
new file mode 100644
index 0000000000..f030eef187
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldh.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldh
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ldh r4,0\(zero\)
+0+0004 <[^>]*> ldh r4,4\(zero\)
+0+0008 <[^>]*> ldh r4,32764\(zero\)
+0+000c <[^>]*> ldh r4,-32768\(zero\)
+0+0010 <[^>]*> ldh r4,0\(r5\)
+0+0014 <[^>]*> ldh r4,4\(r5\)
+0+0018 <[^>]*> ldh r4,32764\(r5\)
+0+001c <[^>]*> ldh r4,-32768\(r5\)
+0+0020 <[^>]*> ldh r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> ldh r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> ldh r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> ldh r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> ldh r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> ldh r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> ldh r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> ldh r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> ldh r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> ldh r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> ldh r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> ldh r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> ldh r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> ldh r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> ldh r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> ldh r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> ldh r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> ldh r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> ldh r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> ldh r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> ldh r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> ldh r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> ldh r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> ldh r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> ldh r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> ldh r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> ldh r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> ldh r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> ldh r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> ldh r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> ldh r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> ldh r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> ldh r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> ldh r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> ldh r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> ldh r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> ldh r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> ldh r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> ldh r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> ldh r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> ldh r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> ldh r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> ldh r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> ldhio r4,0\(zero\)
+0+00d0 <[^>]*> ldhio r4,4\(zero\)
+0+00d4 <[^>]*> ldhio r4,32764\(zero\)
+0+00d8 <[^>]*> ldhio r4,-32768\(zero\)
+0+00dc <[^>]*> ldhio r4,0\(r5\)
+0+00e0 <[^>]*> ldhio r4,4\(r5\)
+0+00e4 <[^>]*> ldhio r4,32764\(r5\)
+0+00e8 <[^>]*> ldhio r4,-32768\(r5\)
+0+00ec <[^>]*> ldhio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> ldhio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> ldhio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> ldhio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> ldhio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> ldhio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> ldhio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> ldhio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> ldhio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> ldhio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> ldhio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> ldhio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> ldhio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> ldhio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> ldhio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> ldhio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> ldhio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> ldhio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> ldhio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> ldhio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> ldhio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> ldhio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> ldhio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> ldhio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> ldhio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> ldhio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> ldhio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> ldhio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> ldhio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> ldhio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> ldhio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> ldhio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> ldhio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> ldhio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> ldhio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> ldhio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> ldhio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> ldhio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> ldhio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> ldhio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> ldhio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> ldhio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> ldhio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/ldh.s b/gas/testsuite/gas/nios2/ldh.s
new file mode 100644
index 0000000000..87040eeb79
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldh.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
+ ldh r4,0(r0)
+ ldh r4,4(r0)
+ ldh r4,0x7ffc(r0)
+ ldh r4,-0x8000(r0)
+ ldh r4,0(r5)
+ ldh r4,4(r5)
+ ldh r4,0x7ffc(r5)
+ ldh r4,-0x8000(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-0x8000(r0)
+ ldh r4,big_external_data_label-0x8000(r0)
+ ldh r4,small_external_data_label-0x8000(r0)
+ ldh r4,big_external_common-0x8000(r0)
+ ldh r4,small_external_common-0x8000(r0)
+ ldh r4,big_local_common-0x8000(r0)
+ ldh r4,small_local_common-0x8000(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-0x8000(r5)
+ ldh r4,big_external_data_label-0x8000(r5)
+ ldh r4,small_external_data_label-0x8000(r5)
+ ldh r4,big_external_common-0x8000(r5)
+ ldh r4,small_external_common-0x8000(r5)
+ ldh r4,big_local_common-0x8000(r5)
+ ldh r4,small_local_common-0x8000(r5)
+
+ ldhio r4,0(r0)
+ ldhio r4,4(r0)
+ ldhio r4,0x7ffc(r0)
+ ldhio r4,-0x8000(r0)
+ ldhio r4,0(r5)
+ ldhio r4,4(r5)
+ ldhio r4,0x7ffc(r5)
+ ldhio r4,-0x8000(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-0x8000(r0)
+ ldhio r4,big_external_data_label-0x8000(r0)
+ ldhio r4,small_external_data_label-0x8000(r0)
+ ldhio r4,big_external_common-0x8000(r0)
+ ldhio r4,small_external_common-0x8000(r0)
+ ldhio r4,big_local_common-0x8000(r0)
+ ldhio r4,small_local_common-0x8000(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-0x8000(r5)
+ ldhio r4,big_external_data_label-0x8000(r5)
+ ldhio r4,small_external_data_label-0x8000(r5)
+ ldhio r4,big_external_common-0x8000(r5)
+ ldhio r4,small_external_common-0x8000(r5)
+ ldhio r4,big_local_common-0x8000(r5)
+ ldhio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/ldw.d b/gas/testsuite/gas/nios2/ldw.d
new file mode 100644
index 0000000000..dc2571edb9
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldw.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ldw
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ldw r4,0\(zero\)
+0+0004 <[^>]*> ldw r4,4\(zero\)
+0+0008 <[^>]*> ldw r4,32764\(zero\)
+0+000c <[^>]*> ldw r4,-32768\(zero\)
+0+0010 <[^>]*> ldw r4,0\(r5\)
+0+0014 <[^>]*> ldw r4,4\(r5\)
+0+0018 <[^>]*> ldw r4,32764\(r5\)
+0+001c <[^>]*> ldw r4,-32768\(r5\)
+0+0020 <[^>]*> ldw r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> ldw r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> ldw r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> ldw r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> ldw r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> ldw r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> ldw r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> ldw r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> ldw r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> ldw r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> ldw r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> ldw r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> ldw r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> ldw r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> ldw r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> ldw r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> ldw r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> ldw r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> ldw r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> ldw r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> ldw r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> ldw r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> ldw r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> ldw r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> ldw r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> ldw r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> ldw r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> ldw r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> ldw r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> ldw r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> ldw r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> ldw r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> ldw r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> ldw r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> ldw r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> ldw r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> ldw r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> ldw r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> ldw r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> ldw r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> ldw r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> ldw r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> ldw r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> ldwio r4,0\(zero\)
+0+00d0 <[^>]*> ldwio r4,4\(zero\)
+0+00d4 <[^>]*> ldwio r4,32764\(zero\)
+0+00d8 <[^>]*> ldwio r4,-32768\(zero\)
+0+00dc <[^>]*> ldwio r4,0\(r5\)
+0+00e0 <[^>]*> ldwio r4,4\(r5\)
+0+00e4 <[^>]*> ldwio r4,32764\(r5\)
+0+00e8 <[^>]*> ldwio r4,-32768\(r5\)
+0+00ec <[^>]*> ldwio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> ldwio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> ldwio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> ldwio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> ldwio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> ldwio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> ldwio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> ldwio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> ldwio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> ldwio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> ldwio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> ldwio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> ldwio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> ldwio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> ldwio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> ldwio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> ldwio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> ldwio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> ldwio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> ldwio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> ldwio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> ldwio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> ldwio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> ldwio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> ldwio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> ldwio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> ldwio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> ldwio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> ldwio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> ldwio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> ldwio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> ldwio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> ldwio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> ldwio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> ldwio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> ldwio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> ldwio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> ldwio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> ldwio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> ldwio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> ldwio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> ldwio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> ldwio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/ldw.s b/gas/testsuite/gas/nios2/ldw.s
new file mode 100644
index 0000000000..cf6de19d21
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ldw.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
+ ldw r4,0(r0)
+ ldw r4,4(r0)
+ ldw r4,0x7ffc(r0)
+ ldw r4,-0x8000(r0)
+ ldw r4,0(r5)
+ ldw r4,4(r5)
+ ldw r4,0x7ffc(r5)
+ ldw r4,-0x8000(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-0x8000(r0)
+ ldw r4,big_external_data_label-0x8000(r0)
+ ldw r4,small_external_data_label-0x8000(r0)
+ ldw r4,big_external_common-0x8000(r0)
+ ldw r4,small_external_common-0x8000(r0)
+ ldw r4,big_local_common-0x8000(r0)
+ ldw r4,small_local_common-0x8000(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-0x8000(r5)
+ ldw r4,big_external_data_label-0x8000(r5)
+ ldw r4,small_external_data_label-0x8000(r5)
+ ldw r4,big_external_common-0x8000(r5)
+ ldw r4,small_external_common-0x8000(r5)
+ ldw r4,big_local_common-0x8000(r5)
+ ldw r4,small_local_common-0x8000(r5)
+
+ ldwio r4,0(r0)
+ ldwio r4,4(r0)
+ ldwio r4,0x7ffc(r0)
+ ldwio r4,-0x8000(r0)
+ ldwio r4,0(r5)
+ ldwio r4,4(r5)
+ ldwio r4,0x7ffc(r5)
+ ldwio r4,-0x8000(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-0x8000(r0)
+ ldwio r4,big_external_data_label-0x8000(r0)
+ ldwio r4,small_external_data_label-0x8000(r0)
+ ldwio r4,big_external_common-0x8000(r0)
+ ldwio r4,small_external_common-0x8000(r0)
+ ldwio r4,big_local_common-0x8000(r0)
+ ldwio r4,small_local_common-0x8000(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-0x8000(r5)
+ ldwio r4,big_external_data_label-0x8000(r5)
+ ldwio r4,small_external_data_label-0x8000(r5)
+ ldwio r4,big_external_common-0x8000(r5)
+ ldwio r4,small_external_common-0x8000(r5)
+ ldwio r4,big_local_common-0x8000(r5)
+ ldwio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/lineseparator.d b/gas/testsuite/gas/nios2/lineseparator.d
new file mode 100644
index 0000000000..09c66ea0c8
--- /dev/null
+++ b/gas/testsuite/gas/nios2/lineseparator.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 lineseparator
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0x0+0000 mov r5,r4
+0x0+0004 mov r4,r5
diff --git a/gas/testsuite/gas/nios2/lineseparator.s b/gas/testsuite/gas/nios2/lineseparator.s
new file mode 100644
index 0000000000..d16efc35eb
--- /dev/null
+++ b/gas/testsuite/gas/nios2/lineseparator.s
@@ -0,0 +1,4 @@
+mov r5, r4 ; mov r4, r5
+
+
+
diff --git a/gas/testsuite/gas/nios2/mov.d b/gas/testsuite/gas/nios2/mov.d
new file mode 100644
index 0000000000..13bf6db80a
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mov.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 mov
+
+# Test the mov instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> movz \$4,\$5,\$6
+0+0004 <[^>]*> movnz \$4,\$5,\$6
+
diff --git a/gas/testsuite/gas/nios2/mov.s b/gas/testsuite/gas/nios2/mov.s
new file mode 100644
index 0000000000..a66aaeb983
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mov.s
@@ -0,0 +1,5 @@
+# Source file used to test the movz and movnz instructions
+
+foo:
+ movz $4,$5,$6
+ movnz $4,$5,$6
diff --git a/gas/testsuite/gas/nios2/movi.d b/gas/testsuite/gas/nios2/movi.d
new file mode 100644
index 0000000000..9e35c7b9d2
--- /dev/null
+++ b/gas/testsuite/gas/nios2/movi.d
@@ -0,0 +1,13 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 movi
+
+# Test implicit conversion of movi/movhi etc
+.*: file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> movi r2,32
+0+0004 <[^>]*> movhi r2,8192
+0+0008 <[^>]*> movhi r2,65535
+0+000c <[^>]*> orhi r2,r5,65535
+0+0010 <[^>]*> xorhi r2,r10,65535
+0+0014 <[^>]*> andhi r2,r15,65535
diff --git a/gas/testsuite/gas/nios2/movi.s b/gas/testsuite/gas/nios2/movi.s
new file mode 100644
index 0000000000..07d9fed2bd
--- /dev/null
+++ b/gas/testsuite/gas/nios2/movi.s
@@ -0,0 +1,21 @@
+# Source file used to test silent conversion of
+# movi to orhi etc
+
+foo:
+# this doesn't get converted
+movi r2, 0x20
+
+# this does
+movi r2, 0x20000000
+
+# addi should convert only if the source register is r0
+addi r2, r0, 0xffff0000
+# but we can't test for non-conversion because the value would
+# be out of range
+
+# logical ops should convert for any register
+ori r2, r5, 0xffff0000
+xori r2, r10, 0xffff0000
+andi r2, r15, 0xffff0000
+
+
diff --git a/gas/testsuite/gas/nios2/movia.d b/gas/testsuite/gas/nios2/movia.d
new file mode 100644
index 0000000000..c255ace41b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/movia.d
@@ -0,0 +1,18 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 movia
+
+# Test the movia instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> movhi r2,32897
+0+0004 <[^>]*> addi r2,r2,-32640
+0+0008 <[^>]*> movhi r3,0
+ 8: R_NIOS2_HIADJ16 sym-0x80000000
+0+000c <[^>]*> addi r3,r3,0
+ c: R_NIOS2_LO16 sym-0x80000000
+0+0010 <[^>]*> movhi r4,0
+ 10: R_NIOS2_HIADJ16 sym-0x7fffffff
+0+0014 <[^>]*> addi r4,r4,0
+ 14: R_NIOS2_LO16 sym-0x7fffffff
diff --git a/gas/testsuite/gas/nios2/movia.s b/gas/testsuite/gas/nios2/movia.s
new file mode 100644
index 0000000000..fe1d56cfef
--- /dev/null
+++ b/gas/testsuite/gas/nios2/movia.s
@@ -0,0 +1,6 @@
+# Test program for movia reg, immed32 macro
+
+foo:
+ movia r2, 0x80808080
+ movia r3, sym + 0x80000000
+ movia r4, sym - 0x7fffffff
diff --git a/gas/testsuite/gas/nios2/mul.d b/gas/testsuite/gas/nios2/mul.d
new file mode 100644
index 0000000000..79e86d1801
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mul.d
@@ -0,0 +1,19 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 mul
+
+# Test the mul macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> mul r4,r5,r6
+0+0004 <[^>]*> muli r4,r5,0
+0+0008 <[^>]*> muli r4,r5,1
+0+000c <[^>]*> muli r4,r5,-32768
+0+0010 <[^>]*> muli r4,r5,32767
+0+0014 <[^>]*> muli r4,r5,0
+[ ]*14: R_NIOS2_S16 undefined_symbol
+0+0018 <[^>]*> muli r4,r5,16448
+0+001c <[^>]*> mulxss r4,r5,r6
+0+0020 <[^>]*> mulxsu r4,r5,r6
+0+0024 <[^>]*> mulxuu r4,r5,r6
diff --git a/gas/testsuite/gas/nios2/mul.s b/gas/testsuite/gas/nios2/mul.s
new file mode 100644
index 0000000000..3e47bc7b96
--- /dev/null
+++ b/gas/testsuite/gas/nios2/mul.s
@@ -0,0 +1,15 @@
+# Source file used to test the mul macro.
+
+foo:
+ mul r4,r5,r6
+ muli r4,r5,0
+ muli r4,r5,1
+ muli r4,r5,-0x8000
+ muli r4,r5,0x7fff
+ muli r4,r5,undefined_symbol
+ muli r4,r5,defined_symbol
+ mulxss r4,r5,r6
+ mulxsu r4,r5,r6
+ mulxuu r4,r5,r6
+.data
+.set defined_symbol, 0x4040
diff --git a/gas/testsuite/gas/nios2/nios2.exp b/gas/testsuite/gas/nios2/nios2.exp
new file mode 100644
index 0000000000..9390e8b434
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nios2.exp
@@ -0,0 +1,75 @@
+#
+# Some generic Nios II tests
+#
+
+proc run_list_test { name } {
+ global srcdir subdir
+ set testname "NIOS2 $name"
+ set file $srcdir/$subdir/$name
+ gas_run ${name}.s "" ">&dump.out"
+ if { [regexp_diff "dump.out" "${file}.l"] } then {
+ fail $testname
+ verbose "output is [file_contents "dump.out"]" 2
+ return
+ }
+ pass $testname
+}
+
+if { [istarget nios2-*-*] } then {
+
+ run_dump_test "add"
+ run_dump_test "and"
+ run_dump_test "align_fill"
+ run_dump_test "align_text"
+
+ run_dump_test "branch"
+
+ run_dump_test "break"
+ run_dump_test "bret"
+ run_dump_test "cache"
+
+ run_dump_test "call"
+ run_dump_test "call26"
+
+ run_dump_test "cmp"
+
+ run_dump_test "jmp"
+ run_dump_test "ldw"
+ run_dump_test "ldh"
+ run_dump_test "ldb"
+
+ run_dump_test "flushda"
+
+ run_dump_test "mul"
+
+ run_dump_test "nor"
+ run_dump_test "or"
+
+ run_dump_test "ctl"
+ run_dump_test "ret"
+ run_dump_test "rotate"
+
+ run_dump_test "stw"
+ run_dump_test "sth"
+ run_dump_test "stb"
+
+ run_dump_test "sub"
+ run_dump_test "sync"
+ run_dump_test "trap"
+ run_dump_test "tret"
+
+ run_dump_test "custom"
+ run_dump_test "xor"
+ run_dump_test "movia"
+
+ run_dump_test "complex"
+ run_dump_test "comments"
+ run_dump_test "etbt"
+ run_dump_test "lineseparator"
+ run_dump_test "movi"
+
+ run_list_test "illegal"
+ run_list_test "warn_nobreak"
+ run_list_test "warn_noat"
+
+}
diff --git a/gas/testsuite/gas/nios2/nor.d b/gas/testsuite/gas/nios2/nor.d
new file mode 100644
index 0000000000..fab8e6914d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nor.d
@@ -0,0 +1,9 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 nor
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> nor r6,r8,r10
diff --git a/gas/testsuite/gas/nios2/nor.s b/gas/testsuite/gas/nios2/nor.s
new file mode 100644
index 0000000000..da7825478d
--- /dev/null
+++ b/gas/testsuite/gas/nios2/nor.s
@@ -0,0 +1,5 @@
+# Source file used to test the nor instruction
+
+foo:
+ nor r6,r8,r10
+
diff --git a/gas/testsuite/gas/nios2/or.d b/gas/testsuite/gas/nios2/or.d
new file mode 100644
index 0000000000..e5035bc502
--- /dev/null
+++ b/gas/testsuite/gas/nios2/or.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 or
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> or r6,r8,r10
+0+0004 <[^>]*> orhi r6,r7,65535
+0+0008 <[^>]*> ori r6,r7,65535
diff --git a/gas/testsuite/gas/nios2/or.s b/gas/testsuite/gas/nios2/or.s
new file mode 100644
index 0000000000..675df17055
--- /dev/null
+++ b/gas/testsuite/gas/nios2/or.s
@@ -0,0 +1,7 @@
+# Source file used to test the nor instruction
+
+foo:
+ or r6,r8,r10
+ orhi r6,r7,0xffff
+ ori r6,r7,0xffff
+
diff --git a/gas/testsuite/gas/nios2/ret.d b/gas/testsuite/gas/nios2/ret.d
new file mode 100644
index 0000000000..b0719317c5
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 ret
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> ret
+
diff --git a/gas/testsuite/gas/nios2/ret.s b/gas/testsuite/gas/nios2/ret.s
new file mode 100644
index 0000000000..69b76bc551
--- /dev/null
+++ b/gas/testsuite/gas/nios2/ret.s
@@ -0,0 +1,5 @@
+# Source file used to test the ret instructions
+foo:
+ ret
+
+
diff --git a/gas/testsuite/gas/nios2/rol.d b/gas/testsuite/gas/nios2/rol.d
new file mode 100644
index 0000000000..2128dd5704
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rol.d
@@ -0,0 +1,40 @@
+#objdump: -dr --prefix-addresses -mmips:3000
+#as: -march=r3000 -mtune=r3000
+#name: MIPS R3000 rol
+
+# Test the rol and ror macros.
+
+.*: +file format .*mips.*
+
+Disassembly of section .text:
+0+0000 <[^>]*> negu at,a1
+0+0004 <[^>]*> srlv at,a0,at
+0+0008 <[^>]*> sllv a0,a0,a1
+0+000c <[^>]*> or a0,a0,at
+0+0010 <[^>]*> negu at,a2
+0+0014 <[^>]*> srlv at,a1,at
+0+0018 <[^>]*> sllv a0,a1,a2
+0+001c <[^>]*> or a0,a0,at
+0+0020 <[^>]*> sll at,a0,0x1
+0+0024 <[^>]*> srl a0,a0,0x1f
+0+0028 <[^>]*> or a0,a0,at
+0+002c <[^>]*> sll at,a1,0x1
+0+0030 <[^>]*> srl a0,a1,0x1f
+0+0034 <[^>]*> or a0,a0,at
+0+0038 <[^>]*> srl a0,a1,0x0
+0+003c <[^>]*> negu at,a1
+0+0040 <[^>]*> sllv at,a0,at
+0+0044 <[^>]*> srlv a0,a0,a1
+0+0048 <[^>]*> or a0,a0,at
+0+004c <[^>]*> negu at,a2
+0+0050 <[^>]*> sllv at,a1,at
+0+0054 <[^>]*> srlv a0,a1,a2
+0+0058 <[^>]*> or a0,a0,at
+0+005c <[^>]*> srl at,a0,0x1
+0+0060 <[^>]*> sll a0,a0,0x1f
+0+0064 <[^>]*> or a0,a0,at
+0+0068 <[^>]*> srl at,a1,0x1
+0+006c <[^>]*> sll a0,a1,0x1f
+0+0070 <[^>]*> or a0,a0,at
+0+0074 <[^>]*> srl a0,a1,0x0
+ ...
diff --git a/gas/testsuite/gas/nios2/rol.s b/gas/testsuite/gas/nios2/rol.s
new file mode 100644
index 0000000000..988d7021c4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rol.s
@@ -0,0 +1,15 @@
+# Source file used to test the rol and ror macros.
+
+foo:
+ rol $4,$5
+ rol $4,$5,$6
+ rol $4,1
+ rol $4,$5,1
+ rol $4,$5,0
+
+ ror $4,$5
+ ror $4,$5,$6
+ ror $4,1
+ ror $4,$5,1
+ ror $4,$5,0
+ .space 8
diff --git a/gas/testsuite/gas/nios2/rotate.d b/gas/testsuite/gas/nios2/rotate.d
new file mode 100644
index 0000000000..0f54f43a46
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rotate.d
@@ -0,0 +1,17 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 rotate
+
+# Test the and macro.
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> rol r4,r4,r4
+0+0004 <[^>]*> roli r4,r4,31
+0+0008 <[^>]*> ror r4,r4,r4
+0+000c <[^>]*> sll r4,r4,r4
+0+0010 <[^>]*> slli r4,r4,24
+0+0014 <[^>]*> sra r4,r4,r4
+0+0018 <[^>]*> srai r4,r4,10
+0+001c <[^>]*> srl r4,r4,r4
+0+0020 <[^>]*> srli r4,r4,5
diff --git a/gas/testsuite/gas/nios2/rotate.s b/gas/testsuite/gas/nios2/rotate.s
new file mode 100644
index 0000000000..a960e192b6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rotate.s
@@ -0,0 +1,13 @@
+# test Nios II rotate instructions
+
+.text
+foo:
+ rol r4,r4,r4
+ roli r4,r4,31
+ ror r4,r4,r4
+ sll r4,r4,r4
+ slli r4,r4,24
+ sra r4,r4,r4
+ srai r4,r4,10
+ srl r4,r4,r4
+ srli r4,r4,5
diff --git a/gas/testsuite/gas/nios2/stb.d b/gas/testsuite/gas/nios2/stb.d
new file mode 100644
index 0000000000..e3b48181f4
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stb.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 stb
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> stb r4,0\(zero\)
+0+0004 <[^>]*> stb r4,4\(zero\)
+0+0008 <[^>]*> stb r4,32764\(zero\)
+0+000c <[^>]*> stb r4,-32768\(zero\)
+0+0010 <[^>]*> stb r4,0\(r5\)
+0+0014 <[^>]*> stb r4,4\(r5\)
+0+0018 <[^>]*> stb r4,32764\(r5\)
+0+001c <[^>]*> stb r4,-32768\(r5\)
+0+0020 <[^>]*> stb r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> stb r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> stb r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> stb r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> stb r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> stb r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> stb r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> stb r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> stb r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> stb r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> stb r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> stb r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> stb r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> stb r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> stb r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> stb r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> stb r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> stb r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> stb r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> stb r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> stb r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> stb r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> stb r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> stb r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> stb r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> stb r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> stb r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> stb r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> stb r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> stb r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> stb r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> stb r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> stb r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> stb r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> stb r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> stb r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> stb r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> stb r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> stb r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> stb r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> stb r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> stb r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> stb r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> stbio r4,0\(zero\)
+0+00d0 <[^>]*> stbio r4,4\(zero\)
+0+00d4 <[^>]*> stbio r4,32764\(zero\)
+0+00d8 <[^>]*> stbio r4,-32768\(zero\)
+0+00dc <[^>]*> stbio r4,0\(r5\)
+0+00e0 <[^>]*> stbio r4,4\(r5\)
+0+00e4 <[^>]*> stbio r4,32764\(r5\)
+0+00e8 <[^>]*> stbio r4,-32768\(r5\)
+0+00ec <[^>]*> stbio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> stbio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> stbio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> stbio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> stbio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> stbio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> stbio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> stbio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> stbio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> stbio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> stbio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> stbio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> stbio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> stbio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> stbio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> stbio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> stbio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> stbio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> stbio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> stbio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> stbio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> stbio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> stbio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> stbio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> stbio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> stbio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> stbio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> stbio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> stbio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> stbio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> stbio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> stbio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> stbio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> stbio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> stbio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> stbio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> stbio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> stbio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> stbio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> stbio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> stbio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> stbio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> stbio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/stb.s b/gas/testsuite/gas/nios2/stb.s
new file mode 100644
index 0000000000..8078e9413b
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stb.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
+ stb r4,0(r0)
+ stb r4,4(r0)
+ stb r4,0x7ffc(r0)
+ stb r4,-0x8000(r0)
+ stb r4,0(r5)
+ stb r4,4(r5)
+ stb r4,0x7ffc(r5)
+ stb r4,-0x8000(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-0x8000(r0)
+ stb r4,big_external_data_label-0x8000(r0)
+ stb r4,small_external_data_label-0x8000(r0)
+ stb r4,big_external_common-0x8000(r0)
+ stb r4,small_external_common-0x8000(r0)
+ stb r4,big_local_common-0x8000(r0)
+ stb r4,small_local_common-0x8000(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-0x8000(r5)
+ stb r4,big_external_data_label-0x8000(r5)
+ stb r4,small_external_data_label-0x8000(r5)
+ stb r4,big_external_common-0x8000(r5)
+ stb r4,small_external_common-0x8000(r5)
+ stb r4,big_local_common-0x8000(r5)
+ stb r4,small_local_common-0x8000(r5)
+
+ stbio r4,0(r0)
+ stbio r4,4(r0)
+ stbio r4,0x7ffc(r0)
+ stbio r4,-0x8000(r0)
+ stbio r4,0(r5)
+ stbio r4,4(r5)
+ stbio r4,0x7ffc(r5)
+ stbio r4,-0x8000(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-0x8000(r0)
+ stbio r4,big_external_data_label-0x8000(r0)
+ stbio r4,small_external_data_label-0x8000(r0)
+ stbio r4,big_external_common-0x8000(r0)
+ stbio r4,small_external_common-0x8000(r0)
+ stbio r4,big_local_common-0x8000(r0)
+ stbio r4,small_local_common-0x8000(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-0x8000(r5)
+ stbio r4,big_external_data_label-0x8000(r5)
+ stbio r4,small_external_data_label-0x8000(r5)
+ stbio r4,big_external_common-0x8000(r5)
+ stbio r4,small_external_common-0x8000(r5)
+ stbio r4,big_local_common-0x8000(r5)
+ stbio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/sth.d b/gas/testsuite/gas/nios2/sth.d
new file mode 100644
index 0000000000..76d58d4c85
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sth.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sth
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> sth r4,0\(zero\)
+0+0004 <[^>]*> sth r4,4\(zero\)
+0+0008 <[^>]*> sth r4,32764\(zero\)
+0+000c <[^>]*> sth r4,-32768\(zero\)
+0+0010 <[^>]*> sth r4,0\(r5\)
+0+0014 <[^>]*> sth r4,4\(r5\)
+0+0018 <[^>]*> sth r4,32764\(r5\)
+0+001c <[^>]*> sth r4,-32768\(r5\)
+0+0020 <[^>]*> sth r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> sth r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> sth r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> sth r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> sth r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> sth r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> sth r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> sth r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> sth r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> sth r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> sth r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> sth r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> sth r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> sth r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> sth r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> sth r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> sth r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> sth r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> sth r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> sth r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> sth r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> sth r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> sth r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> sth r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> sth r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> sth r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> sth r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> sth r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> sth r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> sth r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> sth r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> sth r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> sth r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> sth r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> sth r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> sth r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> sth r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> sth r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> sth r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> sth r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> sth r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> sth r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> sth r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> sthio r4,0\(zero\)
+0+00d0 <[^>]*> sthio r4,4\(zero\)
+0+00d4 <[^>]*> sthio r4,32764\(zero\)
+0+00d8 <[^>]*> sthio r4,-32768\(zero\)
+0+00dc <[^>]*> sthio r4,0\(r5\)
+0+00e0 <[^>]*> sthio r4,4\(r5\)
+0+00e4 <[^>]*> sthio r4,32764\(r5\)
+0+00e8 <[^>]*> sthio r4,-32768\(r5\)
+0+00ec <[^>]*> sthio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> sthio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> sthio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> sthio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> sthio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> sthio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> sthio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> sthio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> sthio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> sthio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> sthio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> sthio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> sthio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> sthio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> sthio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> sthio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> sthio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> sthio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> sthio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> sthio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> sthio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> sthio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> sthio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> sthio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> sthio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> sthio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> sthio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> sthio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> sthio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> sthio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> sthio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> sthio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> sthio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> sthio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> sthio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> sthio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> sthio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> sthio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> sthio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> sthio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> sthio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> sthio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> sthio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/sth.s b/gas/testsuite/gas/nios2/sth.s
new file mode 100644
index 0000000000..4b9390bb5c
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sth.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
+ sth r4,0(r0)
+ sth r4,4(r0)
+ sth r4,0x7ffc(r0)
+ sth r4,-0x8000(r0)
+ sth r4,0(r5)
+ sth r4,4(r5)
+ sth r4,0x7ffc(r5)
+ sth r4,-0x8000(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-0x8000(r0)
+ sth r4,big_external_data_label-0x8000(r0)
+ sth r4,small_external_data_label-0x8000(r0)
+ sth r4,big_external_common-0x8000(r0)
+ sth r4,small_external_common-0x8000(r0)
+ sth r4,big_local_common-0x8000(r0)
+ sth r4,small_local_common-0x8000(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-0x8000(r5)
+ sth r4,big_external_data_label-0x8000(r5)
+ sth r4,small_external_data_label-0x8000(r5)
+ sth r4,big_external_common-0x8000(r5)
+ sth r4,small_external_common-0x8000(r5)
+ sth r4,big_local_common-0x8000(r5)
+ sth r4,small_local_common-0x8000(r5)
+
+ sthio r4,0(r0)
+ sthio r4,4(r0)
+ sthio r4,0x7ffc(r0)
+ sthio r4,-0x8000(r0)
+ sthio r4,0(r5)
+ sthio r4,4(r5)
+ sthio r4,0x7ffc(r5)
+ sthio r4,-0x8000(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-0x8000(r0)
+ sthio r4,big_external_data_label-0x8000(r0)
+ sthio r4,small_external_data_label-0x8000(r0)
+ sthio r4,big_external_common-0x8000(r0)
+ sthio r4,small_external_common-0x8000(r0)
+ sthio r4,big_local_common-0x8000(r0)
+ sthio r4,small_local_common-0x8000(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-0x8000(r5)
+ sthio r4,big_external_data_label-0x8000(r5)
+ sthio r4,small_external_data_label-0x8000(r5)
+ sthio r4,big_external_common-0x8000(r5)
+ sthio r4,small_external_common-0x8000(r5)
+ sthio r4,big_local_common-0x8000(r5)
+ sthio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/stw.d b/gas/testsuite/gas/nios2/stw.d
new file mode 100644
index 0000000000..6dcf4e58e0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stw.d
@@ -0,0 +1,196 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 stw
+
+# Test the ld instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> stw r4,0\(zero\)
+0+0004 <[^>]*> stw r4,4\(zero\)
+0+0008 <[^>]*> stw r4,32764\(zero\)
+0+000c <[^>]*> stw r4,-32768\(zero\)
+0+0010 <[^>]*> stw r4,0\(r5\)
+0+0014 <[^>]*> stw r4,4\(r5\)
+0+0018 <[^>]*> stw r4,32764\(r5\)
+0+001c <[^>]*> stw r4,-32768\(r5\)
+0+0020 <[^>]*> stw r4,0\(zero\)
+[ ]*20: R_NIOS2_S16 .data
+0+0024 <[^>]*> stw r4,0\(zero\)
+[ ]*24: R_NIOS2_S16 big_external_data_label
+0+0028 <[^>]*> stw r4,0\(zero\)
+[ ]*28: R_NIOS2_S16 small_external_data_label
+0+002c <[^>]*> stw r4,0\(zero\)
+[ ]*2c: R_NIOS2_S16 big_external_common
+0+0030 <[^>]*> stw r4,0\(zero\)
+[ ]*30: R_NIOS2_S16 small_external_common
+0+0034 <[^>]*> stw r4,0\(zero\)
+[ ]*34: R_NIOS2_S16 .bss
+0+0038 <[^>]*> stw r4,0\(zero\)
+[ ]*38: R_NIOS2_S16 .bss\+0x4000
+0+003c <[^>]*> stw r4,0\(zero\)
+[ ]*3c: R_NIOS2_S16 .data\+0x4
+0+0040 <[^>]*> stw r4,0\(zero\)
+[ ]*40: R_NIOS2_S16 big_external_data_label\+0x4
+0+0044 <[^>]*> stw r4,0\(zero\)
+[ ]*44: R_NIOS2_S16 small_external_data_label\+0x4
+0+0048 <[^>]*> stw r4,0\(zero\)
+[ ]*48: R_NIOS2_S16 big_external_common\+0x4
+0+004c <[^>]*> stw r4,0\(zero\)
+[ ]*4c: R_NIOS2_S16 small_external_common\+0x4
+0+0050 <[^>]*> stw r4,0\(zero\)
+[ ]*50: R_NIOS2_S16 .bss\+0x4
+0+0054 <[^>]*> stw r4,0\(zero\)
+[ ]*54: R_NIOS2_S16 .bss\+0x4004
+0+0058 <[^>]*> stw r4,0\(zero\)
+[ ]*58: R_NIOS2_S16 .data-0x8000
+0+005c <[^>]*> stw r4,0\(zero\)
+[ ]*5c: R_NIOS2_S16 big_external_data_label-0x8000
+0+0060 <[^>]*> stw r4,0\(zero\)
+[ ]*60: R_NIOS2_S16 small_external_data_label-0x8000
+0+0064 <[^>]*> stw r4,0\(zero\)
+[ ]*64: R_NIOS2_S16 big_external_common-0x8000
+0+0068 <[^>]*> stw r4,0\(zero\)
+[ ]*68: R_NIOS2_S16 small_external_common-0x8000
+0+006c <[^>]*> stw r4,0\(zero\)
+[ ]*6c: R_NIOS2_S16 .bss-0x8000
+0+0070 <[^>]*> stw r4,0\(zero\)
+[ ]*70: R_NIOS2_S16 .bss-0x4000
+0+0074 <[^>]*> stw r4,0\(zero\)
+[ ]*74: R_NIOS2_S16 .data\+0x10000
+0+0078 <[^>]*> stw r4,0\(r5\)
+[ ]*78: R_NIOS2_S16 .data
+0+007c <[^>]*> stw r4,0\(r5\)
+[ ]*7c: R_NIOS2_S16 big_external_data_label
+0+0080 <[^>]*> stw r4,0\(r5\)
+[ ]*80: R_NIOS2_S16 small_external_data_label
+0+0084 <[^>]*> stw r4,0\(r5\)
+[ ]*84: R_NIOS2_S16 big_external_common
+0+0088 <[^>]*> stw r4,0\(r5\)
+[ ]*88: R_NIOS2_S16 small_external_common
+0+008c <[^>]*> stw r4,0\(r5\)
+[ ]*8c: R_NIOS2_S16 .bss
+0+0090 <[^>]*> stw r4,0\(r5\)
+[ ]*90: R_NIOS2_S16 .bss\+0x4000
+0+0094 <[^>]*> stw r4,0\(r5\)
+[ ]*94: R_NIOS2_S16 .data\+0x4
+0+0098 <[^>]*> stw r4,0\(r5\)
+[ ]*98: R_NIOS2_S16 big_external_data_label\+0x4
+0+009c <[^>]*> stw r4,0\(r5\)
+[ ]*9c: R_NIOS2_S16 small_external_data_label\+0x4
+0+00a0 <[^>]*> stw r4,0\(r5\)
+[ ]*a0: R_NIOS2_S16 big_external_common\+0x4
+0+00a4 <[^>]*> stw r4,0\(r5\)
+[ ]*a4: R_NIOS2_S16 small_external_common\+0x4
+0+00a8 <[^>]*> stw r4,0\(r5\)
+[ ]*a8: R_NIOS2_S16 .bss\+0x4
+0+00ac <[^>]*> stw r4,0\(r5\)
+[ ]*ac: R_NIOS2_S16 .bss\+0x4004
+0+00b0 <[^>]*> stw r4,0\(r5\)
+[ ]*b0: R_NIOS2_S16 .data-0x8000
+0+00b4 <[^>]*> stw r4,0\(r5\)
+[ ]*b4: R_NIOS2_S16 big_external_data_label-0x8000
+0+00b8 <[^>]*> stw r4,0\(r5\)
+[ ]*b8: R_NIOS2_S16 small_external_data_label-0x8000
+0+00bc <[^>]*> stw r4,0\(r5\)
+[ ]*bc: R_NIOS2_S16 big_external_common-0x8000
+0+00c0 <[^>]*> stw r4,0\(r5\)
+[ ]*c0: R_NIOS2_S16 small_external_common-0x8000
+0+00c4 <[^>]*> stw r4,0\(r5\)
+[ ]*c4: R_NIOS2_S16 .bss-0x8000
+0+00c8 <[^>]*> stw r4,0\(r5\)
+[ ]*c8: R_NIOS2_S16 .bss-0x4000
+0+00cc <[^>]*> stwio r4,0\(zero\)
+0+00d0 <[^>]*> stwio r4,4\(zero\)
+0+00d4 <[^>]*> stwio r4,32764\(zero\)
+0+00d8 <[^>]*> stwio r4,-32768\(zero\)
+0+00dc <[^>]*> stwio r4,0\(r5\)
+0+00e0 <[^>]*> stwio r4,4\(r5\)
+0+00e4 <[^>]*> stwio r4,32764\(r5\)
+0+00e8 <[^>]*> stwio r4,-32768\(r5\)
+0+00ec <[^>]*> stwio r4,0\(zero\)
+[ ]*ec: R_NIOS2_S16 .data
+0+00f0 <[^>]*> stwio r4,0\(zero\)
+[ ]*f0: R_NIOS2_S16 big_external_data_label
+0+00f4 <[^>]*> stwio r4,0\(zero\)
+[ ]*f4: R_NIOS2_S16 small_external_data_label
+0+00f8 <[^>]*> stwio r4,0\(zero\)
+[ ]*f8: R_NIOS2_S16 big_external_common
+0+00fc <[^>]*> stwio r4,0\(zero\)
+[ ]*fc: R_NIOS2_S16 small_external_common
+0+0100 <[^>]*> stwio r4,0\(zero\)
+[ ]*100: R_NIOS2_S16 .bss
+0+0104 <[^>]*> stwio r4,0\(zero\)
+[ ]*104: R_NIOS2_S16 .bss\+0x4000
+0+0108 <[^>]*> stwio r4,0\(zero\)
+[ ]*108: R_NIOS2_S16 .data\+0x4
+0+010c <[^>]*> stwio r4,0\(zero\)
+[ ]*10c: R_NIOS2_S16 big_external_data_label\+0x4
+0+0110 <[^>]*> stwio r4,0\(zero\)
+[ ]*110: R_NIOS2_S16 small_external_data_label\+0x4
+0+0114 <[^>]*> stwio r4,0\(zero\)
+[ ]*114: R_NIOS2_S16 big_external_common\+0x4
+0+0118 <[^>]*> stwio r4,0\(zero\)
+[ ]*118: R_NIOS2_S16 small_external_common\+0x4
+0+011c <[^>]*> stwio r4,0\(zero\)
+[ ]*11c: R_NIOS2_S16 .bss\+0x4
+0+0120 <[^>]*> stwio r4,0\(zero\)
+[ ]*120: R_NIOS2_S16 .bss\+0x4004
+0+0124 <[^>]*> stwio r4,0\(zero\)
+[ ]*124: R_NIOS2_S16 .data-0x8000
+0+0128 <[^>]*> stwio r4,0\(zero\)
+[ ]*128: R_NIOS2_S16 big_external_data_label-0x8000
+0+012c <[^>]*> stwio r4,0\(zero\)
+[ ]*12c: R_NIOS2_S16 small_external_data_label-0x8000
+0+0130 <[^>]*> stwio r4,0\(zero\)
+[ ]*130: R_NIOS2_S16 big_external_common-0x8000
+0+0134 <[^>]*> stwio r4,0\(zero\)
+[ ]*134: R_NIOS2_S16 small_external_common-0x8000
+0+0138 <[^>]*> stwio r4,0\(zero\)
+[ ]*138: R_NIOS2_S16 .bss-0x8000
+0+013c <[^>]*> stwio r4,0\(zero\)
+[ ]*13c: R_NIOS2_S16 .bss-0x4000
+0+0140 <[^>]*> stwio r4,0\(zero\)
+[ ]*140: R_NIOS2_S16 .data\+0x10000
+0+0144 <[^>]*> stwio r4,0\(r5\)
+[ ]*144: R_NIOS2_S16 .data
+0+0148 <[^>]*> stwio r4,0\(r5\)
+[ ]*148: R_NIOS2_S16 big_external_data_label
+0+014c <[^>]*> stwio r4,0\(r5\)
+[ ]*14c: R_NIOS2_S16 small_external_data_label
+0+0150 <[^>]*> stwio r4,0\(r5\)
+[ ]*150: R_NIOS2_S16 big_external_common
+0+0154 <[^>]*> stwio r4,0\(r5\)
+[ ]*154: R_NIOS2_S16 small_external_common
+0+0158 <[^>]*> stwio r4,0\(r5\)
+[ ]*158: R_NIOS2_S16 .bss
+0+015c <[^>]*> stwio r4,0\(r5\)
+[ ]*15c: R_NIOS2_S16 .bss\+0x4000
+0+0160 <[^>]*> stwio r4,0\(r5\)
+[ ]*160: R_NIOS2_S16 .data\+0x4
+0+0164 <[^>]*> stwio r4,0\(r5\)
+[ ]*164: R_NIOS2_S16 big_external_data_label\+0x4
+0+0168 <[^>]*> stwio r4,0\(r5\)
+[ ]*168: R_NIOS2_S16 small_external_data_label\+0x4
+0+016c <[^>]*> stwio r4,0\(r5\)
+[ ]*16c: R_NIOS2_S16 big_external_common\+0x4
+0+0170 <[^>]*> stwio r4,0\(r5\)
+[ ]*170: R_NIOS2_S16 small_external_common\+0x4
+0+0174 <[^>]*> stwio r4,0\(r5\)
+[ ]*174: R_NIOS2_S16 .bss\+0x4
+0+0178 <[^>]*> stwio r4,0\(r5\)
+[ ]*178: R_NIOS2_S16 .bss\+0x4004
+0+017c <[^>]*> stwio r4,0\(r5\)
+[ ]*17c: R_NIOS2_S16 .data-0x8000
+0+0180 <[^>]*> stwio r4,0\(r5\)
+[ ]*180: R_NIOS2_S16 big_external_data_label-0x8000
+0+0184 <[^>]*> stwio r4,0\(r5\)
+[ ]*184: R_NIOS2_S16 small_external_data_label-0x8000
+0+0188 <[^>]*> stwio r4,0\(r5\)
+[ ]*188: R_NIOS2_S16 big_external_common-0x8000
+0+018c <[^>]*> stwio r4,0\(r5\)
+[ ]*18c: R_NIOS2_S16 small_external_common-0x8000
+0+0190 <[^>]*> stwio r4,0\(r5\)
+[ ]*190: R_NIOS2_S16 .bss-0x8000
+0+0194 <[^>]*> stwio r4,0\(r5\)
+[ ]*194: R_NIOS2_S16 .bss-0x4000
diff --git a/gas/testsuite/gas/nios2/stw.s b/gas/testsuite/gas/nios2/stw.s
new file mode 100644
index 0000000000..fa5c72fdfa
--- /dev/null
+++ b/gas/testsuite/gas/nios2/stw.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
+ stw r4,0(r0)
+ stw r4,4(r0)
+ stw r4,0x7ffc(r0)
+ stw r4,-0x8000(r0)
+ stw r4,0(r5)
+ stw r4,4(r5)
+ stw r4,0x7ffc(r5)
+ stw r4,-0x8000(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-0x8000(r0)
+ stw r4,big_external_data_label-0x8000(r0)
+ stw r4,small_external_data_label-0x8000(r0)
+ stw r4,big_external_common-0x8000(r0)
+ stw r4,small_external_common-0x8000(r0)
+ stw r4,big_local_common-0x8000(r0)
+ stw r4,small_local_common-0x8000(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-0x8000(r5)
+ stw r4,big_external_data_label-0x8000(r5)
+ stw r4,small_external_data_label-0x8000(r5)
+ stw r4,big_external_common-0x8000(r5)
+ stw r4,small_external_common-0x8000(r5)
+ stw r4,big_local_common-0x8000(r5)
+ stw r4,small_local_common-0x8000(r5)
+
+ stwio r4,0(r0)
+ stwio r4,4(r0)
+ stwio r4,0x7ffc(r0)
+ stwio r4,-0x8000(r0)
+ stwio r4,0(r5)
+ stwio r4,4(r5)
+ stwio r4,0x7ffc(r5)
+ stwio r4,-0x8000(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-0x8000(r0)
+ stwio r4,big_external_data_label-0x8000(r0)
+ stwio r4,small_external_data_label-0x8000(r0)
+ stwio r4,big_external_common-0x8000(r0)
+ stwio r4,small_external_common-0x8000(r0)
+ stwio r4,big_local_common-0x8000(r0)
+ stwio r4,small_local_common-0x8000(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-0x8000(r5)
+ stwio r4,big_external_data_label-0x8000(r5)
+ stwio r4,small_external_data_label-0x8000(r5)
+ stwio r4,big_external_common-0x8000(r5)
+ stwio r4,small_external_common-0x8000(r5)
+ stwio r4,big_local_common-0x8000(r5)
+ stwio r4,small_local_common-0x8000(r5)
diff --git a/gas/testsuite/gas/nios2/sub.d b/gas/testsuite/gas/nios2/sub.d
new file mode 100644
index 0000000000..69b02856fe
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sub.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sub
+
+# Test the add instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> sub r4,r4,r4
+
diff --git a/gas/testsuite/gas/nios2/sub.s b/gas/testsuite/gas/nios2/sub.s
new file mode 100644
index 0000000000..34f00da770
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sub.s
@@ -0,0 +1,4 @@
+# Source file used to test the add and addi instructions.
+
+foo:
+ sub r4,r4,r4
diff --git a/gas/testsuite/gas/nios2/sync.d b/gas/testsuite/gas/nios2/sync.d
new file mode 100644
index 0000000000..f0949e2438
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sync.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 sync
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section \.text:
+0+0000 <foo> sync
+
diff --git a/gas/testsuite/gas/nios2/sync.s b/gas/testsuite/gas/nios2/sync.s
new file mode 100644
index 0000000000..fe05d47167
--- /dev/null
+++ b/gas/testsuite/gas/nios2/sync.s
@@ -0,0 +1,5 @@
+# Source file used to test the sync instructions
+foo:
+ sync
+
+
diff --git a/gas/testsuite/gas/nios2/trap.d b/gas/testsuite/gas/nios2/trap.d
new file mode 100644
index 0000000000..003ff69a58
--- /dev/null
+++ b/gas/testsuite/gas/nios2/trap.d
@@ -0,0 +1,7 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 trap
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> trap
diff --git a/gas/testsuite/gas/nios2/trap.s b/gas/testsuite/gas/nios2/trap.s
new file mode 100644
index 0000000000..1eb3c7e890
--- /dev/null
+++ b/gas/testsuite/gas/nios2/trap.s
@@ -0,0 +1,3 @@
+# Source file used to test the ret instructions
+foo:
+ trap
diff --git a/gas/testsuite/gas/nios2/tret.d b/gas/testsuite/gas/nios2/tret.d
new file mode 100644
index 0000000000..48e2b51989
--- /dev/null
+++ b/gas/testsuite/gas/nios2/tret.d
@@ -0,0 +1,8 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 tret
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> eret
+
diff --git a/gas/testsuite/gas/nios2/tret.s b/gas/testsuite/gas/nios2/tret.s
new file mode 100644
index 0000000000..42179f1fe1
--- /dev/null
+++ b/gas/testsuite/gas/nios2/tret.s
@@ -0,0 +1,5 @@
+# Source file used to test the ret instructions
+foo:
+ eret
+
+
diff --git a/gas/testsuite/gas/nios2/warn_noat.l b/gas/testsuite/gas/nios2/warn_noat.l
new file mode 100644
index 0000000000..6bc5150f88
--- /dev/null
+++ b/gas/testsuite/gas/nios2/warn_noat.l
@@ -0,0 +1,5 @@
+.*warn_noat.s: Assembler messages:
+.*warn_noat.s:2: Warning: Register at \(r1\) can sometimes be corrupted by assembler optimizations.
+Use .set noat to turn off those optimizations \(and this warning\).
+.*warn_noat.s:8: Warning: Register at \(r1\) can sometimes be corrupted by assembler optimizations.
+Use .set noat to turn off those optimizations \(and this warning\).
diff --git a/gas/testsuite/gas/nios2/warn_noat.s b/gas/testsuite/gas/nios2/warn_noat.s
new file mode 100644
index 0000000000..e99126e6f0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/warn_noat.s
@@ -0,0 +1,8 @@
+.set noat, 2 # This should not cause warning for at to be turned off
+add at, r2, r2
+.set noat # this should turn the warnings off
+add at, r2, r2
+.set at, 3 # this should not turn the warnings on
+add at, r2, r2
+.set at # this should turn the warnings on
+add at, r2, r2
diff --git a/gas/testsuite/gas/nios2/warn_nobreak.l b/gas/testsuite/gas/nios2/warn_nobreak.l
new file mode 100644
index 0000000000..539813d683
--- /dev/null
+++ b/gas/testsuite/gas/nios2/warn_nobreak.l
@@ -0,0 +1,9 @@
+.*warn_nobreak.s: Assembler messages:
+.*warn_nobreak.s:2: Warning: The debugger will corrupt ba \(r30\). If you don't need to debug this
+code then use .set nobreak to turn off this warning.
+.*warn_nobreak.s:3: Warning: The debugger will corrupt bt \(r25\). If you don't need to debug this
+code then use .set nobreak to turn off this warning.
+.*warn_nobreak.s:11: Warning: The debugger will corrupt ba \(r30\). If you don't need to debug this
+code then use .set nobreak to turn off this warning.
+.*warn_nobreak.s:12: Warning: The debugger will corrupt bt \(r25\). If you don't need to debug this
+code then use .set nobreak to turn off this warning.
diff --git a/gas/testsuite/gas/nios2/warn_nobreak.s b/gas/testsuite/gas/nios2/warn_nobreak.s
new file mode 100644
index 0000000000..8e495c06de
--- /dev/null
+++ b/gas/testsuite/gas/nios2/warn_nobreak.s
@@ -0,0 +1,12 @@
+.set nobreak , 2 # This should not cause warning for ba, bt to be turned off
+add ba, r2, r2
+add bt, r2, r2
+.set nobreak # this should turn the warnings off
+add ba, r3, r4
+add bt, r3, r4
+.set break, 3 # this should not turn the warnings on
+add ba, r3, r4
+add bt, r3, r4
+.set break # this should turn the warnings on
+add ba, r3, r4
+add bt, r3, r4
diff --git a/gas/testsuite/gas/nios2/xor.d b/gas/testsuite/gas/nios2/xor.d
new file mode 100644
index 0000000000..de137dc3ab
--- /dev/null
+++ b/gas/testsuite/gas/nios2/xor.d
@@ -0,0 +1,11 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 xor
+
+# Test the nor instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> xor r6,r8,r10
+0+0004 <[^>]*> xorhi r6,r7,65535
+0+0008 <[^>]*> xori r6,r7,65535
diff --git a/gas/testsuite/gas/nios2/xor.s b/gas/testsuite/gas/nios2/xor.s
new file mode 100644
index 0000000000..2c558f77f0
--- /dev/null
+++ b/gas/testsuite/gas/nios2/xor.s
@@ -0,0 +1,7 @@
+# Source file used to test the nor instruction
+
+foo:
+ xor r6,r8,r10
+ xorhi r6,r7,0xffff
+ xori r6,r7,0xffff
+
OpenPOWER on IntegriCloud