* config/tc-m68hc11.c: Add S12X and XGATE co-processor support.
[deliverable/binutils-gdb.git] / gas / testsuite / gas / m68hc11 / m68hc11.exp
CommitLineData
60bcf0fa
NC
1#
2# Some generic m68HC11 tests
3#
017761ea
AM
4if { ![istarget "m68hc1*-*-*"]
5 && ![istarget "m6811-*-*"]
6 && ![istarget "m6812-*-*"] } then {
7 return
60bcf0fa 8}
f39f5da9
SC
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
13proc 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
29gas_m68hc11_opcode_list "-m68hc11" 149
30gas_m68hc11_opcode_list "-m68hc12" 192
586b12ad 31gas_m68hc11_opcode_list "-m68hcs12" 192
6927f982
NC
32gas_m68hc11_opcode_list "-mm9s12x" 266
33gas_m68hc11_opcode_list "-mm9s12xg" 74
f39f5da9
SC
34
35
36# Test for a message produced when assembling a file
37proc 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.
c0b22597 44 set fd [open "$srcdir/$subdir/tst-m68hc1x.s" "w"]
f39f5da9
SC
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
70proc 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
75proc gas_m68hc11_warning { options line expect } {
76 gas_m68hc11_message "Warning" $options $line $expect
77}
78
79# ------------------
80# 68HC11 error tests
017761ea 81gas_m68hc11_error "-m68hc11" "puld\n" "Opcode .puld. is not recognized"
f39f5da9 82gas_m68hc11_error "" "ldab\n" "Invalid operand for .ldab."
017761ea
AM
83gas_m68hc11_error "-m68hc11" "ldab 256,x\n" "Operand out of 8-bit range:.*256"
84gas_m68hc11_error "-m68hc11" "ldab 257,y\n" "Operand out of 8-bit range:.*257"
85gas_m68hc11_error "-m68hc11" "ldab -1,y\n" "Operand out of 8-bit range:.*-1"
86gas_m68hc11_error "-m68hc11" "ldab bar,y\nbar=300" "value of 300 too large for field of 1 byte"
f39f5da9 87gas_m68hc11_error "" "jmp \#23\n" "Immediate operand is not allowed"
017761ea 88gas_m68hc11_error "-m68hc11" "ldab \[d,pc\]\n" "Indirect indexed addressing is not valid for 68HC11"
f39f5da9
SC
89gas_m68hc11_error "" "ldab ,t\n" "Spurious .,. or bad indirect register"
90gas_m68hc11_error "" "ldab 1,t\n" "Garbage at end of instruction:.*,t"
91gas_m68hc11_error "" "ldab 1,,x\n" "Garbage at end of instruction:.*,x"
017761ea
AM
92gas_m68hc11_error "-m68hc11" "ldab 1,+x\n" "Pre-increment mode is not valid"
93gas_m68hc11_error "-m68hc11" "ldab 1,-x\n" "Pre-increment mode is not valid"
94gas_m68hc11_error "-m68hc11" "ldab 1,x+\n" "Post-increment mode is not valid"
95gas_m68hc11_error "-m68hc11" "ldab 1,x-\n" "Post-decrement mode is not valid"
f39f5da9
SC
96gas_m68hc11_error "" "ldd \#65536\n" "Operand out of 16-bit range"
97gas_m68hc11_error "--short-branchs" "bne 200\n" \
98 "Operand out of range for a relative branch"
99gas_m68hc11_error "" "bar\n" "Opcode .bar. is not recognized."
100gas_m68hc11_error "--print-insn-syntax" "bne\n" \
101 "Instruction formats for .bne..*"
6927f982
NC
102#Check that 9s12x opcodes are rejected
103gas_m68hc11_error "-m68hc11" "subx\n" "Opcode .subx. is not recognized"
104gas_m68hc11_error "-m68hc11" "roly\n" "Opcode .roly. is not recognized"
f39f5da9
SC
105
106# ------------------
107# 68HC12 error tests
108gas_m68hc11_error "-m68hc12" "ldab x,y\n" "Invalid accumulator register"
109gas_m68hc11_error "-m68hc12" "ldab \[d,y\n" \
110 "Missing .\]. to close indexed-indirect mode"
111gas_m68hc11_error "-m68hc12" "ldab 0,\n" "Garbage at end of instruction: .,."
112gas_m68hc11_error "-m68hc12" "ldab \[d\]\n" \
113 "Missing second register or offset for indexed-indirect mode"
114gas_m68hc11_error "-m68hc12" "ldab \[d x\]\n" \
115 "Missing second register for indexed-indirect mode"
116gas_m68hc11_error "-m68hc12" "ldab \[d d\]\n" \
117 "Missing second register for indexed-indirect mode"
118gas_m68hc11_error "-m68hc12" "ldab \[pc d\]\n" \
119 "Missing second register for indexed-indirect mode"
120gas_m68hc11_error "-m68hc12" "ldab 65536,x\n" \
121 "Offset out of 16-bit range:"
122gas_m68hc11_error "-m68hc12 -S" "ibeq d,500\n" \
123 "Operand out of range for a relative branch"
124gas_m68hc11_error "-m68hc12" "ibeq pc,3\n" \
125 "Invalid register for dbcc/tbcc instruction"
126gas_m68hc11_error "-m68hc12 -S" "ibeq pc,500\n" \
127 "Invalid register for dbcc/tbcc instruction"
128gas_m68hc11_error "-m68hc12" "orab 9,+x\n" \
129 "Increment/decrement value is out of range"
130gas_m68hc11_error "-m68hc12" "orab -9,x-\n" \
131 "Increment/decrement value is out of range"
132gas_m68hc11_error "-m68hc12" "orab -3,-pc\n" \
133 "Invalid register for post/pre increment"
134gas_m68hc11_error "-m68hc12" "trap \#0\n" "Trap id .0. is out of range"
135gas_m68hc11_error "-m68hc12" "trap \#300\n" "Trap id .300. is out of range"
136gas_m68hc11_error "-m68hc12" "trap \#bar\n" "The trap id must be a constant"
137gas_m68hc11_error "-m68hc12" "sex x,d\n" \
138 "Invalid source register for this instruction, use .tfr."
139gas_m68hc11_error "-m68hc12" "tfr pc,a\n" "Invalid source register"
140gas_m68hc11_error "-m68hc12" "movb 200,x,3,y\n" \
141 "Offset out of 5-bit range for movw/movb insn: 200"
142gas_m68hc11_error "-m68hc12" "movb 2,x,300,y\n" \
143 "Offset out of 5-bit range for movw/movb insn: 300"
28d39d1a
NC
144gas_m68hc11_error "-m68hc12" "movb 2,x,bar,y\nbar=300\n" \
145 "Offset out of 5-bit range for movw/movb insn: 300"
146gas_m68hc11_error "-m68hc12" "movb bar,y,2,x\nbar=300\n" \
147 "Offset out of 5-bit range for movw/movb insn: 300"
148gas_m68hc11_error "-m68hc12" "movb 200,pc,3,y\n" \
149 "Offset out of 5-bit range for movw/movb insn: 200"
150gas_m68hc11_error "-m68hc12" "movb 2,x,300,pc\n" \
151 "Offset out of 5-bit range for movw/movb insn: 300"
152gas_m68hc11_error "-m68hc12" "movb 2,x,bar,pc\nbar=300\n" \
153 "Offset out of 5-bit range for movw/movb insn: 300"
154gas_m68hc11_error "-m68hc12" "movb bar,pc,2,x\nbar=300\n" \
155 "Offset out of 5-bit range for movw/movb insn: 300"
6927f982
NC
156#check the 9s12x opcodes not supported
157gas_m68hc11_error "-m68hc12" "subx\n" "Opcode .subx. is not recognized"
158gas_m68hc11_error "-m68hc12" "roly\n" "Opcode .roly. is not recognized"
159gas_m68hc11_error "-m68hc12" "sex d,x\n" \
160 "Invalid source register for this instruction, use .tfr."
161gas_m68hc11_error "-m68hc12" "sex d,y\n" \
162 "Invalid source register for this instruction, use .tfr."
163
164#m9s12x tests
165gas_m68hc11_error "-mm9s12x" "par r3\n" "Opcode .par. is not recognized"
166gas_m68hc11_error "-mm9s12x" "csem #1\n" "Opcode .csem. is not recognized"
167
168#m9s12xg tests
169gas_m68hc11_error "-mm9s12xg" "roly\n" "Opcode .roly. is not recognized"
170gas_m68hc11_error "-mm9s12xg" "ldab #1\n" "Opcode .ldab. is not recognized"
f39f5da9
SC
171
172# ------------------
173# Specific commands
6927f982
NC
174gas_m68hc11_warning "-m68hc11" ".mode \"bar\"\n" "Invalid mode: .bar."
175gas_m68hc11_error "-m68hc11" ".relax 23\n" "bad .relax format"
176gas_m68hc11_error "-m68hc11" ".relax bar-23\n" "bad .relax format"
177gas_m68hc11_error "-m68hc11" ".far bar bar\n" "junk at end of line"
f39f5da9 178
60bcf0fa
NC
179run_dump_test insns
180run_dump_test lbranch
181run_dump_test all_insns
68a581b8
SC
182run_dump_test insns-dwarf2
183run_dump_test lbranch-dwarf2
586b12ad
SC
184run_dump_test abi-m68hc11-16-64
185run_dump_test abi-m68hc11-16-32
186run_dump_test abi-m68hc11-32-64
60bcf0fa 187
4f69f974
SC
188# Compliance with Motorola Assembly Language Input Standard
189run_dump_test malis
190
60bcf0fa
NC
191# Some 68HC12 tests
192run_dump_test opers12
cd2b2939
SC
193run_dump_test opers12-dwarf2
194run_dump_test branchs12
195run_dump_test insns12
27bdea3d
SC
196run_dump_test indexed12
197run_dump_test bug-1825
28d39d1a 198run_dump_test movb
6927f982
NC
199
200# Some m9s12x tests
201run_dump_test insns9s12x
202run_dump_test 9s12x-exg-sex-tfr
203run_dump_test 9s12x-mov
204
205# Some m9s12xg tests
206run_dump_test insns9s12xg
207
208# Confirm hex prefixes
209run_dump_test hexprefix
210
This page took 0.509819 seconds and 4 git commands to generate.