Start of ARC testsuite.
authorDavid Edelsohn <dje.gcc@gmail.com>
Sat, 8 Apr 1995 19:58:59 +0000 (19:58 +0000)
committerDavid Edelsohn <dje.gcc@gmail.com>
Sat, 8 Apr 1995 19:58:59 +0000 (19:58 +0000)
gas/testsuite/.Sanitize
gas/testsuite/ChangeLog
gas/testsuite/gas/arc/.Sanitize [new file with mode: 0644]
gas/testsuite/gas/arc/arc.exp [new file with mode: 0644]
gas/testsuite/gas/arc/flag.d [new file with mode: 0644]
gas/testsuite/gas/arc/flag.s [new file with mode: 0644]
gas/testsuite/gas/arc/math.d [new file with mode: 0644]
gas/testsuite/gas/arc/math.s [new file with mode: 0644]

index 703230d3f65c837f68a2afa178f8c7a46e0eeff8..7984d01f7bd00d0c4c3aa227686ffca43418a7eb 100644 (file)
@@ -39,4 +39,39 @@ gasp
 
 Do-last:
 
+# Don't try to clean directories here, as the 'mv' command will fail.
+# Also, grep fails on NFS mounted directories.
+
+if [ -n "${verbose}" ] ; then
+       echo Processing \"arc\"...
+fi
+
+arc_files="ChangeLog"
+if ( echo $* | grep keep\-arc > /dev/null ) ; then
+       for i in $arc_files ; do
+               if test ! -d $i && (grep sanitize-arc $i > /dev/null) ; then
+                       if [ -n "${verbose}" ] ; then
+                               echo Keeping arc stuff in $i
+                       fi
+               fi
+       done
+else
+       for i in $arc_files ; do
+               if test ! -d $i && (grep sanitize-arc $i > /dev/null) ; then
+                       if [ -n "${verbose}" ] ; then
+                               echo Removing traces of \"arc\" from $i...
+                       fi
+                       cp $i new
+                       sed '/start\-sanitize\-arc/,/end-\sanitize\-arc/d' < $i > new
+                       if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
+                               if [ -n "${verbose}" ] ; then
+                                       echo Caching $i in .Recover...
+                               fi
+                               mv $i .Recover
+                       fi
+                       mv new $i
+               fi
+       done
+fi
+
 # End of file.
index d565bf6ee28a637d7113a31e30793d50ebcfbc82..164735283892085e93c1b612bf6516d2c64af9fb 100644 (file)
@@ -1,5 +1,10 @@
 Sat Apr  8 12:46:33 1995  Doug Evans  <dje@chestnut.cygnus.com>
 
