1 # MIPS simulator instruction tests
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
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} {
14 foreach insn "{mult\t\$4,\$4} {div\t\$0,\$4,\$4} {mt$reg\t\$4}" {
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"
24 verbose -log "HILO test:\n$contents"
25 set file [open hilo-hazard.inc w]
29 run_sim_test $testfile $models
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]} {
39 if {[istarget mipsisa64*-elf]} {
40 set models "mips32 mips64"
41 set submodels "mips1 mips2 mips3 mips4"
42 } elseif {[istarget mipsisa32*-elf]} {
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]} {
50 set submodels "mips1 mips2"
52 # fall back to just testing mips1 code.
56 append submodels " " $models
59 run_sim_test sanity.s $submodels
61 run_hilo_test hilo-hazard-1.s $models $nops
62 run_hilo_test hilo-hazard-2.s $models $nops
64 run_hilo_test hilo-hazard-3.s $models 2