Commit | Line | Data |
---|---|---|
02cc32c5 DE |
1 | # ARC gas testsuite |
2 | ||
3 | # Test an insn from a template .s/.d. | |
4 | ||
5 | proc test_template_insn { tmpl opcode icode } { | |
6 | global srcdir subdir objdir | |
7 | ||
8 | # Change @OC@ in the template file to $opcode | |
9 | ||
10 | set in_fd [open $srcdir/$subdir/$tmpl.s r] | |
11 | set out_fd [open $objdir/$opcode.s w] | |
12 | # FIXME: check return codes | |
13 | ||
14 | while { [gets $in_fd line] >= 0 } { | |
15 | regsub "@OC@" $line $opcode line | |
16 | puts $out_fd $line | |
17 | } | |
18 | ||
19 | close $in_fd | |
20 | close $out_fd | |
21 | ||
22 | # Create output template. | |
23 | ||
24 | set in_fd [open $srcdir/$subdir/$tmpl.d r] | |
25 | set out_fd [open $objdir/$opcode.d w] | |
26 | # FIXME: check return codes | |
27 | ||
28 | while { [gets $in_fd line] >= 0 } { | |
29 | regsub "@OC@" $line $opcode line | |
30 | #send_user "$line\n" | |
31 | if [string match "*@IC+?@*" $line] { | |
32 | # Insert the opcode. It occupies the top 5 bits. | |
33 | regexp "^(.*)@(IC\\+)(.)@(.*)$" $line junk leftpart icodepart n rightpart | |
34 | set n [expr ($icode << 3) + $n] | |
35 | set n [format "%02x" $n] | |
36 | puts $out_fd "$leftpart$n$rightpart" | |
37 | } else { | |
38 | puts $out_fd $line | |
39 | } | |
40 | } | |
41 | ||
42 | close $in_fd | |
43 | close $out_fd | |
44 | ||
45 | # Finally, run the test. | |
46 | ||
47 | run_dump_test $objdir/$opcode | |
48 | } | |
49 | ||
50 | # Run the tests. | |
51 | ||
52 | if [istarget arc*-*-*] then { | |
53 | ||
54 | test_template_insn math adc 9 | |
55 | test_template_insn math add 8 | |
56 | test_template_insn math and 12 | |
57 | test_template_insn math bic 14 | |
58 | test_template_insn math or 13 | |
59 | test_template_insn math sbc 11 | |
60 | test_template_insn math sub 10 | |
61 | test_template_insn math xor 15 | |
62 | ||
63 | # test_shift "asl" 8 | |
64 | # test_shift "asr" 3 | |
65 | # test_shift "lsl" 8 | |
66 | # test_shift "lsr" 3 | |
67 | # test_shift "ror" 3 | |
68 | # test_shift "rrc" 3 | |
69 | ||
70 | # test_branch "b" 4 | |
71 | # test_branch "bl" 5 | |
72 | # test_branch "lp" 5 | |
73 | ||
74 | run_dump_test "j" | |
75 | ||
76 | # test_special "ext" 3 | |
77 | # test_special "sex" 3 | |
78 | ||
79 | # test_macro "mov" 12 | |
80 | # test_macro "rlc" 9 | |
81 | ||
82 | run_dump_test "flag" | |
83 | # run_dump_test "ld" | |
84 | # run_dump_test "lr" | |
85 | # run_dump_test "nop" | |
86 | # run_dump_test "st" | |
87 | # run_dump_test "sr" | |
88 | ||
89 | } |