+start-sanitize-arc
+       * gas/arc: Testsuite for ARC.
+       * gas/arc/{arc.exp,math.s,math.d,flag.s,flag.d,j.s,j.d}: New files.
+end-sanitize-arc
+
        * lib/gas-defs.exp (run_dump_test): Handle arguments with paths.
        Always resolve testcase status before returning.
        If `slurp_options' fails, return and don't do test.
diff --git a/gas/testsuite/gas/arc/.Sanitize b/gas/testsuite/gas/arc/.Sanitize
new file mode 100644 (file)
index 0000000..4a04169
--- /dev/null
@@ -0,0 +1,38 @@
+# .Sanitize for devo/gas/testsuite/gas/arc.
+
+# Each directory to survive it's way into a release will need a file
+# like this one called "./.Sanitize".  All keyword lines must exist,
+# and must exist in the order specified by this file.  Each directory
+# in the tree will be processed, top down, in the following order.
+
+# Hash started lines like this one are comments and will be deleted
+# before anything else is done.  Blank lines will also be squashed
+# out.
+
+# The lines between the "Do-first:" line and the "Things-to-keep:"
+# line are executed as a /bin/sh shell script before anything else is
+# done in this 
+
+Do-first:
+
+
+# All files listed between the "Things-to-keep:" line and the
+# "Files-to-sed:" line will be kept.  All other files will be removed.
+# Directories listed in this section will have their own Sanitize
+# called.  Directories not listed will be removed in their entirety
+# with rm -rf.
+
+Things-to-keep:
+
+arc.exp
+flag.s
+flag.d
+j.s
+j.d
+math.s
+math.d
+Things-to-lose:
+
+Do-last:
+
+# End of file.
diff --git a/gas/testsuite/gas/arc/arc.exp b/gas/testsuite/gas/arc/arc.exp
new file mode 100644 (file)
index 0000000..8fcb87f
--- /dev/null
@@ -0,0 +1,89 @@
+# ARC gas testsuite
+
+# Test an insn from a template .s/.d.
+
+proc test_template_insn { tmpl opcode icode } {
+    global srcdir subdir objdir
+
+    # Change @OC@ in the template file to $opcode
+
+    set in_fd [open $srcdir/$subdir/$tmpl.s r]
+    set out_fd [open $objdir/$opcode.s w]
+    # FIXME: check return codes
+
+    while { [gets $in_fd line] >= 0 } {
+       regsub "@OC@" $line $opcode line
+       puts $out_fd $line
+    }
+
+    close $in_fd
+    close $out_fd
+
+    # Create output template.
+
+    set in_fd [open $srcdir/$subdir/$tmpl.d r]
+    set out_fd [open $objdir/$opcode.d w]
+    # FIXME: check return codes
+
+    while { [gets $in_fd line] >= 0 } {
+       regsub "@OC@" $line $opcode line
+       #send_user "$line\n"
+       if [string match "*@IC+?@*" $line] {
+           # Insert the opcode.  It occupies the top 5 bits.
+           regexp "^(.*)@(IC\\+)(.)@(.*)$" $line junk leftpart icodepart n rightpart
+           set n [expr ($icode << 3) + $n]
+           set n [format "%02x" $n]
+           puts $out_fd "$leftpart$n$rightpart"
+       } else {
+           puts $out_fd $line
+       }
+    }
+
+    close $in_fd
+    close $out_fd
+
+    # Finally, run the test.
+
+    run_dump_test $objdir/$opcode
+}
+
+# Run the tests.
+
+if [istarget arc*-*-*] then {
+
+    test_template_insn math adc 9
+    test_template_insn math add 8
+    test_template_insn math and 12
+    test_template_insn math bic 14
+    test_template_insn math or 13
+    test_template_insn math sbc 11
+    test_template_insn math sub 10
+    test_template_insn math xor 15
+
+#    test_shift "asl" 8
+#    test_shift "asr" 3
+#    test_shift "lsl" 8
+#    test_shift "lsr" 3
+#    test_shift "ror" 3
+#    test_shift "rrc" 3
+
+#    test_branch "b" 4
+#    test_branch "bl" 5
+#    test_branch "lp" 5
+
+    run_dump_test "j"
+
+#    test_special "ext" 3
+#    test_special "sex" 3
+
+#    test_macro "mov" 12
+#    test_macro "rlc" 9
+
+    run_dump_test "flag"
+#    run_dump_test "ld"
+#    run_dump_test "lr"
+#    run_dump_test "nop"
+#    run_dump_test "st"
+#    run_dump_test "sr"
+
+}
diff --git a/gas/testsuite/gas/arc/flag.d b/gas/testsuite/gas/arc/flag.d
new file mode 100644 (file)
index 0000000..68f36d3
--- /dev/null
@@ -0,0 +1,29 @@
+#objdump: -dr
+#name: flag
+
+# Test the flag macro.
+
+.*: +file format elf32-.*arc
+
+No symbols in "a.out".
+Disassembly of section .text:
+00000000 1fa00000      flag r0
+00000004 1fbf8001      flag 1
+00000008 1fbf8002      flag 2
+0000000c 1fbf8004      flag 4
+00000010 1fbf8008      flag 8
+00000014 1fbf8010      flag 16
+00000018 1fbf8020      flag 32
+0000001c 1fbf8040      flag 64
+00000020 1fbf8080      flag 128
+00000024 1fbf0000      flag -2147483647
+0000002c 1fa0000b      flag.lt r0
+00000030 1fbf0009      flag.gt 1
+00000038 1fbf0009      flag.gt 2
+00000040 1fbf0009      flag.gt 4
+00000048 1fbf0009      flag.gt 8
+00000050 1fbf0009      flag.gt 16
+00000058 1fbf0009      flag.gt 32
+00000060 1fbf0009      flag.gt 64
+00000068 1fbf0009      flag.gt 128
+00000070 1fbf000a      flag.ge -2147483647
diff --git a/gas/testsuite/gas/arc/flag.s b/gas/testsuite/gas/arc/flag.s
new file mode 100644 (file)
index 0000000..7067aa5
--- /dev/null
@@ -0,0 +1,27 @@
+# flag test
+
+       flag    r0
+
+       flag    1
+       flag    2
+       flag    4
+       flag    8
+       flag    16
+       flag    32
+       flag    64
+       flag    128
+
+       flag    0x80000001
+
+       flag.lt r0
+
+       flag.gt 1
+       flag.gt 2
+       flag.gt 4
+       flag.gt 8
+       flag.gt 16
+       flag.gt 32
+       flag.gt 64
+       flag.gt 128
+
+       flag.ge 0x80000001
diff --git a/gas/testsuite/gas/arc/math.d b/gas/testsuite/gas/arc/math.d
new file mode 100644 (file)
index 0000000..630debe
--- /dev/null
@@ -0,0 +1,78 @@
+#objdump: -dr
+#name: @OC@
+
+# Test the @OC@ insn.
+
+.*: +file format elf32-.*arc
+
+Disassembly of section .text:
+00000000 @IC+0@008400  @OC@ r0,r1,r2
+00000004 @IC+3@4db800  @OC@ r26,fp,sp
+00000008 @IC+3@af3e00  @OC@ ilink1,ilink2,blink
+0000000c @IC+7@5df800  @OC@ r58,r59,lp_count
+00000010 @IC+0@00fe00  @OC@ r0,r1,0
+00000014 @IC+0@1f8400  @OC@ r0,0,r2
+00000018 @IC+7@e08400  @OC@ 0,r1,r2
+0000001c @IC+0@00ffff  @OC@ r0,r1,511
+00000020 @IC+0@1f85ff  @OC@ r0,511,r2
+00000024 @IC+7@e085ff  @OC@ 511,r1,r2
+00000028 @IC+0@00feff  @OC@ r0,r1,255
+0000002c @IC+0@1f84ff  @OC@ r0,255,r2
+00000030 @IC+7@e084ff  @OC@ 255,r1,r2
+00000034 @IC+0@00ff00  @OC@ r0,r1,256
+00000038 @IC+0@1f8500  @OC@ r0,256,r2
+0000003c @IC+7@e08500  @OC@ 256,r1,r2
+00000040 @IC+0@00fc00  @OC@ r0,r1,256
+00000048 @IC+0@1f0400  @OC@ r0,-257,r2
+00000050 @IC+7@c08400  @OC@ 511,r1,r2
+00000058 @IC+0@1f7c00  @OC@ r0,1111638594,1111638594
+00000060 @IC+7@df7c00  @OC@ 305419896,305419896,305419896
+00000068 @IC+0@1ffcff  @OC@ r0,255,256
+00000070 @IC+0@1f7eff  @OC@ r0,256,255
+00000078 @IC+7@e0fcff  @OC@ 255,r1,256
+00000080 @IC+7@ff04ff  @OC@ 255,256,r2
+00000088 @IC+7@c0feff  @OC@ 256,r1,255
+00000090 @IC+7@df84ff  @OC@ 256,255,r2
+00000098 @IC+0@00fc00  @OC@ r0,r1,0
+               RELOC: 0000009c R_ARC_32 foo
+000000a0 @IC+0@008400  @OC@ r0,r1,r2
+000000a4 @IC+0@620a00  @OC@ r3,r4,r5
+000000a8 @IC+0@c39001  @OC@.eq r6,r7,r8
+000000ac @IC+1@251601  @OC@.eq r9,r10,r11
+000000b0 @IC+1@869c02  @OC@.ne r12,r13,r14
+000000b4 @IC+1@e82202  @OC@.ne r15,r16,r17
+000000b8 @IC+2@49a803  @OC@.p r18,r19,r20
+000000bc @IC+2@ab2e03  @OC@.p r21,r22,r23
+000000c0 @IC+3@0cb404  @OC@.n r24,r25,r26
+000000c4 @IC+3@6e3a04  @OC@.n fp,sp,ilink1
+000000c8 @IC+3@cfc005  @OC@.c ilink2,blink,r32
+000000cc @IC+4@314605  @OC@.c r33,r34,r35
+000000d0 @IC+4@92cc05  @OC@.c r36,r37,r38
+000000d4 @IC+4@f45206  @OC@.nc r39,r40,r41
+000000d8 @IC+5@55d806  @OC@.nc r42,r43,r44
+000000dc @IC+5@b75e06  @OC@.nc r45,r46,r47
+000000e0 @IC+6@18e407  @OC@.v r48,r49,r50
+000000e4 @IC+6@7a6a07  @OC@.v r51,r52,r53
+000000e8 @IC+6@dbf008  @OC@.nv r54,r55,r56
+000000ec @IC+7@3d7608  @OC@.nv r57,r58,r59
+000000f0 @IC+7@9e7809  @OC@.gt lp_count,lp_count,lp_count
+000000f4 @IC+0@007c0a  @OC@.ge r0,r0,0
+000000fc @IC+0@3f020b  @OC@.lt r1,1,r1
+00000104 @IC+7@c1040c  @OC@.le 2,r2,r2
+0000010c @IC+0@7f7c0d  @OC@.hi r3,3,3
+00000114 @IC+7@df080e  @OC@.ls 4,4,r4
+0000011c @IC+7@df7c0f  @OC@.pnz 5,5,5
+00000124 @IC+0@008500  @OC@.f r0,r1,r2
+00000128 @IC+0@00fa01  @OC@.f r0,r1,1
+0000012c @IC+0@1e8401  @OC@.f r0,1,r2
+00000130 @IC+7@a08400  @OC@.f 0,r1,r2
+00000134 @IC+0@00fd00  @OC@.f r0,r1,512
+0000013c @IC+0@1f0500  @OC@.f r0,512,r2
+00000144 @IC+7@c08500  @OC@.f 512,r1,r2
+0000014c @IC+0@008501  @OC@.eq.f r0,r1,r2
+00000150 @IC+0@00fd02  @OC@.ne.f r0,r1,0
+00000158 @IC+0@1f050b  @OC@.lt.f r0,0,r2
+00000160 @IC+7@c08509  @OC@.gt.f 0,r1,r2
+00000168 @IC+0@00fd0c  @OC@.le.f r0,r1,512
+00000170 @IC+0@1f050a  @OC@.ge.f r0,512,r2
+00000178 @IC+7@c08504  @OC@.n.f 512,r1,r2
diff --git a/gas/testsuite/gas/arc/math.s b/gas/testsuite/gas/arc/math.s
new file mode 100644 (file)
index 0000000..1cb04eb
--- /dev/null
@@ -0,0 +1,86 @@
+# @OC@ test
+
+# reg,reg,reg
+       @OC@ r0,r1,r2
+       @OC@ r26,fp,sp
+       @OC@ ilink1,ilink2,blink
+       @OC@ r58,r59,lp_count
+
+# shimm values
+       @OC@ r0,r1,0
+       @OC@ r0,0,r2
+       @OC@ 0,r1,r2
+       @OC@ r0,r1,-1
+       @OC@ r0,-1,r2
+       @OC@ -1,r1,r2
+       @OC@ r0,r1,255
+       @OC@ r0,255,r2
+       @OC@ 255,r1,r2
+       @OC@ r0,r1,-256
+       @OC@ r0,-256,r2
+       @OC@ -256,r1,r2
+
+# limm values
+       @OC@ r0,r1,256
+       @OC@ r0,-257,r2
+       @OC@ 511,r1,r2
+       @OC@ r0,0x42424242,0x42424242
+       @OC@ 0x12345678,0x12345678,0x12345678
+
+# shimm and limm
+       @OC@ r0,255,256
+       @OC@ r0,256,255
+       @OC@ 255,r1,256
+       @OC@ 255,256,r2
+       @OC@ 256,r1,255
+       @OC@ 256,255,r2
+
+# symbols
+       @OC@ r0,r1,foo
+
+# conditional execution
+       @OC@.al r0,r1,r2
+       @OC@.ra r3,r4,r5
+       @OC@.eq r6,r7,r8
+       @OC@.z r9,r10,r11
+       @OC@.ne r12,r13,r14
+       @OC@.nz r15,r16,r17
+       @OC@.pl r18,r19,r20
+       @OC@.p r21,r22,r23
+       @OC@.mi r24,r25,r26
+       @OC@.n r27,r28,r29
+       @OC@.cs r30,r31,r32
+       @OC@.c r33,r34,r35
+       @OC@.lo r36,r37,r38
+       @OC@.cc r39,r40,r41
+       @OC@.nc r42,r43,r44
+       @OC@.hs r45,r46,r47
+       @OC@.vs r48,r49,r50
+       @OC@.v r51,r52,r53
+       @OC@.vc r54,r55,r56
+       @OC@.nv r57,r58,r59
+       @OC@.gt r60,r60,r60
+       @OC@.ge r0,r0,0
+       @OC@.lt r1,1,r1
+       @OC@.le 2,r2,r2
+       @OC@.hi r3,3,3
+       @OC@.ls 4,4,r4
+       @OC@.pnz 5,5,5
+
+# flag setting
+       @OC@.f r0,r1,r2
+       @OC@.f r0,r1,1
+       @OC@.f r0,1,r2
+       @OC@.f 0,r1,r2
+       @OC@.f r0,r1,512
+       @OC@.f r0,512,r2
+       @OC@.f 512,r1,r2
+
+# conditional execution + flag setting
+       @OC@.eq.f r0,r1,r2
+       @OC@.ne.f r0,r1,0
+       @OC@.lt.f r0,0,r2
+       @OC@.gt.f 0,r1,r2
+       @OC@.le.f r0,r1,512
+       @OC@.ge.f r0,512,r2
+       @OC@.n.f 512,r1,r2