-# ARC gas testsuite
-
-# Test an insn from a template .s/.d.
-# The best way to create the .d file is to run the tests without it, let
-# dejagnu crash, run as.new on the just built .s file, run objdump -dr on
-# the result of that, copy the result into the .d file, and edit in the
-# necessary patterns (@OC@, etc.). Sounds complicated but it's easy. The
-# catch is that we assume a working assembler is used to build it. That's
-# obviously not entirely kosher, but once the .d file is created one can
-# verify it's contents over time.
-#
-# Template patterns:
-# @OC@ - placeholder for the opcode
-# @IC+?@ - place holder for the insn code
-# @I3+??@ - place holder for the operation code of code 3 insns.
-
-proc test_template_insn { cpu 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
-
- puts $out_fd "\t.cpu $cpu\n"
- 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 n rightpart
- set n [expr ($icode << 3) + $n]
- set n [format "%02x" $n]
- puts $out_fd "$leftpart$n$rightpart"
- } elseif [string match "*@I3+??@*" $line] {
- # Insert insn 3 code (register C field)
- # b15=8/0, b8=1/0 (their respective hex values in the objdump)
- regexp "^(.*)@I3\\+(.)(.)@(.*)$" $line junk leftpart b15 b8 rightpart
- set n [expr ($icode << 1) + ($b15 << 4) + ($b8 << 0)]
- 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
-
- # "make clean" won't delete these, so for now we must.
- catch "exec rm -f $objdir/$opcode.s $objdir/$opcode.d"
+# ARC base instruction set (to arc8)
+if [istarget arc*-*-*] then {
+ run_dump_test ld
+ run_dump_test ld2
+ run_dump_test st
+
+ # Specially encoded/single operand instructions
+ run_dump_test flag
+ run_dump_test brk
+ run_dump_test sleep
+ run_dump_test swi
+ run_dump_test asr
+ run_dump_test lsr
+ run_dump_test ror
+ run_dump_test rrc
+ run_dump_test sexb
+ run_dump_test sexw
+ run_dump_test extb
+ run_dump_test extw
+
+ run_dump_test b
+ run_dump_test bl
+ run_dump_test lp
+ run_dump_test j
+ run_dump_test jl
+ run_dump_test add
+ run_dump_test asl
+ # FIXME: ??? `lsl' gets dumped as `asl'
+ # run_dump_test lsl
+ run_dump_test adc
+ run_dump_test rlc
+ run_dump_test sub
+ run_dump_test sbc
+ run_dump_test and
+ run_dump_test mov
+ run_dump_test or
+ run_dump_test bic
+ run_dump_test xor
+ run_dump_test nop
}
-# Run the tests.
-
+# ARC library extensions
if [istarget arc*-*-*] then {
-
- test_template_insn base math adc 9
- test_template_insn base math add 8
- test_template_insn base math and 12
- test_template_insn base math bic 14
- test_template_insn base math or 13
- test_template_insn base math sbc 11
- test_template_insn base math sub 10
- test_template_insn base math xor 15
-
- test_template_insn base alias mov 12
- test_template_insn base alias rlc 9
- test_template_insn base alias asl 8
-# `lsl' gets dumped as `asl' so this must be tested elsewhere.
-# test_template_insn base alias lsl 8
-
- test_template_insn base sshift asr 1
- test_template_insn base sshift lsr 2
- test_template_insn base sshift ror 3
- test_template_insn base sshift rrc 4
-
- test_template_insn base branch b 4
- test_template_insn base branch bl 5
- test_template_insn base branch lp 6
-
- run_dump_test "j"
-
- test_template_insn base insn3 sexb 5
- test_template_insn base insn3 sexw 6
- test_template_insn base insn3 extb 7
- test_template_insn base insn3 extw 8
-
- run_dump_test "flag"
-# run_dump_test "nop"
-
- run_dump_test "ld"
- run_dump_test "st"
-
- # Host extension instructions
- run_dump_test "mul64"
- test_template_insn host math asl 16
- test_template_insn host math asr 18
- test_template_insn host math lsr 17
- test_template_insn host math ror 19
-
- # Graphics extension instructions
- #run_dump_test "mul64" - .cpu field wrong
- test_template_insn graphics math asl 16
- test_template_insn graphics math asr 18
- test_template_insn graphics math lsr 17
- test_template_insn graphics math ror 19
- test_template_insn graphics math padc 25
- test_template_insn graphics math padd 24
- test_template_insn graphics math pand 28
- test_template_insn graphics math psbc 27
- test_template_insn graphics math psub 26
- test_template_insn graphics alias pmov 28
-
- # Audio extension instructions
- test_template_insn audio math mac 24
- test_template_insn audio math macu 25
- test_template_insn audio math mac.s 26
- test_template_insn audio math macu.s 27
- test_template_insn audio math mul 28
- test_template_insn audio math mulu 29
- test_template_insn audio insn3 swap 9
-
+ # *TODO*
}