(test_template_insn): Document usage.

New parameter `cpu', callers updated.
(main body): Test host/graphics/audio extensions.
Test ext/sex insns.
This commit is contained in:
David Edelsohn 1995-04-08 23:43:39 +00:00
parent 48fb4d9f90
commit 3a5e9b6e86

View File

@ -1,8 +1,20 @@
# 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 { tmpl opcode icode } {
proc test_template_insn { cpu tmpl opcode icode } {
global srcdir subdir objdir
# Change @OC@ in the template file to $opcode
@ -11,6 +23,7 @@ proc test_template_insn { tmpl opcode icode } {
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
@ -58,40 +71,66 @@ proc test_template_insn { tmpl opcode icode } {
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_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 alias mov 12
test_template_insn alias rlc 9
test_template_insn alias asl 8
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 alias lsl 8
# test_template_insn base alias lsl 8
test_template_insn sshift asr 1
test_template_insn sshift lsr 2
test_template_insn sshift ror 3
test_template_insn sshift rrc 4
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 branch b 4
test_template_insn branch bl 5
test_template_insn branch lp 6
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_special "ext" 3
# test_special "sex" 3
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 "ld"
# run_dump_test "lr"
# run_dump_test "nop"
# run_dump_test "st"
# run_dump_test "sr"
# Host extension instructions
test_template_insn host math mul64 20
test_template_insn host math mulu64 21
# Graphics extension instructions
test_template_insn graphics math mul64 20
test_template_insn graphics math mulu64 21
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
}