* config/tc-m68hc11.c: Add S12X and XGATE co-processor support.
[deliverable/binutils-gdb.git] / gas / testsuite / gas / m68hc11 / m68hc11.exp
1 #
2 # Some generic m68HC11 tests
3 #
4 if { ![istarget "m68hc1*-*-*"]
5 && ![istarget "m6811-*-*"]
6 && ![istarget "m6812-*-*"] } then {
7 return
8 }
9
10 # Simple test for --print-opcodes (list of supported opcodes)
11 # We don't check the list result but just the syntax and the
12 # number it
13 proc gas_m68hc11_opcode_list { flags expect_count } {
14 global comp_output
15
16 set testname "Opcode list generation \[$flags\]"
17 gas_run "x.s" "--print-opcodes $flags" ""
18
19 set lines [split $comp_output "\n"]
20 set cnt [llength $lines]
21 verbose -log "Found $cnt opcodes"
22 if { $cnt == $expect_count } then {
23 pass $testname
24 } else {
25 fail $testname
26 }
27 }
28
29 gas_m68hc11_opcode_list "-m68hc11" 149
30 gas_m68hc11_opcode_list "-m68hc12" 192
31 gas_m68hc11_opcode_list "-m68hcs12" 192
32 gas_m68hc11_opcode_list "-mm9s12x" 266
33 gas_m68hc11_opcode_list "-mm9s12xg" 74
34
35
36 # Test for a message produced when assembling a file
37 proc gas_m68hc11_message { kind options line expect } {
38 global srcdir
39 global subdir
40
41 regsub -all "\n" "$line: $expect" " " title
42
43 # Make a file containing the instructions to assemble.
44 set fd [open "$srcdir/$subdir/tst-m68hc1x.s" "w"]
45 puts -nonewline $fd "$line"
46 close $fd
47
48 verbose -log "Test: $title"
49 gas_start "tst-m68hc1x.s" "$options"
50 set ok 0
51 while 1 {
52 expect {
53 -re ".*: Assembler messages:\n" { }
54 -re ".*1: $kind: $expect" { incr ok; break }
55 timeout { perror "timeout\n"; break }
56 eof { verbose "EOF from gas"; break }
57 }
58 }
59 #sleep 1 # Uncomment this line when using gcov
60 gas_finish
61 if { $ok > 0 } then {
62 pass $title
63 } else {
64 fail $title
65 }
66 catch "exec rm -f $srcdir/$subdir/tst-m68hc1x.s"
67 }
68
69 # Test for an error message produced by gas
70 proc gas_m68hc11_error { options line expect } {
71 gas_m68hc11_message "Error" $options $line $expect
72 }
73
74 # Test for a warning message produced by gas
75 proc gas_m68hc11_warning { options line expect } {
76 gas_m68hc11_message "Warning" $options $line $expect
77 }
78
79 # ------------------
80 # 68HC11 error tests
81 gas_m68hc11_error "-m68hc11" "puld\n" "Opcode .puld. is not recognized"
82 gas_m68hc11_error "" "ldab\n" "Invalid operand for .ldab."
83 gas_m68hc11_error "-m68hc11" "ldab 256,x\n" "Operand out of 8-bit range:.*256"
84 gas_m68hc11_error "-m68hc11" "ldab 257,y\n" "Operand out of 8-bit range:.*257"
85 gas_m68hc11_error "-m68hc11" "ldab -1,y\n" "Operand out of 8-bit range:.*-1"
86 gas_m68hc11_error "-m68hc11" "ldab bar,y\nbar=300" "value of 300 too large for field of 1 byte"
87 gas_m68hc11_error "" "jmp \#23\n" "Immediate operand is not allowed"
88 gas_m68hc11_error "-m68hc11" "ldab \[d,pc\]\n" "Indirect indexed addressing is not valid for 68HC11"
89 gas_m68hc11_error "" "ldab ,t\n" "Spurious .,. or bad indirect register"
90 gas_m68hc11_error "" "ldab 1,t\n" "Garbage at end of instruction:.*,t"
91 gas_m68hc11_error "" "ldab 1,,x\n" "Garbage at end of instruction:.*,x"
92 gas_m68hc11_error "-m68hc11" "ldab 1,+x\n" "Pre-increment mode is not valid"
93 gas_m68hc11_error "-m68hc11" "ldab 1,-x\n" "Pre-increment mode is not valid"
94 gas_m68hc11_error "-m68hc11" "ldab 1,x+\n" "Post-increment mode is not valid"
95 gas_m68hc11_error "-m68hc11" "ldab 1,x-\n" "Post-decrement mode is not valid"
96 gas_m68hc11_error "" "ldd \#65536\n" "Operand out of 16-bit range"
97 gas_m68hc11_error "--short-branchs" "bne 200\n" \
98 "Operand out of range for a relative branch"
99 gas_m68hc11_error "" "bar\n" "Opcode .bar. is not recognized."
100 gas_m68hc11_error "--print-insn-syntax" "bne\n" \
101 "Instruction formats for .bne..*"
102 #Check that 9s12x opcodes are rejected
103 gas_m68hc11_error "-m68hc11" "subx\n" "Opcode .subx. is not recognized"
104 gas_m68hc11_error "-m68hc11" "roly\n" "Opcode .roly. is not recognized"
105
106 # ------------------
107 # 68HC12 error tests
108 gas_m68hc11_error "-m68hc12" "ldab x,y\n" "Invalid accumulator register"
109 gas_m68hc11_error "-m68hc12" "ldab \[d,y\n" \
110 "Missing .\]. to close indexed-indirect mode"
111 gas_m68hc11_error "-m68hc12" "ldab 0,\n" "Garbage at end of instruction: .,."
112 gas_m68hc11_error "-m68hc12" "ldab \[d\]\n" \
113 "Missing second register or offset for indexed-indirect mode"
114 gas_m68hc11_error "-m68hc12" "ldab \[d x\]\n" \
115 "Missing second register for indexed-indirect mode"
116 gas_m68hc11_error "-m68hc12" "ldab \[d d\]\n" \
117 "Missing second register for indexed-indirect mode"
118 gas_m68hc11_error "-m68hc12" "ldab \[pc d\]\n" \
119 "Missing second register for indexed-indirect mode"
120 gas_m68hc11_error "-m68hc12" "ldab 65536,x\n" \
121 "Offset out of 16-bit range:"
122 gas_m68hc11_error "-m68hc12 -S" "ibeq d,500\n" \
123 "Operand out of range for a relative branch"
124 gas_m68hc11_error "-m68hc12" "ibeq pc,3\n" \
125 "Invalid register for dbcc/tbcc instruction"
126 gas_m68hc11_error "-m68hc12 -S" "ibeq pc,500\n" \
127 "Invalid register for dbcc/tbcc instruction"
128 gas_m68hc11_error "-m68hc12" "orab 9,+x\n" \
129 "Increment/decrement value is out of range"
130 gas_m68hc11_error "-m68hc12" "orab -9,x-\n" \
131 "Increment/decrement value is out of range"
132 gas_m68hc11_error "-m68hc12" "orab -3,-pc\n" \
133 "Invalid register for post/pre increment"
134 gas_m68hc11_error "-m68hc12" "trap \#0\n" "Trap id .0. is out of range"
135 gas_m68hc11_error "-m68hc12" "trap \#300\n" "Trap id .300. is out of range"
136 gas_m68hc11_error "-m68hc12" "trap \#bar\n" "The trap id must be a constant"
137 gas_m68hc11_error "-m68hc12" "sex x,d\n" \
138 "Invalid source register for this instruction, use .tfr."
139 gas_m68hc11_error "-m68hc12" "tfr pc,a\n" "Invalid source register"
140 gas_m68hc11_error "-m68hc12" "movb 200,x,3,y\n" \
141 "Offset out of 5-bit range for movw/movb insn: 200"
142 gas_m68hc11_error "-m68hc12" "movb 2,x,300,y\n" \
143 "Offset out of 5-bit range for movw/movb insn: 300"
144 gas_m68hc11_error "-m68hc12" "movb 2,x,bar,y\nbar=300\n" \
145 "Offset out of 5-bit range for movw/movb insn: 300"
146 gas_m68hc11_error "-m68hc12" "movb bar,y,2,x\nbar=300\n" \
147 "Offset out of 5-bit range for movw/movb insn: 300"
148 gas_m68hc11_error "-m68hc12" "movb 200,pc,3,y\n" \
149 "Offset out of 5-bit range for movw/movb insn: 200"
150 gas_m68hc11_error "-m68hc12" "movb 2,x,300,pc\n" \
151 "Offset out of 5-bit range for movw/movb insn: 300"
152 gas_m68hc11_error "-m68hc12" "movb 2,x,bar,pc\nbar=300\n" \
153 "Offset out of 5-bit range for movw/movb insn: 300"
154 gas_m68hc11_error "-m68hc12" "movb bar,pc,2,x\nbar=300\n" \
155 "Offset out of 5-bit range for movw/movb insn: 300"
156 #check the 9s12x opcodes not supported
157 gas_m68hc11_error "-m68hc12" "subx\n" "Opcode .subx. is not recognized"
158 gas_m68hc11_error "-m68hc12" "roly\n" "Opcode .roly. is not recognized"
159 gas_m68hc11_error "-m68hc12" "sex d,x\n" \
160 "Invalid source register for this instruction, use .tfr."
161 gas_m68hc11_error "-m68hc12" "sex d,y\n" \
162 "Invalid source register for this instruction, use .tfr."
163
164 #m9s12x tests
165 gas_m68hc11_error "-mm9s12x" "par r3\n" "Opcode .par. is not recognized"
166 gas_m68hc11_error "-mm9s12x" "csem #1\n" "Opcode .csem. is not recognized"
167
168 #m9s12xg tests
169 gas_m68hc11_error "-mm9s12xg" "roly\n" "Opcode .roly. is not recognized"
170 gas_m68hc11_error "-mm9s12xg" "ldab #1\n" "Opcode .ldab. is not recognized"
171
172 # ------------------
173 # Specific commands
174 gas_m68hc11_warning "-m68hc11" ".mode \"bar\"\n" "Invalid mode: .bar."
175 gas_m68hc11_error "-m68hc11" ".relax 23\n" "bad .relax format"
176 gas_m68hc11_error "-m68hc11" ".relax bar-23\n" "bad .relax format"
177 gas_m68hc11_error "-m68hc11" ".far bar bar\n" "junk at end of line"
178
179 run_dump_test insns
180 run_dump_test lbranch
181 run_dump_test all_insns
182 run_dump_test insns-dwarf2
183 run_dump_test lbranch-dwarf2
184 run_dump_test abi-m68hc11-16-64
185 run_dump_test abi-m68hc11-16-32
186 run_dump_test abi-m68hc11-32-64
187
188 # Compliance with Motorola Assembly Language Input Standard
189 run_dump_test malis
190
191 # Some 68HC12 tests
192 run_dump_test opers12
193 run_dump_test opers12-dwarf2
194 run_dump_test branchs12
195 run_dump_test insns12
196 run_dump_test indexed12
197 run_dump_test bug-1825
198 run_dump_test movb
199
200 # Some m9s12x tests
201 run_dump_test insns9s12x
202 run_dump_test 9s12x-exg-sex-tfr
203 run_dump_test 9s12x-mov
204
205 # Some m9s12xg tests
206 run_dump_test insns9s12xg
207
208 # Confirm hex prefixes
209 run_dump_test hexprefix
210
This page took 0.03504 seconds and 4 git commands to generate.