opcode/
[binutils-gdb.git] / gas / testsuite / gas / mips / mips.exp
1 #
2 # Some generic MIPS tests
3 #
4
5 # When adding a new test to this file, try to do the following things:
6 #
7 # * If testing assembly and disassembly of code, don't forget to test
8 # the actual bit encodings of the instructions (using the
9 # --show-raw-insn flag to objdump).
10 #
11 # * Try to run the test for as many architectures as appropriate,
12 # using the "run_dump_test_arches" or "run_list_test_arches" functions,
13 # along with the output from a call to "mips_arch_list_matching."
14 #
15 # * Be sure to compare the test output before and after your testsuite
16 # changes, to verify that existing and new tests were run as expected.
17 # Look for expect ERROR messages in the testsuite .log file to make sure
18 # the new expect code did not contain errors.
19
20 # To add support for a new CPU to this file, add an appropriate entry
21 # to the sequence of "mips_arch_create" function calls below, and test
22 # the result. The new CPU should automatically be used when running
23 # various tests. If the new CPU is the default CPU for any tool
24 # targets, make sure the call to "mips_arch_create" reflects that fact.
25
26
27 # "LOSE" marks information about tests which fail at a particular point
28 # in time, but which are not XFAILed. Either they used to pass
29 # and indicate either regressions or the need to tweak the tests to keep
30 # up the with code, or they are new tests and it is unknown whether or not
31 # they should pass as-is for the given object formats.
32
33
34 # The functions below create and manipulate an "architecture data
35 # array" which contains entries for each MIPS architecture (or CPU)
36 # known to these tests. The array contains the following information
37 # for each architecture, indexed by the name of the architecture
38 # described by the entry:
39 #
40 # displayname: The name of the entry to be used for pretty-printing.
41 #
42 # gprsize: The size in bits of General Purpose Registers provided by
43 # the architecture (must be 32 or 64).
44 #
45 # props: A list of text strings which are associated with the
46 # architecture. These include the architecture name as well as
47 # information about what instructions the CPU supports. When matching
48 # based on properties, an additional property is added to the normal
49 # property list, "gpr<gprsize>" so that tests can match CPUs which
50 # have GPRs of a specific size. The following properties are most
51 # useful when matching properties for generic (i.e., not CPU-specific)
52 # tests:
53 #
54 # mips1, mips2, mips3, mips4, mips5, mips32, mips64
55 # The architecture includes the instructions defined
56 # by that MIPS ISA.
57 #
58 # fpisa3, fpisa4, fpisa5
59 # The architecture includes the floating-point
60 # instructions defined by that MIPS ISA.
61 #
62 # gpr_ilocks
63 # The architecture interlocks GPRs accesses. (That is,
64 # there are no load delay slots.)
65 #
66 # mips3d The architecture includes the MIPS-3D ASE.
67 #
68 # ror The architecture includes hardware rotate instructions.
69 #
70 # gpr32, gpr64
71 # The architecture provides 32- or 64-bit General Purpose
72 # Registers.
73 #
74 # as_flags: The assembler flags used when assembling tests for this
75 # architecture.
76 #
77 # objdump_flags: The objdump flags used when disassembling tests for
78 # this architecture.
79 #
80 # Most entries in the architecture array will have values in all of
81 # the fields above. One entry, "default" represents the default CPU
82 # based on the target of the assembler being built. If always has
83 # empty "as_flags" and "objdump_flags."
84
85 # mips_arch_init
86 #
87 # This function initializes the architecture data array ("mips_arches")
88 # to be empty.
89 proc mips_arch_init {} {
90 global mips_arches
91
92 # Catch because the variable won't be set the first time through.
93 catch {unset mips_arches}
94 }
95
96 # mips_arch_create ARCH GPRSIZE EXTENDS PROPS AS_FLAGS OBJDUMP_FLAGS \
97 # (optional:) DEFAULT_FOR_TARGETS
98 #
99 # This function creates a new entry in the architecture data array,
100 # for the architecture or CPU named ARCH, and fills in the entry
101 # according to the rest of the arguments.
102 #
103 # The new entry's property list is initialized to contain ARCH, any
104 # properties specified by PROPS, and the properties associated with
105 # the entry specified by EXTENDS. (The new architecture is considered
106 # to extend the capabilities provided by that architecture.)
107 #
108 # If DEFAULT_FOR_TARGETS is specified, it is a list of targets for which
109 # this architecture is the default architecture. If "istarget" returns
110 # true for any of the targets in the list, a "default" entry will be
111 # added to the architecture array which indicates that ARCH is the default
112 # architecture.
113 proc mips_arch_create {arch gprsize extends props as_flags objdump_flags
114 {default_for_targets {}}} {
115 global mips_arches
116
117 if { [info exists mips_arches($arch)] } {
118 error "mips_arch_create: arch \"$arch\" already exists"
119 }
120 if { $gprsize != 32 && $gprsize != 64 } {
121 error "mips_arch_create: invalid GPR size $gprsize"
122 }
123
124 set archdata(displayname) $arch
125 set archdata(gprsize) $gprsize
126 set archdata(as_flags) $as_flags
127 set archdata(objdump_flags) $objdump_flags
128 set archdata(props) $arch
129 eval lappend archdata(props) $props
130 if { [string length $extends] != 0 } {
131 eval lappend archdata(props) [mips_arch_properties $extends 0]
132 }
133
134 set mips_arches($arch) [array get archdata]
135
136 # Set as default if appropriate.
137 foreach target $default_for_targets {
138 if { [istarget $target] } {
139 if { [info exists mips_arches(default)] } {
140 error "mips_arch_create: default arch already exists"
141 }
142
143 set archdata(displayname) "default = $arch"
144 set archdata(as_flags) ""
145 set archdata(objdump_flags) ""
146
147 set mips_arches(default) [array get archdata]
148 break
149 }
150 }
151 }
152
153 # mips_arch_destroy ARCH
154 #
155 # The opposite of the above. This function removes an entry from
156 # the architecture data array, for the architecture or CPU named ARCH.
157
158 proc mips_arch_destroy {arch} {
159 global mips_arches
160
161 if { [info exists mips_arches($arch)] } {
162 unset mips_arches($arch)
163 }
164 }
165
166 # mips_arch_list_all
167 #
168 # This function returns the list of all names of entries in the
169 # architecture data array (including the default entry, if a default
170 # is known).
171 proc mips_arch_list_all {} {
172 global mips_arches
173 return [lsort -dictionary [array names mips_arches]]
174 }
175
176 # mips_arch_data ARCH
177 #
178 # This function returns the information associated with ARCH
179 # in the architecture data array, in "array get" form.
180 proc mips_arch_data {arch} {
181 global mips_arches
182
183 if { ! [info exists mips_arches($arch)] } {
184 error "mips_arch_data: unknown arch \"$arch\""
185 }
186 return $mips_arches($arch)
187 }
188
189 # mips_arch_displayname ARCH
190 #
191 # This function returns the printable name associated with ARCH in
192 # the architecture data array.
193 proc mips_arch_displayname {arch} {
194 array set archdata [mips_arch_data $arch]
195 return $archdata(displayname)
196 }
197
198 # mips_arch_properties ARCH (optional:) INCLUDE_GPRSIZE
199 #
200 # This function returns the property list associated with ARCH in the
201 # architecture data array, including the "canonical" target name as the
202 # first element.
203 #
204 # If INCLUDE_GPRSIZE is non-zero, an additional "gpr32" or "gpr64"
205 # property will be returned as part of the list based on the
206 # architecture's GPR size.
207 proc mips_arch_properties {arch {include_gprsize 1}} {
208 array set archdata [mips_arch_data $arch]
209 set props $archdata(props)
210 if { $include_gprsize } {
211 lappend props gpr$archdata(gprsize)
212 }
213 return $props
214 }
215
216 # mips_arch_as_flags ARCH
217 #
218 # This function returns the assembler flags associated with ARCH in
219 # the architecture data array.
220 proc mips_arch_as_flags {arch} {
221 array set archdata [mips_arch_data $arch]
222 return $archdata(as_flags)
223 }
224
225 # mips_arch_objdump_flags ARCH
226 #
227 # This function returns the objdump disassembly flags associated with
228 # ARCH in the architecture data array.
229 proc mips_arch_objdump_flags {arch} {
230 array set archdata [mips_arch_data $arch]
231 return $archdata(objdump_flags)
232 }
233
234 # mips_arch_matches ARCH PROPMATCHLIST
235 #
236 # This function returns non-zero if ARCH matches the set of properties
237 # described by PROPMATCHLIST. Each entry in PROPMATCHLIST can either
238 # be the name of a property which must be matched, or "!" followed by
239 # the name of a property which must not be matched. ARCH matches
240 # PROPMATCHLIST if and only if all of the conditions specified by
241 # PROPMATCHLIST are satisfied.
242 proc mips_arch_matches {arch propmatchlist} {
243 foreach pm $propmatchlist {
244 if { [string match {!*} $pm] } {
245 # fail if present.
246 set inverted 1
247 set p [string range $pm 1 end]
248 } {
249 # fail if not present.
250 set inverted 0
251 set p $pm
252 }
253
254 set loc [lsearch -exact [mips_arch_properties $arch] $p]
255
256 # required-absent and found, or required-present and not found: fail.
257 if { ($inverted && $loc != -1) || (! $inverted && $loc == -1) } {
258 return 0
259 }
260 }
261 return 1
262 }
263
264 # mips_arch_list_matching ARGS
265 #
266 # This function returns a list of all architectures which match
267 # the conditions described by its arguments. Its arguments are
268 # taken as a list and used as the PROPMATCHLIST in a call to
269 # "mips_arch_matches" for each known architecture.
270 proc mips_arch_list_matching {args} {
271 set l ""
272 foreach arch [mips_arch_list_all] {
273 # For now, don't match default arch until we know what its
274 # properties actually are.
275 if { [string compare $arch default] == 0
276 && [string length [mips_arch_properties default]] == 0} {
277 continue
278 }
279 if { [mips_arch_matches $arch $args] } {
280 lappend l $arch
281 }
282 }
283 return $l
284 }
285
286
287 # The functions below facilitate running various types of tests.
288
289 # run_dump_test_arch NAME ARCH
290 #
291 # Invoke "run_dump_test" for test NAME, with extra assembler and
292 # disassembler flags to test architecture ARCH.
293 #
294 # You can override the expected output for particular architectures
295 # and file formats. The possible test names are, in order of preference:
296 #
297 # 1. CARCH@FORMAT@NAME.d
298 # 2. CARCH@NAME.d
299 # 3. FORMAT@NAME.d
300 # 4. NAME.d
301 #
302 # where CARCH is the "canonical" name of architecture ARCH as recorded
303 # in its associated property list, and where FORMAT is the target's
304 # file format (one of "elf", "ecoff" or "aout").
305 proc run_dump_test_arch { name arch } {
306 upvar elf elf ecoff ecoff aout aout
307 global subdir srcdir
308
309 set format [expr { $elf ? "elf" : $ecoff ? "ecoff" : "aout" }]
310 set proparch [lindex [mips_arch_properties $arch 0] 0]
311 set prefixes [list ${proparch}@${format}@ ${proparch}@ ]
312 if { [ string match "octeon*" $proparch ] && $proparch != "octeon" } {
313 lappend prefixes octeon@
314 lappend prefixes octeon@${format}@
315 }
316 lappend prefixes ${format}@
317 foreach prefix ${prefixes} {
318 set archname ${prefix}${name}
319 if { [file exists "$srcdir/$subdir/${archname}.d"] } {
320 set name $archname
321 break
322 }
323 }
324
325 if [catch {run_dump_test $name \
326 "{name {([mips_arch_displayname $arch])}}
327 {objdump {[mips_arch_objdump_flags $arch]}}
328 {as {[mips_arch_as_flags $arch]}}"} rv] {
329 perror "$rv"
330 untested "$subdir/$name ($arch)"
331 }
332 }
333
334 # run_dump_test_arches NAME ARCH_LIST
335 #
336 # Invoke "run_dump_test_arch" for test NAME, for each architecture
337 # listed in ARCH_LIST.
338 proc run_dump_test_arches { name arch_list } {
339 upvar elf elf ecoff ecoff aout aout
340 foreach arch $arch_list {
341 run_dump_test_arch "$name" "$arch"
342 }
343 }
344
345 # run_list_test_arch NAME OPTS ARCH
346 #
347 # Invoke "run_list_test" for test NAME with options OPTS, with extra
348 # assembler flags to test architecture ARCH.
349 proc run_list_test_arch { name opts arch } {
350 global subdir
351
352 set testname "MIPS $name ([mips_arch_displayname $arch])"
353 if [catch {run_list_test "$name" "$opts [mips_arch_as_flags $arch]" \
354 "$testname"} rv] {
355 perror "$rv"
356 untested "$testname"
357 }
358 }
359
360 # run_list_test_arches NAME OPTS ARCH_LIST
361 #
362 # Invoke "run_list_test_arch" for test NAME with options OPTS, for each
363 # architecture listed in ARCH_LIST.
364 proc run_list_test_arches { name opts arch_list } {
365 foreach arch $arch_list {
366 run_list_test_arch "$name" "$opts" "$arch"
367 }
368 }
369
370
371 # Create the architecture data array by providing data for all
372 # known architectures.
373 #
374 # Note that several targets pick default CPU based on ABI. We
375 # can't easily handle that; do NOT list those targets as defaulting
376 # to any architecture.
377 mips_arch_init
378 mips_arch_create mips1 32 {} {} \
379 { -march=mips1 -mtune=mips1 } { -mmips:3000 }
380 mips_arch_create mips2 32 mips1 { gpr_ilocks } \
381 { -march=mips2 -mtune=mips2 } { -mmips:6000 }
382 mips_arch_create mips3 64 mips2 { fpisa3 } \
383 { -march=mips3 -mtune=mips3 } { -mmips:4000 }
384 mips_arch_create mips4 64 mips3 { fpisa4 } \
385 { -march=mips4 -mtune=mips4 } { -mmips:8000 }
386 mips_arch_create mips5 64 mips4 { fpisa5 } \
387 { -march=mips5 -mtune=mips5 } { -mmips:mips5 }
388 mips_arch_create mips32 32 mips2 {} \
389 { -march=mips32 -mtune=mips32 } { -mmips:isa32 } \
390 { mipsisa32-*-* mipsisa32el-*-* }
391 mips_arch_create mips32r2 32 mips32 { fpisa3 fpisa4 fpisa5 ror } \
392 { -march=mips32r2 -mtune=mips32r2 } \
393 { -mmips:isa32r2 } \
394 { mipsisa32r2-*-* mipsisa32r2el-*-* }
395 mips_arch_create mips64 64 mips5 { mips32 } \
396 { -march=mips64 -mtune=mips64 } { -mmips:isa64 } \
397 { mipsisa64-*-* mipsisa64el-*-* }
398 mips_arch_create mips64r2 64 mips64 { mips32r2 ror } \
399 { -march=mips64r2 -mtune=mips64r2 } \
400 { -mmips:isa64r2 } \
401 { mipsisa64r2-*-* mipsisa64r2el-*-* }
402 mips_arch_create mips16 32 {} {} \
403 { -march=mips1 -mips16 } { -mmips:16 }
404 mips_arch_create micromips 64 mips64r2 {} \
405 { -march=mips64 -mmicromips } {}
406 mips_arch_create r3000 32 mips1 {} \
407 { -march=r3000 -mtune=r3000 } { -mmips:3000 }
408 mips_arch_create r3900 32 mips1 { gpr_ilocks } \
409 { -march=r3900 -mtune=r3900 } { -mmips:3900 } \
410 { mipstx39-*-* mipstx39el-*-* }
411 mips_arch_create r4000 64 mips3 {} \
412 { -march=r4000 -mtune=r4000 } { -mmips:4000 }
413 mips_arch_create vr5400 64 mips4 { ror } \
414 { -march=vr5400 -mtune=vr5400 } { -mmips:5400 }
415 mips_arch_create sb1 64 mips64 { mips3d } \
416 { -march=sb1 -mtune=sb1 } { -mmips:sb1 } \
417 { mipsisa64sb1-*-* mipsisa64sb1el-*-* }
418 mips_arch_create octeon 64 mips64r2 {} \
419 { -march=octeon -mtune=octeon } { -mmips:octeon } \
420 { mips64octeon*-*-* }
421 mips_arch_create octeonp 64 octeon {} \
422 { -march=octeon+ -mtune=octeon+ } { -mmips:octeon+ } \
423 { }
424 mips_arch_create xlr 64 mips64 {} \
425 { -march=xlr -mtune=xlr } { -mmips:xlr }
426
427 #
428 # And now begin the actual tests! VxWorks uses RELA rather than REL
429 # relocations, so most of the generic dump tests will not work there.
430 #
431 if { [istarget mips*-*-vxworks*] } {
432 run_dump_test "vxworks1"
433 run_dump_test "vxworks1-xgot"
434 run_dump_test "vxworks1-el"
435 run_dump_test "vxworks1-xgot-el"
436 } elseif { [istarget mips*-*-*] } {
437 set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] || [istarget *-*-netbsd*] ]
438 set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
439 set aout [expr [istarget *-*-bsd*] || [istarget *-*-openbsd*] ]
440 set addr32 [expr [istarget mipstx39*-*-*] || [istarget mips-*-linux*] || [istarget mipsel-*-linux*] || [istarget mips*-*-ecoff]]
441 set has_newabi [expr [istarget *-*-irix6*] || [istarget mips64*-*-linux*]]
442 set no_mips16 [expr !$elf]
443 set no_micromips [expr !$elf]
444
445 if { [istarget "mips*-*-*linux*"] || [istarget "mips*-sde-elf*"] } then {
446 set tmips "t"
447 } else {
448 set tmips ""
449 }
450 if [istarget mips*el-*-*] {
451 set el "el"
452 } {
453 set el ""
454 }
455 if { $no_mips16 } {
456 mips_arch_destroy mips16
457 }
458 if { $no_micromips } {
459 mips_arch_destroy micromips
460 }
461
462 run_dump_test_arches "abs" [mips_arch_list_matching mips1]
463 run_dump_test_arches "add" [mips_arch_list_matching mips1]
464 run_dump_test_arches "and" [mips_arch_list_matching mips1]
465 run_dump_test_arches "mips1-fp" [mips_arch_list_matching mips1]
466 run_list_test_arches "mips1-fp" "-32 -msoft-float" \
467 [mips_arch_list_matching mips1]
468 run_dump_test "break20"
469 run_dump_test "trap20"
470
471 # LOSE: As of 2002-02-08, "beq" through "bltu" fail for target mips-ecoff.
472 # See http://sources.redhat.com/ml/binutils/2001-10/msg00418.html for
473 # more information. Not sure if the fixes there are correct; should
474 # branches to external labels be allowed for ECOFF?
475 run_dump_test_arches "beq" [mips_arch_list_matching mips1]
476 run_dump_test_arches "bge" [mips_arch_list_matching mips1]
477 run_dump_test_arches "bgeu" [mips_arch_list_matching mips1]
478 run_dump_test_arches "blt" [mips_arch_list_matching mips1]
479 run_dump_test_arches "bltu" [mips_arch_list_matching mips1]
480 run_dump_test_arches "branch-likely" [mips_arch_list_matching mips2]
481 run_dump_test_arches "branch-misc-1" [mips_arch_list_matching mips1]
482 run_dump_test_arches "branch-misc-2" [mips_arch_list_matching mips1]
483 run_dump_test_arches "branch-misc-2pic" [mips_arch_list_matching mips1]
484 run_dump_test_arches "branch-misc-2-64" [mips_arch_list_matching mips3]
485 run_dump_test_arches "branch-misc-2pic-64" [mips_arch_list_matching mips3]
486 run_dump_test "branch-misc-3"
487 run_dump_test "branch-swap"
488 run_dump_test "div"
489
490 if { !$addr32 } {
491 run_dump_test_arches "dli" [mips_arch_list_matching mips3]
492 }
493 if $elf {
494 run_dump_test_arches "elf-jal" [mips_arch_list_matching mips1]
495 } else {
496 run_dump_test "jal"
497 }
498 run_dump_test_arches "jal-mask-11" [mips_arch_list_matching mips1]
499 run_dump_test_arches "jal-mask-12" [mips_arch_list_matching mips1]
500 run_dump_test_arches "jal-mask-21" [mips_arch_list_matching micromips]
501 run_dump_test_arches "jal-mask-22" [mips_arch_list_matching micromips]
502 run_dump_test "eret-1"
503 run_dump_test "eret-2"
504 run_dump_test "eret-3"
505 run_dump_test_arches "24k-branch-delay-1" \
506 [mips_arch_list_matching mips1]
507 run_dump_test_arches "24k-triple-stores-1" \
508 [mips_arch_list_matching fpisa5 !octeon]
509 run_dump_test_arches "24k-triple-stores-2" \
510 [mips_arch_list_matching mips2]
511 run_dump_test_arches "24k-triple-stores-3" \
512 [mips_arch_list_matching mips2]
513 run_dump_test_arches "24k-triple-stores-4" \
514 [mips_arch_list_matching mips2]
515 run_dump_test_arches "24k-triple-stores-5" \
516 [mips_arch_list_matching mips1]
517 run_dump_test_arches "24k-triple-stores-6" \
518 [mips_arch_list_matching mips2]
519 run_dump_test_arches "24k-triple-stores-7" \
520 [mips_arch_list_matching mips2]
521 run_dump_test_arches "24k-triple-stores-8" \
522 [mips_arch_list_matching mips1]
523 run_dump_test_arches "24k-triple-stores-9" \
524 [mips_arch_list_matching mips1]
525 run_dump_test_arches "24k-triple-stores-10" \
526 [mips_arch_list_matching mips1]
527 if $elf {
528 run_dump_test_arches "24k-triple-stores-11" \
529 [mips_arch_list_matching mips1]
530 }
531
532 if $elf {
533 run_dump_test_arches "jal-svr4pic" \
534 [mips_arch_list_matching mips1]
535 run_dump_test_arches "jal-svr4pic-noreorder" \
536 [mips_arch_list_matching mips1]
537 }
538 if $elf { run_dump_test "jal-xgot" }
539 run_list_test_arches "jal-range" "-32" [mips_arch_list_matching mips1]
540 if $has_newabi { run_dump_test "jal-newabi" }
541 if !$aout { run_dump_test "la" }
542 if $elf { run_dump_test "la-svr4pic" }
543 if $elf { run_dump_test "la-xgot" }
544 if $elf { run_dump_test "lca-svr4pic" }
545 if $elf { run_dump_test "lca-xgot" }
546 if !$aout {
547 # XXX FIXME: Has mips2 and later insns with mips1 disassemblies.
548 # (Should split and then use appropriate arch lists.)
549 run_dump_test_arches "lb" [mips_arch_list_matching mips1 !mips2]
550 }
551 if $elf {
552 run_dump_test_arches "lb-svr4pic" \
553 [mips_arch_list_matching mips1 !gpr_ilocks]
554 run_dump_test_arches "lb-svr4pic-ilocks" [mips_arch_list_matching gpr_ilocks]
555 }
556 if $elf {
557 # Both versions specify the cpu, so we can run both regardless of
558 # the interlocking in the configured default cpu.
559 run_dump_test "lb-xgot"
560 run_dump_test "lb-xgot-ilocks"
561 }
562 if !$aout {
563 run_dump_test_arches "ld" [mips_arch_list_matching mips1]
564 run_dump_test_arches "ld-forward" \
565 [mips_arch_list_matching mips1]
566 run_dump_test_arches "sd" [mips_arch_list_matching mips1]
567 run_dump_test_arches "sd-forward" \
568 [mips_arch_list_matching mips1]
569 run_dump_test_arches "l_d" [mips_arch_list_matching mips1]
570 run_dump_test_arches "l_d-forward" \
571 [mips_arch_list_matching mips1]
572 run_dump_test_arches "s_d" [mips_arch_list_matching mips1]
573 run_dump_test_arches "s_d-forward" \
574 [mips_arch_list_matching mips1]
575 run_dump_test_arches "ldc1" [mips_arch_list_matching mips2]
576 run_dump_test_arches "ldc1-forward" \
577 [mips_arch_list_matching mips2]
578 run_dump_test_arches "sdc1" [mips_arch_list_matching mips2]
579 run_dump_test_arches "sdc1-forward" \
580 [mips_arch_list_matching mips2]
581 if $has_newabi {
582 run_dump_test_arches "ld-n32" \
583 [mips_arch_list_matching mips3]
584 run_dump_test_arches "ld-forward-n32" \
585 [mips_arch_list_matching mips3]
586 run_dump_test_arches "sd-n32" \
587 [mips_arch_list_matching mips3]
588 run_dump_test_arches "sd-forward-n32" \
589 [mips_arch_list_matching mips3]
590 run_dump_test_arches "l_d-n32" \
591 [mips_arch_list_matching mips3]
592 run_dump_test_arches "l_d-forward-n32" \
593 [mips_arch_list_matching mips3]
594 run_dump_test_arches "s_d-n32" \
595 [mips_arch_list_matching mips3]
596 run_dump_test_arches "s_d-forward-n32" \
597 [mips_arch_list_matching mips3]
598 run_dump_test_arches "ldc1-n32" \
599 [mips_arch_list_matching mips3]
600 run_dump_test_arches "ldc1-forward-n32" \
601 [mips_arch_list_matching mips3]
602 run_dump_test_arches "sdc1-n32" \
603 [mips_arch_list_matching mips3]
604 run_dump_test_arches "sdc1-forward-n32" \
605 [mips_arch_list_matching mips3]
606 run_dump_test_arches "ld-n64" \
607 [mips_arch_list_matching mips3]
608 run_dump_test_arches "ld-forward-n64" \
609 [mips_arch_list_matching mips3]
610 run_dump_test_arches "sd-n64" \
611 [mips_arch_list_matching mips3]
612 run_dump_test_arches "sd-forward-n64" \
613 [mips_arch_list_matching mips3]
614 run_dump_test_arches "l_d-n64" \
615 [mips_arch_list_matching mips3]
616 run_dump_test_arches "l_d-forward-n64" \
617 [mips_arch_list_matching mips3]
618 run_dump_test_arches "s_d-n64" \
619 [mips_arch_list_matching mips3]
620 run_dump_test_arches "s_d-forward-n64" \
621 [mips_arch_list_matching mips3]
622 run_dump_test_arches "ldc1-n64" \
623 [mips_arch_list_matching mips3]
624 run_dump_test_arches "ldc1-forward-n64" \
625 [mips_arch_list_matching mips3]
626 run_dump_test_arches "sdc1-n64" \
627 [mips_arch_list_matching mips3]
628 run_dump_test_arches "sdc1-forward-n64" \
629 [mips_arch_list_matching mips3]
630 }
631 }
632 if $elf { run_dump_test "ld-svr4pic" }
633 if $elf { run_dump_test "ld-xgot" }
634 run_dump_test_arches "li" [mips_arch_list_matching mips1]
635 if !$aout { run_dump_test "lifloat" }
636 if $elf { run_dump_test "lif-svr4pic" }
637 if $elf { run_dump_test "lif-xgot" }
638 run_dump_test_arches "mips4" [mips_arch_list_matching mips4]
639 run_dump_test_arches "mips4-fp" [mips_arch_list_matching fpisa4]
640 run_list_test_arches "mips4-fp" "-32 -msoft-float" \
641 [mips_arch_list_matching fpisa4]
642 run_dump_test_arches "mips4-branch-likely" \
643 [mips_arch_list_matching mips4]
644 run_list_test_arches "mips4-branch-likely" "-32 -msoft-float" \
645 [mips_arch_list_matching mips4]
646 run_dump_test_arches "mips5-fp" [mips_arch_list_matching fpisa5]
647 run_dump_test "mul"
648
649 run_dump_test_arches "rol" [mips_arch_list_matching mips1 !ror]
650 run_dump_test_arches "rol-hw" [mips_arch_list_matching ror]
651
652 run_dump_test_arches "rol64" [mips_arch_list_matching gpr64 !ror]
653 run_dump_test_arches "rol64-hw" [mips_arch_list_matching gpr64 ror]
654
655 if !$aout { run_dump_test "sb" }
656 run_dump_test "trunc"
657 if !$aout { run_dump_test "ulh" }
658 run_dump_test_arches "ulh2-eb" [mips_arch_list_matching mips1]
659 run_dump_test_arches "ulh2-el" [mips_arch_list_matching mips1]
660 if $elf { run_dump_test "ulh-svr4pic" }
661 if $elf { run_dump_test "ulh-xgot" }
662 if !$aout {
663 run_dump_test "ulw"
664 run_dump_test "uld"
665 run_dump_test "ush"
666 run_dump_test "usw"
667 run_dump_test "usd"
668 }
669 run_dump_test_arches "ulw2-eb" \
670 [mips_arch_list_matching mips1 !gpr_ilocks]
671 run_dump_test_arches "ulw2-eb-ilocks" [mips_arch_list_matching gpr_ilocks]
672 run_dump_test_arches "ulw2-el" \
673 [mips_arch_list_matching mips1 !gpr_ilocks]
674 run_dump_test_arches "ulw2-el-ilocks" [mips_arch_list_matching gpr_ilocks]
675
676 run_dump_test_arches "uld2-eb" [mips_arch_list_matching mips3]
677 run_dump_test_arches "uld2-el" [mips_arch_list_matching mips3]
678
679 # The mips16 test can only be run on ELF, because only ELF
680 # supports the necessary mips16 reloc.
681 if { $elf && !$no_mips16 } {
682 run_dump_test "mips16"
683 run_dump_test "mips16-64"
684 # Check MIPS16e extensions
685 run_dump_test_arches "mips16e" \
686 [mips_arch_list_matching mips32 !micromips]
687 # Check jalx handling
688 run_dump_test "mips16-jalx"
689 run_dump_test "mips-jalx"
690 run_dump_test "mips-jalx-2"
691 # Check MIPS16 HI16/LO16 relocations
692 run_dump_test "mips16-hilo"
693 if $has_newabi {
694 run_dump_test "mips16-hilo-n32"
695 }
696 run_dump_test "mips16-hilo-match"
697 }
698 run_dump_test "delay"
699 run_dump_test "nodelay"
700 run_dump_test "mips4010"
701 run_dump_test "mips4650"
702 run_dump_test "mips4100"
703 run_dump_test "vr4111"
704 run_dump_test "vr4120"
705 run_dump_test "vr4120-2"
706 run_dump_test "vr4130"
707 run_dump_test "vr5400"
708 run_dump_test "vr5500"
709 run_dump_test "rm7000"
710 run_dump_test "perfcount"
711 run_dump_test "lineno"
712 run_dump_test "sync"
713
714 run_dump_test_arches "mips32" [mips_arch_list_matching mips32]
715 run_dump_test_arches "mips32-imm" [mips_arch_list_matching mips32]
716
717 run_dump_test_arches "mips32-sf32" [mips_arch_list_matching mips32]
718 run_list_test_arches "mips32-sf32" "-32 -msoft-float" \
719 [mips_arch_list_matching mips32]
720 run_dump_test_arches "mips32-cp2" [mips_arch_list_matching mips32 \
721 !octeon]
722
723 run_dump_test_arches "mips32r2" [mips_arch_list_matching mips32r2]
724 run_dump_test_arches "mips32r2-cp2" [mips_arch_list_matching mips32r2 \
725 !octeon]
726 run_dump_test_arches "mips32r2-fp32" \
727 [mips_arch_list_matching mips32r2]
728 run_list_test_arches "mips32r2-fp32" "-32 -msoft-float" \
729 [mips_arch_list_matching mips32r2]
730 run_list_test_arches "mips32r2-ill" "-32" \
731 [mips_arch_list_matching mips32r2 gpr32]
732 run_list_test_arches "mips32r2-ill-fp64" "-mabi=o64" \
733 [mips_arch_list_matching mips32r2 gpr64]
734 run_list_test_arches "mips32r2-ill-nofp" "-32 -msoft-float" \
735 [mips_arch_list_matching mips32r2]
736
737 run_dump_test_arches "mips64" [mips_arch_list_matching mips64]
738 run_dump_test_arches "mips64-cp2" [mips_arch_list_matching mips64 \
739 !octeon]
740
741 run_dump_test_arches "mips64r2" [mips_arch_list_matching mips64r2]
742 run_list_test_arches "mips64r2-ill" "" [mips_arch_list_matching mips64r2]
743
744 run_dump_test "set-arch"
745
746 if { !$addr32 } {
747 run_dump_test "mips64-mips3d"
748 run_dump_test_arches "mips64-mips3d-incl" [mips_arch_list_matching mips3d]
749
750 run_dump_test "mips64-mdmx"
751 run_dump_test "sb1-ext-mdmx"
752 run_dump_test "sb1-ext-ps"
753 run_dump_test "xlr-ext"
754 }
755
756 run_dump_test_arches "relax" [mips_arch_list_matching mips2]
757 run_dump_test_arches "relax-at" [mips_arch_list_matching mips2]
758 run_dump_test "relax-swap1-mips1"
759 run_dump_test "relax-swap1-mips2"
760 run_dump_test "relax-swap2"
761 run_dump_test_arches "relax-swap3" [mips_arch_list_all]
762 run_list_test_arches "relax-bposge" "-mdsp -relax-branch" \
763 [mips_arch_list_matching mips64r2 \
764 !micromips]
765
766 run_list_test "illegal" "-32"
767 run_list_test "baddata1" "-32"
768 run_list_test "jalr" ""
769
770 # LOSE: As of 2002-02-08, the next 4 tests fail for target mips-ecoff.
771 # It's unknown whether they _should_ pass as-is, or whether different
772 # variants are needed for ELF and ECOFF.
773 run_dump_test "mips-gp32-fp32"
774 run_dump_test "mips-gp32-fp64"
775 run_dump_test "mips-gp64-fp32"
776 run_dump_test "mips-gp64-fp64"
777
778 if $elf {
779 # Make sure that -mcpu=FOO and -mFOO are equivalent. Assemble a file
780 # containing 4650-specific instructions with -m4650 and -mcpu=4650,
781 # and verify that they're the same. Specifically, we're checking
782 # that the EF_MIPS_MACH field is set, and that the 4650 'mul'
783 # instruction does get used. In previous versions of GAS,
784 # only -mcpu=4650 would set the EF_MIPS_MACH field; -m4650 wouldn't.
785 run_dump_test "elf_e_flags1"
786 run_dump_test "elf_e_flags2"
787 run_dump_test "elf_e_flags3"
788 run_dump_test "elf_e_flags4"
789
790 # Check EF_MIPS_ARCH markings for each supported architecture.
791 run_dump_test "elf_arch_mips1"
792 run_dump_test "elf_arch_mips2"
793 run_dump_test "elf_arch_mips3"
794 run_dump_test "elf_arch_mips4"
795 run_dump_test "elf_arch_mips5"
796 run_dump_test "elf_arch_mips32"
797 run_dump_test "elf_arch_mips32r2"
798 run_dump_test "elf_arch_mips64"
799 run_dump_test "elf_arch_mips64r2"
800
801 # Verify that ASE markings are handled properly.
802 if { !$no_mips16 } {
803 run_dump_test "elf_ase_mips16"
804 run_dump_test "elf_ase_mips16-2"
805 }
806 if { !$no_micromips } {
807 run_dump_test "elf_ase_micromips"
808 run_dump_test "elf_ase_micromips-2"
809 }
810
811 run_dump_test "mips-gp32-fp32-pic"
812 run_dump_test "mips-gp32-fp64-pic"
813 run_dump_test "mips-gp64-fp32-pic"
814 run_dump_test "mips-gp64-fp64-pic"
815
816 run_dump_test "mips-abi32"
817 run_dump_test "mips-abi32-pic"
818 run_dump_test "mips-abi32-pic2"
819
820 run_dump_test "elf${el}-rel"
821 run_dump_test_arches "elf${el}-rel2" [mips_arch_list_matching gpr64]
822 run_dump_test "e32${el}-rel2"
823 run_dump_test "elf${el}-rel3"
824 run_dump_test_arches "elf-rel4" [mips_arch_list_matching gpr64]
825 run_dump_test "e32-rel4"
826 run_dump_test "elf-rel5"
827 run_dump_test "elf-rel6"
828 if $has_newabi {
829 run_dump_test "elf-rel6-n32"
830 run_dump_test "elf-rel6-n64"
831 }
832 run_dump_test "elf-rel7"
833 run_dump_test "elf-rel8"
834 run_dump_test "elf-rel8-mips16"
835 run_dump_test "elf-rel9"
836 run_dump_test "elf-rel9-mips16"
837 if $has_newabi {
838 run_dump_test "elf-rel10"
839 run_dump_test "elf-rel11"
840 }
841 run_dump_test "elf-rel12"
842 run_dump_test "elf-rel13"
843 run_dump_test "elf-rel13-mips16"
844 run_dump_test "elf-rel14"
845
846 if $has_newabi {
847 run_dump_test "elf-rel15"
848 run_dump_test "elf-rel16"
849
850 run_dump_test "elf-rel-got-n32"
851 run_dump_test "elf-rel-xgot-n32"
852 run_dump_test "elf-rel-got-n64"
853 run_dump_test "elf-rel-xgot-n64"
854 }
855 run_dump_test "elf-rel17"
856 if $has_newabi {
857 run_dump_test "elf-rel18"
858 }
859 run_dump_test "elf-rel19"
860 run_dump_test "elf-rel20"
861 if $has_newabi {
862 run_dump_test "elf-rel21"
863 run_dump_test "elf-rel22"
864 run_dump_test "elf-rel23"
865 run_dump_test "elf-rel23a"
866 run_dump_test "elf-rel23b"
867 run_dump_test "elf-rel24"
868 }
869
870 run_dump_test "elf-rel25"
871 run_dump_test "elf-rel25a"
872 run_dump_test "elf-rel26"
873
874 run_dump_test_arches "elf-rel27" [mips_arch_list_all]
875
876 if $has_newabi {
877 run_dump_test "elf-rel28-n32"
878 run_dump_test "elf-rel28-n64"
879 }
880
881 if { !$no_mips16 } {
882 run_dump_test "${tmips}mips${el}16-e"
883 run_dump_test "${tmips}mips${el}16-f"
884 }
885 run_dump_test "elf-consthilo"
886 run_dump_test "expr1"
887
888 run_list_test "tls-ill" "-32"
889 run_dump_test "tls-o32"
890 run_dump_test "jalr2"
891
892 run_dump_test_arches "aent" [mips_arch_list_matching mips1]
893
894 run_dump_test_arches "branch-misc-4" \
895 [mips_arch_list_matching mips1]
896 run_dump_test_arches "branch-misc-4-64" \
897 [mips_arch_list_matching mips3]
898
899 run_dump_test_arches "loc-swap" [mips_arch_list_all]
900 run_dump_test_arches "loc-swap-dis" \
901 [mips_arch_list_all]
902 run_dump_test_arches "loc-swap-2" [mips_arch_list_all]
903 }
904
905 if $has_newabi {
906 run_dump_test "n32-consec"
907 }
908
909 # tests of objdump's ability to disassemble using different
910 # register names.
911 run_dump_test "gpr-names-numeric"
912 run_dump_test "gpr-names-32"
913 run_dump_test "gpr-names-n32"
914 run_dump_test "gpr-names-64"
915
916 run_dump_test "fpr-names-numeric"
917 run_dump_test "fpr-names-32"
918 run_dump_test "fpr-names-n32"
919 run_dump_test "fpr-names-64"
920
921 run_dump_test "cp0-names-numeric"
922 run_dump_test "cp0-names-r3000"
923 run_dump_test "cp0-names-r4000" \
924 { { {name} {(r4000)} } { {objdump} {-M cp0-names=r4000} } }
925 run_dump_test "cp0-names-r4000" \
926 { { {name} {(r4400)} } { {objdump} {-M cp0-names=r4400} } }
927 run_dump_test "cp0-names-mips32"
928 run_dump_test "cp0-names-mips32r2"
929 run_dump_test "cp0-names-mips64"
930 run_dump_test "cp0-names-mips64r2"
931 run_dump_test "cp0-names-sb1"
932
933 run_dump_test "cp0sel-names-numeric"
934 run_dump_test "cp0sel-names-mips32"
935 run_dump_test "cp0sel-names-mips32r2"
936 run_dump_test "cp0sel-names-mips64"
937 run_dump_test "cp0sel-names-mips64r2"
938 run_dump_test "cp0sel-names-sb1"
939
940 run_dump_test "hwr-names-numeric"
941 run_dump_test "hwr-names-mips32r2"
942 run_dump_test "hwr-names-mips64r2"
943
944 run_dump_test "ldstla-32"
945 run_dump_test "ldstla-32-mips3"
946 run_dump_test "ldstla-32-shared"
947 run_dump_test "ldstla-32-mips3-shared"
948 run_list_test "ldstla-32-1" "-mabi=32" \
949 "MIPS ld-st-la bad constants (ABI o32)"
950 run_list_test "ldstla-32-mips3-1" "-mabi=32" \
951 "MIPS ld-st-la bad constants (ABI o32, mips3)"
952 run_list_test "ldstla-32-1" "-KPIC -mabi=32" \
953 "MIPS ld-st-la bad constants (ABI o32, shared)"
954 run_list_test "ldstla-32-mips3-1" "-KPIC -mabi=32" \
955 "MIPS ld-st-la bad constants (ABI o32, mips3, shared)"
956 run_dump_test "ldstla-eabi64"
957 if $has_newabi {
958 run_dump_test "ldstla-n64"
959 run_dump_test "ldstla-n64-shared"
960 run_dump_test "ldstla-n64-sym32"
961 }
962
963 run_dump_test "macro-warn-1"
964 run_dump_test "macro-warn-2"
965 run_dump_test "macro-warn-3"
966 run_dump_test "macro-warn-4"
967 if $has_newabi {
968 run_dump_test "macro-warn-1-n32"
969 run_dump_test "macro-warn-2-n32"
970 }
971
972 run_dump_test "noat-1"
973 run_list_test "noat-2" ""
974 run_list_test "noat-3" ""
975 run_list_test "noat-4" ""
976 run_list_test "noat-5" ""
977 run_list_test "noat-6" ""
978 run_list_test "noat-7" ""
979
980 run_dump_test "at-1"
981 run_list_test "at-2" "-32 -mips1" "MIPS at-2"
982
983 run_dump_test "loongson-2e"
984 run_dump_test "loongson-2f"
985 run_dump_test "loongson-2f-2"
986 run_dump_test "loongson-2f-3"
987
988 run_dump_test "loongson-3a"
989 run_dump_test "loongson-3a-2"
990 run_dump_test "loongson-3a-3"
991
992 run_dump_test_arches "octeon" [mips_arch_list_matching octeon]
993 run_dump_test_arches "octeon-saa-saad" [mips_arch_list_matching octeonp]
994 run_list_test_arches "octeon-ill" "" \
995 [mips_arch_list_matching octeon]
996 run_dump_test_arches "octeon-pref" [mips_arch_list_matching octeon]
997
998 run_dump_test "smartmips"
999 run_dump_test "mips32-dsp"
1000 run_dump_test "mips32-dspr2"
1001 run_dump_test "mips64-dsp"
1002 run_dump_test "mips32-mt"
1003
1004 if { $elf && !$no_mips16 } {
1005 run_dump_test "mips16-dwarf2"
1006 if $has_newabi {
1007 run_dump_test "mips16-dwarf2-n32"
1008 }
1009 }
1010 if { !$no_mips16 } {
1011 run_dump_test "mips16e-jrc"
1012 run_dump_test "mips16e-save"
1013 run_dump_test "mips16e-64"
1014 run_list_test "mips16e-64" "-march=mips32 -32"
1015 run_dump_test "mips16-intermix"
1016 }
1017 run_dump_test "vxworks1"
1018 run_dump_test "vxworks1-xgot"
1019 run_dump_test "vxworks1-el"
1020 run_dump_test "vxworks1-xgot-el"
1021
1022 run_dump_test "noreorder"
1023 run_dump_test "align"
1024 run_dump_test "align2"
1025 run_dump_test "align2-el"
1026 run_dump_test "odd-float"
1027
1028 run_list_test_arches "mips-macro-ill-sfp" "-32 -msingle-float" \
1029 [mips_arch_list_matching mips2]
1030 run_list_test_arches "mips-macro-ill-nofp" "-32 -msoft-float" \
1031 [mips_arch_list_matching mips2]
1032
1033 run_list_test_arches "mips-hard-float-flag" \
1034 "-32 -msoft-float -mhard-float" \
1035 [mips_arch_list_matching mips1]
1036 run_list_test_arches "mips-double-float-flag" \
1037 "-32 -msingle-float -mdouble-float" \
1038 [mips_arch_list_matching mips1]
1039
1040 run_dump_test "mips16-vis-1"
1041 run_dump_test "call-nonpic-1"
1042 run_dump_test "mips32-sync"
1043 run_dump_test_arches "mips32r2-sync" \
1044 [mips_arch_list_matching mips32r2]
1045 run_dump_test_arches "alnv_ps-swap" [mips_arch_list_matching fpisa5]
1046 run_dump_test_arches "cache" [lsort -dictionary -unique [concat \
1047 [mips_arch_list_matching mips3] \
1048 [mips_arch_list_matching mips32] ] ]
1049 run_dump_test_arches "daddi" [mips_arch_list_matching mips3]
1050 run_dump_test_arches "pref" [lsort -dictionary -unique [concat \
1051 [mips_arch_list_matching mips4] \
1052 [mips_arch_list_matching mips32] ] ]
1053
1054 if $has_newabi { run_dump_test "cfi-n64-1" }
1055
1056 run_dump_test "pr12915"
1057 run_dump_test "reginfo-1a"
1058 run_dump_test "reginfo-1b"
1059
1060 if { !$no_micromips } {
1061 run_dump_test "micromips"
1062 run_dump_test "micromips-trap"
1063 run_list_test "micromips-size-0" \
1064 "-32 -march=mips64 -mmicromips" "microMIPS instruction size 0"
1065 run_dump_test "micromips-size-1"
1066 run_dump_test "micromips-branch-relax"
1067 run_dump_test "micromips-branch-relax-pic"
1068 run_dump_test "micromips-branch-delay"
1069 }
1070
1071 run_dump_test_arches "mcu" [mips_arch_list_matching mips32r2 \
1072 !octeon]
1073 }