2007-02-17 Thiemo Seufer <ths@mips.com>
[deliverable/binutils-gdb.git] / sim / testsuite / sim / mips / basic.exp
CommitLineData
df0a8012
CD
1# MIPS simulator instruction tests
2
a5e3001a 3# As gross as it is, we unset the linker script specified by the target
df0a8012
CD
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.
7unset_currtarget_info ldscript
8
a584aa63
RS
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.
12proc 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
a5e3001a 35# Only test mips*-*-elf (e.g., no mips*-*-linux), and only test if the target
df0a8012 36# board really is a simulator (sim tests don't work on real HW).
a5e3001a 37if {[istarget mips*-*-elf] && [board_info target exists is_simulator]} {
df0a8012 38
a5e3001a 39 set dspmodels ""
3669427c 40 set mdmxmodels ""
a5e3001a
TS
41
42 if {[istarget mipsisa64sb1*-*-elf]} {
5dbb7b5a
CD
43 set models "sb1"
44 set submodels "mips1 mips2 mips3 mips4 mips32 mips64"
3669427c 45 append mdmxmodels " mips64"
a5e3001a
TS
46 } elseif {[istarget mipsisa64*-*-elf]} {
47 set models "mips32 mips64 mips32r2 mips64r2"
a584aa63 48 set submodels "mips1 mips2 mips3 mips4"
a5e3001a 49 append dspmodels " mips32r2 mips64r2"
3669427c
TS
50 append mdmxmodels " mips64 mips32r2 mips64r2"
51 } elseif {[istarget mips*-sde-elf*]} {
52 set models "mips32 mips64 mips32r2 mips64r2"
53 set submodels ""
54 append dspmodels " mips32r2 mips64r2"
55 append mdmxmodels " mips64 mips32r2 mips64r2"
a5e3001a
TS
56 } elseif {[istarget mipsisa32*-*-elf]} {
57 set models "mips32 mips32r2"
a584aa63 58 set submodels "mips1 mips2"
a5e3001a 59 append dspmodels " mips32r2"
3669427c 60 append mdmxmodels " mips32r2"
a5e3001a 61 } elseif {[istarget mips64vr*-*-elf]} {
a584aa63
RS
62 set models "vr4100 vr4111 vr4120 vr5000 vr5400 vr5500"
63 set submodels "mips1 mips2 mips3 mips4"
a5e3001a 64 } elseif {[istarget mips64*-*-elf]} {
a584aa63
RS
65 set models "mips3"
66 set submodels "mips1 mips2"
df0a8012
CD
67 } else {
68 # fall back to just testing mips1 code.
69 set models "mips1"
a584aa63 70 set submodels ""
df0a8012 71 }
a584aa63 72 append submodels " " $models
df0a8012
CD
73 set cpu_option -march
74
a584aa63
RS
75 run_sim_test sanity.s $submodels
76 foreach nops {0 1} {
77 run_hilo_test hilo-hazard-1.s $models $nops
78 run_hilo_test hilo-hazard-2.s $models $nops
79 }
80 run_hilo_test hilo-hazard-3.s $models 2
55dc1ac4
CD
81
82 run_sim_test fpu64-ps.s $submodels
5dbb7b5a 83 run_sim_test fpu64-ps-sb1.s $submodels
cdc89eb2 84
3669427c
TS
85 run_sim_test mdmx-ob.s $mdmxmodels
86 run_sim_test mdmx-ob-sb1.s $mdmxmodels
fcc392a3 87
a5e3001a 88 run_sim_test mips32-dsp.s $dspmodels
df0a8012 89}
This page took 0.131293 seconds and 4 git commands to generate.