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