aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorKuan-Lin Chen <kuanlinchentw@gmail.com>2013-12-13 11:52:32 +0000
committerNick Clifton <nickc@redhat.com>2013-12-13 11:52:32 +0000
commit35c081572f32263b24554ae40502fb5b51ece8c6 (patch)
tree800c0d49d0635671e8e28c56635702212c6f7fc1 /gas/testsuite
parent8a48ac9579f34efea9bc4f2d5b02230e2ac3dfc1 (diff)
downloadgdb-35c081572f32263b24554ae40502fb5b51ece8c6.zip
gdb-35c081572f32263b24554ae40502fb5b51ece8c6.tar.gz
gdb-35c081572f32263b24554ae40502fb5b51ece8c6.tar.bz2
Add support for Andes NDS32:
BFD: * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add nds32 files. * Makefile.in: Regenerate. * archures.c (bfd_nds32_arch): Add nds32 target. * bfd-in2.h: Regenerate. * config.bfd (nds32*le-*-linux): Add bfd_elf32_nds32lelin_vec and bfd_elf32_nds32belin_vec. (nds32*be-*-linux*): Likewise. (nds32*le-*-*): Add bfd_elf32_nds32le_vec and bfd_elf32_nds32be_vec. (nds32*be-*-*): Likewise. * configure.in (bfd_elf32_nds32be_vec): Add elf32-nds32.lo. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. * configure: Regenerate. * cpu-nds32.c: New file for nds32. * elf-bfd.h: Add NDS32_ELF_DATA. * elf32-nds32.c: New file for nds32. * elf32-nds32.h: New file for nds32. * libbfd.h: Regenerate. * reloc.c: Add relocations for nds32. * targets.c (bfd_elf32_nds32be_vec): New declaration for nds32. (bfd_elf32_nds32le_vec): Likewise. (bfd_elf32_nds32belin_vec): Likewise. (bfd_elf32_nds32lelin_vec): Likewise. BINUTILS: * readelf.c: Include elf/nds32.h (guess_is_rela): Add case for EM_NDS32. (dump_relocations): Add case for EM_NDS32. (decode_NDS32_machine_flags): New. (get_machine_flags): Add case for EM_NDS32. (is_32bit_abs_reloc): Likewise. (is_16bit_abs_reloc): Likewise. (process_nds32_specific): New. (process_arch_specific): Add case for EM_NDS32. * NEWS: Announce Andes nds32 support. * MAINTAINERS: Add nds32 maintainers. TESTSUITE: * binutils-all/objdump.exp: Add NDS32 cpu. * binutils-all/readelf.r: Skip extra reloc created by NDS32. GAS: * Makefile.am (TARGET_CPU_CFILES): Add config/tc-nds32.c. (TARGET_CPU_HFILES): Add config/tc-nds32.h. * Makefile.in: Regenerate. * configure.in (nds32): Add nds32 target extension config support. * configure.tgt : Add case for nds32-*-elf* and nds32-*-linux*. * configure: Regenerate. * config/tc-nds32.c: New file for nds32. * config/tc-nds32.h: New file for nds32. * doc/Makefile.am (CPU_DOCS): Add c-nds32.texi. * doc/Makefile.in: Regenerate. * doc/as.texinfo: Add nds32 options. * doc/all.texi: Set NDS32. * doc/c-nds32.texi: New file dor nds32 document. * NEWS: Announce Andes nds32 support. TESTSUITE: * gas/all/gas.exp: Add expected failures for NDS32. * gas/elf/elf.exp: Likewise. * gas/lns/lns.exp: Use alternate test. * gas/macros/irp.d: Skip for NDS32. * gas/macros/macros.exp: Skip some tests for the NDS32. * gas/macros/rept.d: Skip for NDS32. * gas/macros/test3.d: Skip for NDS32. * gas/nds32: New directory. * gas/nds32/alu-1.s: New test. * gas/nds32/alu-1.d: Likewise. * gas/nds32/alu-2.s: Likewise. * gas/nds32/alu-2.d: Likewise. * gas/nds32/br-1.d: Likewise. * gas/nds32/br-1.s: Likewise. * gas/nds32/br-2.d: Likewise. * gas/nds32/br-2.s: Likewise. * gas/nds32/ji-jr.d: Likewise. * gas/nds32/ji-jr.s: Likewise. * gas/nds32/ls.d: Likewise. * gas/nds32/ls.s: Likewise. * gas/nds32/lsi.d: Likewise. * gas/nds32/lsi.s: Likewise. * gas/nds32/to-16bit-v1.d: Likewise. * gas/nds32/to-16bit-v1.s: Likewise. * gas/nds32/to-16bit-v2.d: Likewise. * gas/nds32/to-16bit-v2.s: Likewise. * gas/nds32/to-16bit-v3.d: Likewise. * gas/nds32/to-16bit-v3.s: Likewise. * gas/nds32/nds32.exp: New test driver. LD: * Makefile.am (ALL_EMULATION_SOURCES): Add nds32 target. * Makefile.in: Regenerate. * configure.tgt: Add case for nds32*le-*-elf*, nds32*be-*-elf*, nds32*le-*-linux-gnu*, and nds32*be-*-linux-gnu*. * emulparams/nds32belf.sh: New file for nds32. * emulparams/nds32belf_linux.sh: Likewise. * emulparams/nds32belf16m.sh: Likewise. * emulparams/nds32elf.sh: Likewise. * emulparams/nds32elf_linux.sh: Likewise. * emulparams/nds32elf16m.sh: Likewise. * emultempl/nds32elf.em: Likewise. * scripttempl/nds32elf.sc}: Likewise. * gen-doc.texi: Set NDS32. * ld.texinfo: Set NDS32. * NEWS: Announce Andes nds32 support. TESTSUITE: * lib/ld-lib.exp: Add NDS32 to list of targets that do not support shared library generation. * ld-nds32: New directory. * ld-nds32/branch.d: New test. * ld-nds32/branch.ld: New test. * ld-nds32/branch.s: New test. * ld-nds32/diff.d: New test. * ld-nds32/diff.ld: New test. * ld-nds32/diff.s: New test. * ld-nds32/gp.d: New test. * ld-nds32/gp.ld: New test. * ld-nds32/gp.s: New test. * ld-nds32/imm.d: New test. * ld-nds32/imm.ld: New test. * ld-nds32/imm.s: New test. * ld-nds32/imm_symbol.s: New test. * ld-nds32/relax_jmp.d: New test. * ld-nds32/relax_jmp.ld: New test. * ld-nds32/relax_jmp.s: New test. * ld-nds32/relax_load_store.d: New test. * ld-nds32/relax_load_store.ld: New test. * ld-nds32/relax_load_store.s: New test. * ld-nds32/nds32.exp: New file. OPCODES: * Makefile.am (TARGET_LIBOPCODES_CFILES): Add nds32-asm.c and nds32-dis.c. * Makefile.in: Regenerate. * configure.in: Add case for bfd_nds32_arch. * configure: Regenerate. * disassemble.c (ARCH_nds32): Define. * nds32-asm.c: New file for nds32. * nds32-asm.h: New file for nds32. * nds32-dis.c: New file for nds32. * nds32-opc.h: New file for nds32. INCLUDE: * dis-asm.h (print_insn_nds32): Add nds32 target. * elf/nds32.h: New file for nds32. * opcode/nds32.h: New file for nds32.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog32
-rw-r--r--gas/testsuite/gas/all/gas.exp8
-rw-r--r--gas/testsuite/gas/elf/elf.exp2
-rw-r--r--gas/testsuite/gas/lns/lns.exp1
-rw-r--r--gas/testsuite/gas/macros/irp.d2
-rw-r--r--gas/testsuite/gas/macros/macros.exp4
-rw-r--r--gas/testsuite/gas/macros/rept.d2
-rw-r--r--gas/testsuite/gas/macros/test3.d1
-rw-r--r--gas/testsuite/gas/nds32/alu-1.d47
-rw-r--r--gas/testsuite/gas/nds32/alu-1.s39
-rw-r--r--gas/testsuite/gas/nds32/alu-2.d42
-rw-r--r--gas/testsuite/gas/nds32/alu-2.s33
-rw-r--r--gas/testsuite/gas/nds32/br-1.d15
-rw-r--r--gas/testsuite/gas/nds32/br-1.s3
-rw-r--r--gas/testsuite/gas/nds32/br-2.d25
-rw-r--r--gas/testsuite/gas/nds32/br-2.s8
-rw-r--r--gas/testsuite/gas/nds32/ji-jr.d18
-rw-r--r--gas/testsuite/gas/nds32/ji-jr.s6
-rw-r--r--gas/testsuite/gas/nds32/ls.d25
-rw-r--r--gas/testsuite/gas/nds32/ls.s17
-rw-r--r--gas/testsuite/gas/nds32/lsi.d26
-rw-r--r--gas/testsuite/gas/nds32/lsi.s17
-rw-r--r--gas/testsuite/gas/nds32/nds32.exp30
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v1.d79
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v1.s70
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v2.d15
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v2.s6
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v3.d25
-rw-r--r--gas/testsuite/gas/nds32/to-16bit-v3.s16
29 files changed, 608 insertions, 6 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index a0dba9f..d9ae4c0 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,35 @@
+2013-12-13 Kuan-Lin Chen <kuanlinchentw@gmail.com>
+
+ * gas/all/gas.exp: Add expected failures for NDS32.
+ * gas/elf/elf.exp: Likewise.
+ * gas/lns/lns.exp: Use alternate test.
+ * gas/macros/irp.d: Skip for NDS32.
+ * gas/macros/macros.exp: Skip some tests for the NDS32.
+ * gas/macros/rept.d: Skip for NDS32.
+ * gas/macros/test3.d: Skip for NDS32.
+ * gas/nds32: New directory.
+ * gas/nds32/alu-1.s: New test.
+ * gas/nds32/alu-1.d: Likewise.
+ * gas/nds32/alu-2.s: Likewise.
+ * gas/nds32/alu-2.d: Likewise.
+ * gas/nds32/br-1.d: Likewise.
+ * gas/nds32/br-1.s: Likewise.
+ * gas/nds32/br-2.d: Likewise.
+ * gas/nds32/br-2.s: Likewise.
+ * gas/nds32/ji-jr.d: Likewise.
+ * gas/nds32/ji-jr.s: Likewise.
+ * gas/nds32/ls.d: Likewise.
+ * gas/nds32/ls.s: Likewise.
+ * gas/nds32/lsi.d: Likewise.
+ * gas/nds32/lsi.s: Likewise.
+ * gas/nds32/to-16bit-v1.d: Likewise.
+ * gas/nds32/to-16bit-v1.s: Likewise.
+ * gas/nds32/to-16bit-v2.d: Likewise.
+ * gas/nds32/to-16bit-v2.s: Likewise.
+ * gas/nds32/to-16bit-v3.d: Likewise.
+ * gas/nds32/to-16bit-v3.s: Likewise.
+ * gas/nds32/nds32.exp: New test driver.
+
2013-12-07 Mike Frysinger <vapier@gentoo.org>
* gas/bfin/bit2.s: Remove +x file mode.
diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp
index 35bcd95..f04a6d3 100644
--- a/gas/testsuite/gas/all/gas.exp
+++ b/gas/testsuite/gas/all/gas.exp
@@ -101,7 +101,7 @@ case $target_triplet in {
# Some targets don't manage to resolve BFD_RELOC_8 for constants.
setup_xfail "alpha*-*-*" "*c30*-*-*" "*c4x*-*-*" \
"d\[13\]0v*-*-*" "i860-*-*" "mips*-*-*" \
- "pdp11-*-*" "xtensa*-*-*"
+ "nds32*-*-*" "pdp11-*-*" "xtensa*-*-*"
run_dump_test forward
}
}
@@ -118,6 +118,7 @@ if { ![is_aout_format] } {
{ hppa*-*-hpux* } { }
{ mep-*-* } { }
{ mmix-*-* } { }
+ { nds32*-*-* } { }
{ tic30*-*-* } { }
{ tic4x*-*-* } { }
{ tic54x*-*-* } { }
@@ -140,6 +141,7 @@ case $target_triplet in {
{ mn10200-*-* } { }
{ mn10300-*-* } { }
{ msp430*-*-* } { }
+ { nds32*-*-* } { }
{ pdp11-*-* } { }
{ tic30*-*-* } { }
{ tic4x*-*-* } { }
@@ -366,12 +368,13 @@ if { ([istarget "i*86-*-*pe*"] && ![istarget "i*86-*-openbsd*"]) \
gas_test "fastcall.s" "" "" "fastcall labels"
}
-if { ![istarget "bfin-*-*"] } then {
+if { ![istarget "bfin-*-*"] && ![istarget "nds32*-*-*"] } then {
run_dump_test assign
}
run_dump_test sleb128
run_dump_test sleb128-2
run_dump_test sleb128-3
+setup_xfail "nds32*-*-*"
run_dump_test sleb128-4
run_dump_test sleb128-5
# .byte is not 8 bits on either tic4x or tic54x
@@ -414,6 +417,7 @@ case $target_triplet in {
{ *c54x*-*-* } { }
{ z80-*-* } { }
default {
+ setup_xfail "nds32*-*-*"
run_dump_test weakref1
run_dump_test weakref1g
run_dump_test weakref1l
diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp
index 4196fd7..d40e9f3 100644
--- a/gas/testsuite/gas/elf/elf.exp
+++ b/gas/testsuite/gas/elf/elf.exp
@@ -94,6 +94,7 @@ if { [is_elf_format] } then {
if {![istarget "mn10300-*-*"]
&& ![istarget "xtensa*-*-*"]
&& ![istarget "msp430*-*-*"]
+ && ![istarget "nds32*-*-*"]
&& ![istarget "am3*-*-*"]} then {
run_dump_test "ehopt0"
}
@@ -111,6 +112,7 @@ if { [is_elf_format] } then {
run_dump_test "file"
}
}
+ setup_xfail "nds32*-*-*"
run_dump_test "group0a"
run_dump_test "group0b"
run_dump_test "group0c"
diff --git a/gas/testsuite/gas/lns/lns.exp b/gas/testsuite/gas/lns/lns.exp
index f1d7f98..8f81998 100644
--- a/gas/testsuite/gas/lns/lns.exp
+++ b/gas/testsuite/gas/lns/lns.exp
@@ -39,6 +39,7 @@ if {
|| [istarget cr16-*-*]
|| [istarget crx-*-*]
|| [istarget msp430-*-*]
+ || [istarget nds32*-*-*]
|| [istarget mn10*-*-*] } {
run_dump_test "lns-common-1-alt"
run_dump_test "lns-big-delta"
diff --git a/gas/testsuite/gas/macros/irp.d b/gas/testsuite/gas/macros/irp.d
index 2c07f8e..7773792 100644
--- a/gas/testsuite/gas/macros/irp.d
+++ b/gas/testsuite/gas/macros/irp.d
@@ -1,7 +1,7 @@
#objdump: -r
#name: macro irp
#darwin (mach-o) reverses relocs.
-#not-target: *-*-darwin*
+#not-target: *-*-darwin* nds32*-*-*
.*: +file format .*
diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp
index 4a2716d..1253415 100644
--- a/gas/testsuite/gas/macros/macros.exp
+++ b/gas/testsuite/gas/macros/macros.exp
@@ -21,13 +21,13 @@ if { ![istarget hppa*-*-*] || [istarget *-*-linux*] } {
run_dump_test test1
}
-if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] } {
+if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] && ![istarget "nds32*-*-*"] } {
run_dump_test test2
}
run_dump_test test3
-if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] } {
+if { ![istarget *c54x*-*-*] && ![istarget *c4x*-*-*] && ![istarget "nds32*-*-*"] } {
run_dump_test irp
run_dump_test rept
run_dump_test repeat
diff --git a/gas/testsuite/gas/macros/rept.d b/gas/testsuite/gas/macros/rept.d
index df2ed96..92d6410 100644
--- a/gas/testsuite/gas/macros/rept.d
+++ b/gas/testsuite/gas/macros/rept.d
@@ -1,7 +1,7 @@
#objdump: -r
#name: macro rept
#darwin (mach-o) reverses relocs.
-#not-target: *-*-darwin*
+#not-target: *-*-darwin* nds32*-*-*
.*: +file format .*
diff --git a/gas/testsuite/gas/macros/test3.d b/gas/testsuite/gas/macros/test3.d
index 7680ad4..afd47fa 100644
--- a/gas/testsuite/gas/macros/test3.d
+++ b/gas/testsuite/gas/macros/test3.d
@@ -1,5 +1,6 @@
#objdump: -r
#name: macro test 3
+#not-target: nds32*-*-*
.*: +file format .*
diff --git a/gas/testsuite/gas/nds32/alu-1.d b/gas/testsuite/gas/nds32/alu-1.d
new file mode 100644
index 0000000..f1385cd
--- /dev/null
+++ b/gas/testsuite/gas/nds32/alu-1.d
@@ -0,0 +1,47 @@
+#objdump: -d --prefix-addresses
+#name: nds32 alu_1 instructions
+#as:
+
+# Test alu_1 instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> add \$r0, \$r1, \$r2
+0+0004 <[^>]*> and \$r0, \$r1, \$r2
+0+0008 <[^>]*> cmovn \$r0, \$r1, \$r2
+0+000c <[^>]*> cmovz \$r0, \$r1, \$r2
+0+0010 <[^>]*> nop
+0+0014 <[^>]*> nor \$r0, \$r1, \$r2
+0+0018 <[^>]*> or \$r0, \$r1, \$r2
+0+001c <[^>]*> rotr \$r0, \$r1, \$r2
+0+0020 <[^>]*> rotri \$r0, \$r1, #1
+0+0024 <[^>]*> seb \$r0, \$r1
+0+0028 <[^>]*> seh \$r0, \$r1
+0+002c <[^>]*> sll \$r0, \$r1, \$r2
+0+0030 <[^>]*> slli \$r0, \$r1, #1
+0+0034 <[^>]*> slt \$r0, \$r1, \$r2
+0+0038 <[^>]*> slts \$r0, \$r1, \$r2
+0+003c <[^>]*> sra \$r0, \$r1, \$r2
+0+0040 <[^>]*> srai \$r0, \$r1, #1
+0+0044 <[^>]*> srl \$r0, \$r1, \$r2
+0+0048 <[^>]*> srli \$r0, \$r1, #1
+0+004c <[^>]*> sub \$r0, \$r1, \$r2
+0+0050 <[^>]*> sva \$r0, \$r1, \$r2
+0+0054 <[^>]*> svs \$r0, \$r1, \$r2
+0+0058 <[^>]*> wsbh \$r0, \$r1
+0+005c <[^>]*> xor \$r0, \$r1, \$r2
+0+0060 <[^>]*> zeh \$r0, \$r1
+0+0064 <[^>]*> divr \$r0, \$r1, \$r2, \$r3
+0+0068 <[^>]*> divsr \$r0, \$r1, \$r2, \$r3
+0+006c <[^>]*> add_slli \$r0, \$r1, \$r2, #1
+0+0070 <[^>]*> add_srli \$r0, \$r1, \$r2, #1
+0+0074 <[^>]*> and_slli \$r0, \$r1, \$r2, #1
+0+0078 <[^>]*> and_srli \$r0, \$r1, \$r2, #1
+0+007c <[^>]*> bitc \$r0, \$r1, \$r2
+0+0080 <[^>]*> or_slli \$r0, \$r1, \$r2, #1
+0+0084 <[^>]*> or_srli \$r0, \$r1, \$r2, #1
+0+0088 <[^>]*> sub_slli \$r0, \$r1, \$r2, #1
+0+008c <[^>]*> sub_srli \$r0, \$r1, \$r2, #1
+0+0090 <[^>]*> xor_slli \$r0, \$r1, \$r2, #1
+0+0094 <[^>]*> xor_srli \$r0, \$r1, \$r2, #1
diff --git a/gas/testsuite/gas/nds32/alu-1.s b/gas/testsuite/gas/nds32/alu-1.s
new file mode 100644
index 0000000..5f12783
--- /dev/null
+++ b/gas/testsuite/gas/nds32/alu-1.s
@@ -0,0 +1,39 @@
+foo:
+ add $r0, $r1, $r2
+ and $r0, $r1, $r2
+ cmovn $r0, $r1, $r2
+ cmovz $r0, $r1, $r2
+ nop
+ nor $r0, $r1, $r2
+ or $r0, $r1, $r2
+ rotr $r0, $r1, $r2
+ rotri $r0, $r1, 1
+ seb $r0, $r1
+ seh $r0, $r1
+ sll $r0, $r1, $r2
+ slli $r0, $r1, 1
+ slt $r0, $r1, $r2
+ slts $r0, $r1, $r2
+ sra $r0, $r1, $r2
+ srai $r0, $r1, 1
+ srl $r0, $r1, $r2
+ srli $r0, $r1, 1
+ sub $r0, $r1, $r2
+ sva $r0, $r1, $r2
+ svs $r0, $r1, $r2
+ wsbh $r0, $r1
+ xor $r0, $r1, $r2
+ zeh $r0, $r1
+ divr $r0, $r1, $r2, $r3
+ divsr $r0, $r1, $r2, $r3
+ add_slli $r0, $r1, $r2, 1
+ add_srli $r0, $r1, $r2, 1
+ and_slli $r0, $r1, $r2, 1
+ and_srli $r0, $r1, $r2, 1
+ bitc $r0, $r1, $r2
+ or_slli $r0, $r1, $r2, 1
+ or_srli $r0, $r1, $r2, 1
+ sub_slli $r0, $r1, $r2, 1
+ sub_srli $r0, $r1, $r2, 1
+ xor_slli $r0, $r1, $r2, 1
+ xor_srli $r0, $r1, $r2, 1
diff --git a/gas/testsuite/gas/nds32/alu-2.d b/gas/testsuite/gas/nds32/alu-2.d
new file mode 100644
index 0000000..1b32f0b
--- /dev/null
+++ b/gas/testsuite/gas/nds32/alu-2.d
@@ -0,0 +1,42 @@
+#objdump: -d --prefix-addresses
+#name: nds32 alu_2 instructions
+#as:
+
+# Test alu_2 instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> madd64 \$d0, \$r0, \$r1
+0+0004 <[^>]*> madds64 \$d0, \$r0, \$r1
+0+0008 <[^>]*> mfusr \$r0, \$pc
+0+000c <[^>]*> msub64 \$d0, \$r0, \$r1
+0+0010 <[^>]*> msubs64 \$d0, \$r0, \$r1
+0+0014 <[^>]*> mtusr \$r0, \$pc
+0+0018 <[^>]*> mul \$r0, \$r1, \$r2
+0+001c <[^>]*> mult32 \$d0, \$r1, \$r2
+0+0020 <[^>]*> mult64 \$d0, \$r1, \$r2
+0+0024 <[^>]*> mults64 \$d0, \$r1, \$r2
+0+0028 <[^>]*> abs \$r0, \$r1
+0+002c <[^>]*> ave \$r0, \$r1, \$r2
+0+0030 <[^>]*> bclr \$r0, \$r1, #1
+0+0034 <[^>]*> bset \$r0, \$r1, #1
+0+0038 <[^>]*> btgl \$r0, \$r1, #1
+0+003c <[^>]*> btst \$r0, \$r1, #1
+0+0040 <[^>]*> clip \$r0, \$r1, #1
+0+0044 <[^>]*> clips \$r0, \$r1, #1
+0+0048 <[^>]*> clo \$r0, \$r1
+0+004c <[^>]*> clz \$r0, \$r1
+0+0050 <[^>]*> max \$r0, \$r1, \$r2
+0+0054 <[^>]*> min \$r0, \$r1, \$r2
+0+0058 <[^>]*> bse \$r0, \$r1, \$r2
+0+005c <[^>]*> bsp \$r0, \$r1, \$r2
+0+0060 <[^>]*> ffb \$r0, \$r1, \$r2
+0+0064 <[^>]*> ffbi \$r0, \$r1, #0x8
+0+0068 <[^>]*> ffmism \$r0, \$r1, \$r2
+0+006c <[^>]*> flmism \$r0, \$r1, \$r2
+0+0070 <[^>]*> maddr32 \$r0, \$r0, \$r1
+0+0074 <[^>]*> msubr32 \$r0, \$r1, \$r2
+0+0078 <[^>]*> mulr64 \$r0, \$r1, \$r2
+0+007c <[^>]*> mulsr64 \$r0, \$r1, \$r2
+
diff --git a/gas/testsuite/gas/nds32/alu-2.s b/gas/testsuite/gas/nds32/alu-2.s
new file mode 100644
index 0000000..d1743db
--- /dev/null
+++ b/gas/testsuite/gas/nds32/alu-2.s
@@ -0,0 +1,33 @@
+foo:
+ madd64 $d0, $r0, $r1
+ madds64 $d0, $r0, $r1
+ mfusr $r0, $pc
+ msub64 $d0, $r0, $r1
+ msubs64 $d0, $r0, $r1
+ mtusr $r0, $pc
+ mul $r0, $r1, $r2
+ mult32 $d0, $r1, $r2
+ mult64 $d0, $r1, $r2
+ mults64 $d0, $r1, $r2
+ abs $r0, $r1
+ ave $r0, $r1, $r2
+ bclr $r0, $r1, 1
+ bset $r0, $r1, 1
+ btgl $r0, $r1, 1
+ btst $r0, $r1, 1
+ clip $r0, $r1, 1
+ clips $r0, $r1, 1
+ clo $r0, $r1
+ clz $r0, $r1
+ max $r0, $r1, $r2
+ min $r0, $r1, $r2
+ bse $r0, $r1, $r2
+ bsp $r0, $r1, $r2
+ ffb $r0, $r1, $r2
+ ffbi $r0, $r1, 1
+ ffmism $r0, $r1, $r2
+ flmism $r0, $r1, $r2
+ maddr32 $r0, $r0, $r1
+ msubr32 $r0, $r1, $r2
+ mulr64 $r0, $r1, $r2
+ mulsr64 $r0, $r1, $r2
diff --git a/gas/testsuite/gas/nds32/br-1.d b/gas/testsuite/gas/nds32/br-1.d
new file mode 100644
index 0000000..e27f96c
--- /dev/null
+++ b/gas/testsuite/gas/nds32/br-1.d
@@ -0,0 +1,15 @@
+#objdump: -dr --prefix-addresses
+#name: nds32 branch 1 instructions
+#as:
+
+# Test br-1 instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> beq \$r0, \$r1, 00000000 <foo>
+ 0: R_NDS32_15_PCREL_RELA .text
+ 0: R_NDS32_RELAX_ENTRY .text
+0+0004 <[^>]*> bne \$r0, \$r1, 00000004 <foo\+0x4>
+ 4: R_NDS32_15_PCREL_RELA .text
+
diff --git a/gas/testsuite/gas/nds32/br-1.s b/gas/testsuite/gas/nds32/br-1.s
new file mode 100644
index 0000000..58d993a
--- /dev/null
+++ b/gas/testsuite/gas/nds32/br-1.s
@@ -0,0 +1,3 @@
+foo:
+ beq $r0, $r1, foo
+ bne $r0, $r1, foo
diff --git a/gas/testsuite/gas/nds32/br-2.d b/gas/testsuite/gas/nds32/br-2.d
new file mode 100644
index 0000000..0edc375
--- /dev/null
+++ b/gas/testsuite/gas/nds32/br-2.d
@@ -0,0 +1,25 @@
+#objdump: -dr --prefix-addresses
+#name: nds32 branch 2 instructions
+#as:
+
+# Test br-2 instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> beqz \$r0, 00000000 <foo>
+ 0: R_NDS32_17_PCREL_RELA .text
+ 0: R_NDS32_RELAX_ENTRY .text
+0+0004 <[^>]*> bgez \$r0, 00000004 <foo\+0x4>
+ 4: R_NDS32_17_PCREL_RELA .text
+0+0008 <[^>]*> bgezal \$r0, 00000008 <foo\+0x8>
+ 8: R_NDS32_17_PCREL_RELA .text
+0+000c <[^>]*> bgtz \$r0, 0000000c <foo\+0xc>
+ c: R_NDS32_17_PCREL_RELA .text
+0+0010 <[^>]*> blez \$r0, 00000010 <foo\+0x10>
+ 10: R_NDS32_17_PCREL_RELA .text
+0+0014 <[^>]*> bltz \$r0, 00000014 <foo\+0x14>
+ 14: R_NDS32_17_PCREL_RELA .text
+0+0018 <[^>]*> bltzal \$r0, 00000018 <foo\+0x18>
+ 18: R_NDS32_17_PCREL_RELA .text
+
diff --git a/gas/testsuite/gas/nds32/br-2.s b/gas/testsuite/gas/nds32/br-2.s
new file mode 100644
index 0000000..554a8de
--- /dev/null
+++ b/gas/testsuite/gas/nds32/br-2.s
@@ -0,0 +1,8 @@
+foo:
+ beqz $r0, foo
+ bgez $r0, foo
+ bgezal $r0, foo
+ bgtz $r0, foo
+ blez $r0, foo
+ bltz $r0, foo
+ bltzal $r0, foo
diff --git a/gas/testsuite/gas/nds32/ji-jr.d b/gas/testsuite/gas/nds32/ji-jr.d
new file mode 100644
index 0000000..31969e1
--- /dev/null
+++ b/gas/testsuite/gas/nds32/ji-jr.d
@@ -0,0 +1,18 @@
+#objdump: -dr --prefix-addresses
+#name: nds32 load-store instructions
+#as:
+
+# Test ls instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> j8 00000000 <foo>
+ 0: R_NDS32_9_PCREL_RELA .text
+ 0: R_NDS32_RELAX_ENTRY .text
+0+0002 <[^>]*> jal 00000002 <foo\+0x2>
+ 2: R_NDS32_25_PCREL_RELA .text
+0+0006 <[^>]*> jr \$r0
+0+000a <[^>]*> jral \$lp, \$r0
+0+000e <[^>]*> ret \$lp
+
diff --git a/gas/testsuite/gas/nds32/ji-jr.s b/gas/testsuite/gas/nds32/ji-jr.s
new file mode 100644
index 0000000..2457d0b
--- /dev/null
+++ b/gas/testsuite/gas/nds32/ji-jr.s
@@ -0,0 +1,6 @@
+foo:
+ j foo
+ jal foo
+ jr $r0
+ jral $r0
+ ret
diff --git a/gas/testsuite/gas/nds32/ls.d b/gas/testsuite/gas/nds32/ls.d
new file mode 100644
index 0000000..688ed11
--- /dev/null
+++ b/gas/testsuite/gas/nds32/ls.d
@@ -0,0 +1,25 @@
+#objdump: -d --prefix-addresses
+#name: nds32 load-store instructions
+#as:
+
+# Test ls instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> lw \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0004 <[^>]*> lh \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0008 <[^>]*> lhs \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+000c <[^>]*> lb \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0010 <[^>]*> lbs \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0014 <[^>]*> sw \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0018 <[^>]*> sh \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+001c <[^>]*> sb \$r0, \[\$r1 \+ \(\$r2 << 1\)\]
+0+0020 <[^>]*> lw.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+0024 <[^>]*> lh.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+0028 <[^>]*> lhs.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+002c <[^>]*> lb.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+0030 <[^>]*> lbs.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+0034 <[^>]*> sw.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+0038 <[^>]*> sh.bi \$r0, \[\$r1\], \(\$r2 << 1\)
+0+003c <[^>]*> sb.bi \$r0, \[\$r1\], \(\$r2 << 1\)
diff --git a/gas/testsuite/gas/nds32/ls.s b/gas/testsuite/gas/nds32/ls.s
new file mode 100644
index 0000000..88d3d33
--- /dev/null
+++ b/gas/testsuite/gas/nds32/ls.s
@@ -0,0 +1,17 @@
+foo:
+ lw $r0, [$r1 + ($r2 << 1)]
+ lh $r0, [$r1 + ($r2 << 1)]
+ lhs $r0, [$r1 + ($r2 << 1)]
+ lb $r0, [$r1 + ($r2 << 1)]
+ lbs $r0, [$r1 + ($r2 << 1)]
+ sw $r0, [$r1 + ($r2 << 1)]
+ sh $r0, [$r1 + ($r2 << 1)]
+ sb $r0, [$r1 + ($r2 << 1)]
+ lw.bi $r0, [$r1], $r2 << 1
+ lh.bi $r0, [$r1], $r2 << 1
+ lhs.bi $r0, [$r1], $r2 << 1
+ lb.bi $r0, [$r1], $r2 << 1
+ lbs.bi $r0, [$r1], $r2 << 1
+ sw.bi $r0, [$r1], $r2 << 1
+ sh.bi $r0, [$r1], $r2 << 1
+ sb.bi $r0, [$r1], $r2 << 1
diff --git a/gas/testsuite/gas/nds32/lsi.d b/gas/testsuite/gas/nds32/lsi.d
new file mode 100644
index 0000000..9fe5371
--- /dev/null
+++ b/gas/testsuite/gas/nds32/lsi.d
@@ -0,0 +1,26 @@
+#objdump: -d --prefix-addresses
+#name: nds32 load-store immediate instructions
+#as:
+
+# Test lsi instructions
+
+.*: file format .*
+
+Disassembly of section .text:
+0+0000 <[^>]*> lwi \$r0, \[\$r1 \+ #4\]
+0+0004 <[^>]*> lhi \$r0, \[\$r1 \+ #2\]
+0+0008 <[^>]*> lhsi \$r0, \[\$r1 \+ #-2\]
+0+000c <[^>]*> lbi \$r0, \[\$r1 \+ #1\]
+0+0010 <[^>]*> lbsi \$r0, \[\$r1 \+ #-1\]
+0+0014 <[^>]*> swi \$r0, \[\$r1 \+ #4\]
+0+0018 <[^>]*> shi \$r0, \[\$r1 \+ #2\]
+0+001c <[^>]*> sbi \$r0, \[\$r1 \+ #1\]
+0+0020 <[^>]*> lwi.bi \$r0, \[\$r1\], #4
+0+0024 <[^>]*> lhi.bi \$r0, \[\$r1\], #2
+0+0028 <[^>]*> lhsi.bi \$r0, \[\$r1\], #-2
+0+002c <[^>]*> lbi.bi \$r0, \[\$r1\], #1
+0+0030 <[^>]*> lbsi.bi \$r0, \[\$r1\], #-1
+0+0034 <[^>]*> swi.bi \$r0, \[\$r1\], #4
+0+0038 <[^>]*> shi.bi \$r0, \[\$r1\], #2
+0+003c <[^>]*> sbi.bi \$r0, \[\$r1\], #1
+
diff --git a/gas/testsuite/gas/nds32/lsi.s b/gas/testsuite/gas/nds32/lsi.s
new file mode 100644
index 0000000..a2dd62a
--- /dev/null
+++ b/gas/testsuite/gas/nds32/lsi.s
@@ -0,0 +1,17 @@
+foo:
+ lwi $r0, [$r1 + (1 << 2)]
+ lhi $r0, [$r1 + (1 << 1)]
+ lhsi $r0, [$r1 + (-1 << 1)]
+ lbi $r0, [$r1 + 1]
+ lbsi $r0, [$r1 + (-1)]
+ swi $r0, [$r1 + (1 << 2)]
+ shi $r0, [$r1 + (1 << 1)]
+ sbi $r0, [$r1 + 1]
+ lwi.bi $r0, [$r1], (1 << 2)
+ lhi.bi $r0, [$r1], (1 << 1)
+ lhsi.bi $r0, [$r1], (-1 << 1)
+ lbi.bi $r0, [$r1], 1
+ lbsi.bi $r0, [$r1], -1
+ swi.bi $r0, [$r1], (1 << 2)
+ shi.bi $r0, [$r1], (1 << 1)
+ sbi.bi $r0, [$r1], 1
diff --git a/gas/testsuite/gas/nds32/nds32.exp b/gas/testsuite/gas/nds32/nds32.exp
new file mode 100644
index 0000000..f547697
--- /dev/null
+++ b/gas/testsuite/gas/nds32/nds32.exp
@@ -0,0 +1,30 @@
+# Copyright (C) 2012-2013 Free Software Foundation, Inc.
+# Contributed by Andes Technology Corporation.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+# MA 02110-1301, USA.
+
+if { [istarget nds32*] } {
+ run_dump_test "alu-1"
+ run_dump_test "alu-2"
+ run_dump_test "lsi"
+ run_dump_test "ls"
+ run_dump_test "br-1"
+ run_dump_test "br-2"
+ run_dump_test "ji-jr"
+ run_dump_test "to-16bit-v1"
+ run_dump_test "to-16bit-v2"
+ run_dump_test "to-16bit-v3"
+}
diff --git a/gas/testsuite/gas/nds32/to-16bit-v1.d b/gas/testsuite/gas/nds32/to-16bit-v1.d
new file mode 100644
index 0000000..a45de36
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v1.d
@@ -0,0 +1,79 @@
+#objdump: -d --prefix-addresses
+#name: nds32 convert 32 to 16 (v1 instructions)
+#as: -Os -mno-reduced-regs
+
+# Test the convert 32bits to 16bits
+
+.*: file format .*
+
+
+Disassembly of section .text:
+0+0000 .*
+0+0002 .*
+0+0004 .*
+0+0006 .*
+0+0008 .*
+0+000a .*
+0+000c .*
+0+000e .*
+0+0010 .*
+0+0012 .*
+0+0014 .*
+0+0016 .*
+0+0018 .*
+0+001a .*
+0+001c .*
+0+001e .*
+0+0020 .*
+0+0022 .*
+0+0024 .*
+0+0026 .*
+0+0028 .*
+0+002a .*
+0+002c .*
+0+002e .*
+0+0030 .*
+0+0032 .*
+0+0034 .*
+0+0036 .*
+0+0038 .*
+0+003a .*
+0+003c .*
+0+003e .*
+0+0040 .*
+0+0042 .*
+0+0044 .*
+0+0046 .*
+0+0048 .*
+0+004a .*
+0+004c .*
+0+004e .*
+0+0050 .*
+0+0052 .*
+0+0054 .*
+0+0056 .*
+0+0058 .*
+0+005a .*
+0+005c .*
+0+005e .*
+0+0060 .*
+0+0062 .*
+0+0064 .*
+0+0066 .*
+0+0068 .*
+0+006a .*
+0+006c .*
+0+006e .*
+0+0070 .*
+0+0072 .*
+0+0074 .*
+0+0076 .*
+0+0078 .*
+0+007a .*
+0+007c .*
+0+007e .*
+0+0080 .*
+0+0082 .*
+0+0084 .*
+0+0086 .*
+0+0088 .*
diff --git a/gas/testsuite/gas/nds32/to-16bit-v1.s b/gas/testsuite/gas/nds32/to-16bit-v1.s
new file mode 100644
index 0000000..195463c
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v1.s
@@ -0,0 +1,70 @@
+foo:
+ move $r0, $r0
+ move $sp, $sp
+ movi $r0, -16
+ movi $sp, 15
+ add $r0, $r0, $r0
+ add $r19, $sp, $r19
+ sub $r0, $r0, $r0
+ sub $r19, $r19, $sp
+ addi $r0, $r0, 0
+ addi $r19, $r19, 31
+ srai $r0, $r0, 0
+ srai $r19, $r19, 31
+ srli $r0, $r0, 0
+ srli $r19, $r19, 31
+ slli $r0, $r0, 0
+ slli $r7, $r7, 7
+ zeb $r0, $r0
+ zeb $r7, $r7
+ zeh $r0, $r0
+ zeh $r7, $r7
+ seb $r0, $r0
+ seb $r7, $r7
+ seh $r0, $r0
+ seh $r7, $r7
+ andi $r0, $r0, 1
+ andi $r7, $r7, 0x7ff
+ add $r0, $r0, $r0
+ add $r7, $r7, $r7
+ sub $r0, $r0, $r0
+ sub $r7, $r7, $r7
+ addi $r0, $r0, 0
+ addi $r7, $r7, 7
+ lwi $r0, [$r0 + 0]
+ lwi $r7, [$r7 + 28]
+ lwi.bi $r0, [$r0], 0
+ lwi.bi $r7, [$r7], 28
+ lhi $r0, [$r0 + 0]
+ lhi $r7, [$r7 + 14]
+ lbi $r0, [$r0 + 0]
+ lbi $r7, [$r7 + 7]
+ swi $r0, [$r0 + 0]
+ swi $r7, [$r7 + 28]
+ swi.bi $r0, [$r0], 0
+ swi.bi $r7, [$r7], 28
+ shi $r0, [$r0 + 0]
+ shi $r7, [$r7 + 14]
+ sbi $r0, [$r0 + 0]
+ sbi $r7, [$r7 + 7]
+ lwi $r0, [$r0 + 0]
+ lwi $r19, [$sp + 0]
+ swi $r0, [$r0 + 0]
+ swi $r19, [$sp + 0]
+ lwi $r0, [$fp + 0]
+ lwi $r7, [$fp + 508]
+ swi $r0, [$fp + 0]
+ swi $r7, [$fp + 508]
+ jr $r0
+ jr $sp
+ ret $r0
+ ret $sp
+ jral $r0
+ jral $sp
+ slts $r15, $r0, $r0
+ slts $r15, $r19, $sp
+ slt $r15, $r0, $r0
+ slt $r15, $r19, $sp
+ sltsi $r15, $r0, 0
+ sltsi $r15, $r19, 31
+ slti $r15, $r0, 0
diff --git a/gas/testsuite/gas/nds32/to-16bit-v2.d b/gas/testsuite/gas/nds32/to-16bit-v2.d
new file mode 100644
index 0000000..5ca929c
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v2.d
@@ -0,0 +1,15 @@
+#objdump: -d --prefix-addresses
+#name: nds32 convert 32 to 16 (v2 instructions)
+#as: -Os -mno-reduced-regs
+
+# Test the convert 32bits to 16bits
+
+.*: file format .*
+
+
+Disassembly of section .text:
+0+0000 .*
+0+0002 .*
+0+0004 .*
+0+0006 .*
+0+0008 .*
diff --git a/gas/testsuite/gas/nds32/to-16bit-v2.s b/gas/testsuite/gas/nds32/to-16bit-v2.s
new file mode 100644
index 0000000..1ac3328
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v2.s
@@ -0,0 +1,6 @@
+foo:
+addi $sp, $sp, -512
+addi $sp, $sp, 511
+lwi $r0, [$sp + 0]
+lwi $r7, [$sp + 508]
+swi $r0, [$sp + 0]
diff --git a/gas/testsuite/gas/nds32/to-16bit-v3.d b/gas/testsuite/gas/nds32/to-16bit-v3.d
new file mode 100644
index 0000000..2efa8b7
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v3.d
@@ -0,0 +1,25 @@
+#objdump: -d --prefix-addresses
+#name: nds32 convert 32 to 16 (v3 instructions)
+#as: -Os -mno-reduced-regs
+
+# Test the convert 32bits to 16bits
+
+.*: file format .*
+
+
+Disassembly of section .text:
+0+0000 .*
+0+0002 .*
+0+0004 .*
+0+0006 .*
+0+0008 .*
+0+000a .*
+0+000c .*
+0+000e .*
+0+0010 .*
+0+0012 .*
+0+0014 .*
+0+0016 .*
+0+0018 .*
+0+001a .*
+0+001c .*
diff --git a/gas/testsuite/gas/nds32/to-16bit-v3.s b/gas/testsuite/gas/nds32/to-16bit-v3.s
new file mode 100644
index 0000000..595a782
--- /dev/null
+++ b/gas/testsuite/gas/nds32/to-16bit-v3.s
@@ -0,0 +1,16 @@
+foo:
+andi $r0, $r0, 1
+andi $r7, $r7, 255
+movi $r0, 16
+movi $r19, 47
+subri $r0, $r0, 0
+subri $r7, $r7, 0
+nor $r0, $r0, $r0
+nor $r7, $r7, $r7
+mul $r0, $r0, $r0
+mul $r7, $r7, $r7
+xor $r0, $r0, $r0
+xor $r7, $r7, $r7
+and $r0, $r0, $r0
+and $r7, $r7, $r7
+or $r0, $r0, $r0