* sim/mips/hilo-hazard-[123].s: New files.
[deliverable/binutils-gdb.git] / sim / testsuite / sim / mips / basic.exp
1 # MIPS simulator instruction tests
2
3 # As gross as it is, we unset the linker script specifid by the target
4 # board. The MIPS libgloss linker scripts include libgcc (and possibly
5 # other libraries), which the linker (used to link these tests rather
6 # than the compiler) can't necessarily find.
7 unset_currtarget_info ldscript
8
9 # Do "run_sim_test TESTFILE MODELS" for each combination of the
10 # mf{lo,hi} -> mult/div/mt{lo,hi} hazard described in mips.igen.
11 # Insert NOPS nops after the mflo or mfhi.
12 proc run_hilo_test {testfile models nops} {
13 foreach reg {lo hi} {
14 foreach insn "{mult\t\$4,\$4} {div\t\$0,\$4,\$4} {mt$reg\t\$4}" {
15 set contents ""
16 append contents "\t.macro hilo\n"
17 append contents "\tmf$reg\t\$4\n"
18 append contents "\t.rept\t$nops\n"
19 append contents "\tnop\n"
20 append contents "\t.endr\n"
21 append contents "\t$insn\n"
22 append contents "\t.endm"
23
24 verbose -log "HILO test:\n$contents"
25 set file [open hilo-hazard.inc w]
26 puts $file $contents
27 close $file
28
29 run_sim_test $testfile $models
30 }
31 }
32 }
33
34
35 # Only test mips*-elf (e.g., no mips-linux), and only test if the target
36 # board really is a simulator (sim tests don't work on real HW).
37 if {[istarget mips*-elf] && [board_info target exists is_simulator]} {
38
39 if {[istarget mipsisa64*-elf]} {
40 set models "mips32 mips64"
41 set submodels "mips1 mips2 mips3 mips4"
42 } elseif {[istarget mipsisa32*-elf]} {
43 set models "mips32"
44 set submodels "mips1 mips2"
45 } elseif {[istarget mips64vr-*-elf] || [istarget mips64vrel-*-elf]} {
46 set models "vr4100 vr4111 vr4120 vr5000 vr5400 vr5500"
47 set submodels "mips1 mips2 mips3 mips4"
48 } elseif {[istarget mips64*-elf]} {
49 set models "mips3"
50 set submodels "mips1 mips2"
51 } else {
52 # fall back to just testing mips1 code.
53 set models "mips1"
54 set submodels ""
55 }
56 append submodels " " $models
57 set cpu_option -march
58
59 run_sim_test sanity.s $submodels
60 foreach nops {0 1} {
61 run_hilo_test hilo-hazard-1.s $models $nops
62 run_hilo_test hilo-hazard-2.s $models $nops
63 }
64 run_hilo_test hilo-hazard-3.s $models 2
65 }
This page took 0.032144 seconds and 5 git commands to generate.