summaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-nds32
diff options
context:
space:
mode:
Diffstat (limited to 'ld/testsuite/ld-nds32')
-rw-r--r--ld/testsuite/ld-nds32/branch.d24
-rw-r--r--ld/testsuite/ld-nds32/branch.ld6
-rw-r--r--ld/testsuite/ld-nds32/branch.s18
-rw-r--r--ld/testsuite/ld-nds32/diff.d16
-rw-r--r--ld/testsuite/ld-nds32/diff.ld10
-rw-r--r--ld/testsuite/ld-nds32/diff.s32
-rw-r--r--ld/testsuite/ld-nds32/gp.d18
-rw-r--r--ld/testsuite/ld-nds32/gp.ld11
-rw-r--r--ld/testsuite/ld-nds32/gp.s18
-rw-r--r--ld/testsuite/ld-nds32/imm.d15
-rw-r--r--ld/testsuite/ld-nds32/imm.ld6
-rw-r--r--ld/testsuite/ld-nds32/imm.s7
-rw-r--r--ld/testsuite/ld-nds32/imm_symbol.s7
-rw-r--r--ld/testsuite/ld-nds32/nds32.exp26
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.d12
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.ld6
-rw-r--r--ld/testsuite/ld-nds32/relax_jmp.s10
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.d12
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.ld10
-rw-r--r--ld/testsuite/ld-nds32/relax_load_store.s17
20 files changed, 281 insertions, 0 deletions
diff --git a/ld/testsuite/ld-nds32/branch.d b/ld/testsuite/ld-nds32/branch.d
new file mode 100644
index 00000000000..85798e93eff
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.d
@@ -0,0 +1,24 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/branch.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> beq \$r0, \$r1, 0000002c <main>
+0+0004 <[^>]*> bne \$r0, \$r1, 0000002c <main>
+0+0008 <[^>]*> bnez38 \$r0, 0000002c <main>
+0+000a <[^>]*> beqz38 \$r0, 0000002c <main>
+0+000c <[^>]*> bgez \$r0, 0000002c <main>
+.*
+0+0012 <[^>]*> bgezal \$r0, 0000002c <main>
+0+0016 <[^>]*> bgtz \$r0, 0000002c <main>
+.*
+0+001c <[^>]*> blez \$r0, 0000002c <main>
+.*
+0+0022 <[^>]*> bltz \$r0, 0000002c <main>
+0+0026 <[^>]*> srli45 \$r0, 0
+0+0028 <[^>]*> bltzal \$r0, 0000002c <main>
+0+002c <main>.*
+
diff --git a/ld/testsuite/ld-nds32/branch.ld b/ld/testsuite/ld-nds32/branch.ld
new file mode 100644
index 00000000000..28eb4e0d0a1
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/branch.s b/ld/testsuite/ld-nds32/branch.s
new file mode 100644
index 00000000000..284645e6476
--- /dev/null
+++ b/ld/testsuite/ld-nds32/branch.s
@@ -0,0 +1,18 @@
+.text
+.global _start
+_start:
+ beq $r0, $r1, main
+ bne $r0, $r1, main
+ beqz $r0, main
+ bnez $r0, main
+ bgez $r0, main
+ bgezal $r0, main
+ bgtz $r0, main
+ blez $r0, main
+ bltz $r0, main
+ bltzal $r0, main
+.section .text.2, "ax"
+.globl main
+main:
+ nop
+
diff --git a/ld/testsuite/ld-nds32/diff.d b/ld/testsuite/ld-nds32/diff.d
new file mode 100644
index 00000000000..ef7958666fe
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.d
@@ -0,0 +1,16 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/diff.ld
+#objdump: -D --prefix-addresses -j .data --show-raw-insn
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .data:
+00008000 <WORD> (7e 00 00 00|00 00 00 7e).*
+00008004 <HALF> (7e 00 7e fe|00 7e 7e fe).*
+00008006 <BYTE> 7e fe 00 fe.*
+00008007 <ULEB128> fe 00.*
+ ...
+00008009 <ULEB128_2> fe 00.*
+.*
+.*
diff --git a/ld/testsuite/ld-nds32/diff.ld b/ld/testsuite/ld-nds32/diff.ld
new file mode 100644
index 00000000000..5e4dd2954ca
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .text 0x4000 : {
+ * (.text .text.*);
+ }
+
+ .data 0x8000 : {
+ * (.data .data.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/diff.s b/ld/testsuite/ld-nds32/diff.s
new file mode 100644
index 00000000000..a2844b7c82a
--- /dev/null
+++ b/ld/testsuite/ld-nds32/diff.s
@@ -0,0 +1,32 @@
+ .global _start
+ .global WORD
+ .global HALF
+ .global BYTE
+ .global ULEB128
+.text
+_start:
+ nop
+.L0:
+ l.w $r0, WORD
+ .zero 122
+.L1:
+ nop
+
+.section code, "ax"
+FOO:
+ ret
+
+.data
+WORD:
+ .word .L1-.L0
+HALF:
+ .half .L1-.L0
+BYTE:
+ .byte .L1-.L0
+ULEB128:
+ .uleb128 .L1-.L0
+ULEB128_2:
+ .uleb128 .L1-.L0
+ .align 2
+PAD:
+ .long 0
diff --git a/ld/testsuite/ld-nds32/gp.d b/ld/testsuite/ld-nds32/gp.d
new file mode 100644
index 00000000000..dac6eaa4267
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.d
@@ -0,0 +1,18 @@
+#as: -Os
+#ld: -static -T \$srcdir/\$subdir/gp.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> addi.gp \$r0, 8192
+0+0004 <[^>]*> lbi.gp \$r0, \[\+ 8192\]
+0+0008 <[^>]*> lbsi.gp \$r0, \[\+ 8192\]
+0+000c <[^>]*> lhi.gp \$r0, \[\+ 8192\]
+0+0010 <[^>]*> lhsi.gp \$r0, \[\+ 8192\]
+0+0014 <[^>]*> lwi.gp \$r0, \[\+ 8192\]
+0+0018 <[^>]*> sbi.gp \$r0, \[\+ 8192\]
+0+001c <[^>]*> shi.gp \$r0, \[\+ 8192\]
+0+0020 <[^>]*> swi.gp \$r0, \[\+ 8192\]
+
diff --git a/ld/testsuite/ld-nds32/gp.ld b/ld/testsuite/ld-nds32/gp.ld
new file mode 100644
index 00000000000..b537b95feb0
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.ld
@@ -0,0 +1,11 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+
+ .data 0x3000 : {
+ * (.data .data.*);
+ }
+ _SDA_BASE_ = 0x1000;
+}
diff --git a/ld/testsuite/ld-nds32/gp.s b/ld/testsuite/ld-nds32/gp.s
new file mode 100644
index 00000000000..d0fde2ae8ca
--- /dev/null
+++ b/ld/testsuite/ld-nds32/gp.s
@@ -0,0 +1,18 @@
+.data
+.global mydata
+mydata:
+ .word 0x11
+
+.text
+.global _start
+_start:
+ addi.gp $r0, mydata
+ lbi.gp $r0, [+mydata]
+ lbsi.gp $r0, [+mydata]
+ lhi.gp $r0, [+mydata]
+ lhsi.gp $r0, [+mydata]
+ lwi.gp $r0, [+mydata]
+ sbi.gp $r0, [+mydata]
+ shi.gp $r0, [+mydata]
+ swi.gp $r0, [+mydata]
+
diff --git a/ld/testsuite/ld-nds32/imm.d b/ld/testsuite/ld-nds32/imm.d
new file mode 100644
index 00000000000..fdaacf3df5a
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.d
@@ -0,0 +1,15 @@
+#source: imm.s
+#source: imm_symbol.s
+#as: -Os
+#ld: -static -T $srcdir/$subdir/imm.ld --relax
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+1000 <[^>]*> sethi \$r0, 0x11223
+0+1004 <[^>]*> ori \$r0, \$r0, 836
+0+1008 <[^>]*> movi \$r0, 70179
+0+100c <[^>]*> movi55 \$r0, 15
+
diff --git a/ld/testsuite/ld-nds32/imm.ld b/ld/testsuite/ld-nds32/imm.ld
new file mode 100644
index 00000000000..b7d12cc4c84
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x1000 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/imm.s b/ld/testsuite/ld-nds32/imm.s
new file mode 100644
index 00000000000..1d108314435
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm.s
@@ -0,0 +1,7 @@
+.text
+.global _start
+_start:
+ la $r0, imm32
+ la $r0, imm20
+ la $r0, imm5
+
diff --git a/ld/testsuite/ld-nds32/imm_symbol.s b/ld/testsuite/ld-nds32/imm_symbol.s
new file mode 100644
index 00000000000..1c75db28e18
--- /dev/null
+++ b/ld/testsuite/ld-nds32/imm_symbol.s
@@ -0,0 +1,7 @@
+.globl imm32
+.globl imm20
+.globl imm5
+
+.set imm32, 0x11223344
+.set imm20, 0x11223
+.set imm5, 0xf
diff --git a/ld/testsuite/ld-nds32/nds32.exp b/ld/testsuite/ld-nds32/nds32.exp
new file mode 100644
index 00000000000..6f95c17c246
--- /dev/null
+++ b/ld/testsuite/ld-nds32/nds32.exp
@@ -0,0 +1,26 @@
+# 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 "diff"
+ run_dump_test "gp"
+ run_dump_test "relax_jmp"
+ run_dump_test "imm"
+ run_dump_test "branch"
+ run_dump_test "relax_load_store"
+}
diff --git a/ld/testsuite/ld-nds32/relax_jmp.d b/ld/testsuite/ld-nds32/relax_jmp.d
new file mode 100644
index 00000000000..b1d20514a3a
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.d
@@ -0,0 +1,12 @@
+#as: -Os
+#ld: -static --relax -T $srcdir/$subdir/relax_jmp.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> j8 00000006 <main>
+0+0002 <[^>]*> jal 00000006 <main>
+0+0006 <[^>]*> srli45 \$r0, 0
+
diff --git a/ld/testsuite/ld-nds32/relax_jmp.ld b/ld/testsuite/ld-nds32/relax_jmp.ld
new file mode 100644
index 00000000000..28eb4e0d0a1
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.ld
@@ -0,0 +1,6 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/relax_jmp.s b/ld/testsuite/ld-nds32/relax_jmp.s
new file mode 100644
index 00000000000..e2817631dc7
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_jmp.s
@@ -0,0 +1,10 @@
+.text
+.global _start
+_start:
+ j main
+ jal main
+.section .text.2, "ax"
+.globl main
+main:
+ nop
+
diff --git a/ld/testsuite/ld-nds32/relax_load_store.d b/ld/testsuite/ld-nds32/relax_load_store.d
new file mode 100644
index 00000000000..07c4fe72eb2
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.d
@@ -0,0 +1,12 @@
+#as: -Os
+#ld: -static --relax -T \$srcdir/\$subdir/relax_load_store.ld
+#objdump: -d --prefix-addresses -j .text
+
+.*: file format .*nds32.*
+
+
+Disassembly of section .text:
+0+0000 <[^>]*> lwi.gp \$r0, \[\+ 0\]
+0+0004 <[^>]*> lhi.gp \$r0, \[\+ 4\]
+0+0008 <[^>]*> lbi.gp \$r0, \[\+ 6\]
+
diff --git a/ld/testsuite/ld-nds32/relax_load_store.ld b/ld/testsuite/ld-nds32/relax_load_store.ld
new file mode 100644
index 00000000000..1bc15a98cf4
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.ld
@@ -0,0 +1,10 @@
+SECTIONS
+{
+ .text 0x0 : {
+ * (.text .text.*);
+ }
+
+ .data 0x3000 : {
+ * (.data .data.*);
+ }
+}
diff --git a/ld/testsuite/ld-nds32/relax_load_store.s b/ld/testsuite/ld-nds32/relax_load_store.s
new file mode 100644
index 00000000000..790c97c8997
--- /dev/null
+++ b/ld/testsuite/ld-nds32/relax_load_store.s
@@ -0,0 +1,17 @@
+.data
+.global myword
+myword:
+ .word 0x11
+.globl myshort
+myshort:
+ .short 0x11
+.globl mybyte
+mybyte:
+ .byte 0x11
+
+.text
+.global _start
+_start:
+ l.w $r0, myword
+ l.h $r0, myshort
+ l.b $r0, mybyte