sim: unify target->subdir handling for default tests
[platform/upstream/binutils.git] / sim / testsuite / sim / mips / basic.exp
1 # MIPS simulator instruction tests
2
3 # As gross as it is, we unset the linker script specified 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)
36 if {[istarget mips*-*-elf]} {
37
38     set dspmodels ""
39     set mdmxmodels ""
40
41     if {[istarget mipsisa64sb1*-*-elf]} {
42         set models "sb1"
43         set submodels "mips1 mips2 mips3 mips4 mips32 mips64"
44         append mdmxmodels " mips64"
45     } elseif {[istarget mipsisa64*-*-elf]} {
46         set models "mips32 mips64 mips32r2 mips64r2"
47         set submodels "mips1 mips2 mips3 mips4"
48         append dspmodels " mips32r2 mips64r2"
49         append mdmxmodels " mips64 mips32r2 mips64r2"
50     } elseif {[istarget mips*-sde-elf*]} {
51         set models "mips32 mips64 mips32r2 mips64r2"
52         set submodels ""
53         append dspmodels " mips32r2 mips64r2"
54         append mdmxmodels " mips64 mips32r2 mips64r2"
55     } elseif {[istarget mipsisa32*-*-elf]} {
56         set models "mips32 mips32r2"
57         set submodels "mips1 mips2"
58         append dspmodels " mips32r2"
59         append mdmxmodels " mips32r2"
60     } elseif {[istarget mips64vr*-*-elf]} {
61         set models "vr4100 vr4111 vr4120 vr5000 vr5400 vr5500"
62         set submodels "mips1 mips2 mips3 mips4"
63     } elseif {[istarget mips64*-*-elf]} {
64         set models "mips3"
65         set submodels "mips1 mips2"
66     } else {
67         # fall back to just testing mips1 code.
68         set models "mips1"
69         set submodels ""
70     }
71     append submodels " " $models
72     set cpu_option -march
73
74     run_sim_test sanity.s $submodels
75     foreach nops {0 1} {
76         run_hilo_test hilo-hazard-1.s $models $nops
77         run_hilo_test hilo-hazard-2.s $models $nops
78     }
79     run_hilo_test hilo-hazard-3.s $models 2
80
81     run_sim_test fpu64-ps.s $submodels
82     run_sim_test fpu64-ps-sb1.s $submodels
83
84     run_sim_test mdmx-ob.s $mdmxmodels
85     run_sim_test mdmx-ob-sb1.s $mdmxmodels
86
87     run_sim_test mips32-dsp.s $dspmodels
88     run_sim_test mips32-dsp2.s $dspmodels
89 }