2002-03-15 Chris G. Demetriou <cgd@broadcom.com>
[binutils-gdb.git] / gas / testsuite / gas / mips / mips.exp
1 #
2 # Some generic MIPS tests
3 #
4
5 # "LOSE" marks information about tests which fail at a particular point
6 # in time, but which are not XFAILed. Either they used to pass
7 # and indicate either regressions or the need to tweak the tests to keep
8 # up the with code, or they are new tests and it is unknown whether or not
9 # they should pass as-is for the given object formats.
10
11 proc run_list_test { name opts } {
12 global srcdir subdir
13 set testname "MIPS $name"
14 set file $srcdir/$subdir/$name
15 gas_run ${name}.s $opts ">&dump.out"
16 if { [regexp_diff "dump.out" "${file}.l"] } then {
17 fail $testname
18 verbose "output is [file_contents "dump.out"]" 2
19 return
20 }
21 pass $testname
22 }
23
24 if { [istarget mips*-*-*] } then {
25 set no_mips16 0
26 set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] || [istarget *-*-netbsd*] ]
27 set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
28 set aout [expr [istarget *-*-bsd*] || [istarget *-*-openbsd*] ]
29 set ilocks [istarget mipstx39*-*-*]
30 set gpr_ilocks [expr [istarget mipstx39*-*-*]]
31 set addr32 [expr [istarget mipstx39*-*-*]]
32
33 if { [istarget "mips*-*-*linux*"] } then {
34 set tmips "t"
35 } else {
36 set tmips ""
37 }
38 if [istarget mips*el-*-*] {
39 set el el
40 } {
41 set el ""
42 }
43
44 run_dump_test "abs"
45 run_dump_test "add"
46 run_dump_test "and"
47 run_dump_test "break20"
48 run_dump_test "trap20"
49
50 # LOSE: As of 2002-02-08, "beq" through "bltu" fail for target mips-ecoff.
51 # See http://sources.redhat.com/ml/binutils/2001-10/msg00418.html for
52 # more information. Not sure if the fixes there are correct; should
53 # branches to external labels be allowed for ECOFF?
54 run_dump_test "beq"
55 run_dump_test "bge"
56 run_dump_test "bgeu"
57 run_dump_test "blt"
58 run_dump_test "bltu"
59
60 if !$ilocks { run_dump_test "div" } else { run_dump_test "div-ilocks" }
61 run_dump_test "dli"
62 if $elf {
63 run_dump_test "elf-jal"
64 } else {
65 run_dump_test "jal"
66 }
67 if $elf { run_dump_test "jal-svr4pic" }
68 if $elf { run_dump_test "jal-xgot" }
69 # LOSE: As of 2002-02-08, the jal-empic test fails for target mips-ecoff.
70 # It appears that it broke between 2000-03-11 00:00UTC and
71 # 2000-03-12 00:00 UTC.
72 if $ecoff { run_dump_test "jal-empic" }
73 if $elf { run_dump_test "jal-empic-elf" }
74 if $elf { run_dump_test "jal-empic-elf-2" }
75 if $elf { run_dump_test "jal-empic-elf-3" }
76 if !$aout { run_dump_test "la" }
77 if $elf { run_dump_test "la-svr4pic" }
78 if $elf { run_dump_test "la-xgot" }
79 # LOSE: As of 2002-02-08, the la-empic test fails for target mips-ecoff.
80 # Not sure when it first cropped up, but may be related to addition of
81 # "la" -> "addiu" pattern in MIPS opcode table long ago.
82 if $ecoff { run_dump_test "la-empic" }
83 if !$aout { run_dump_test "lb" }
84 if $elf { run_dump_test "lb-svr4pic" }
85 if $elf {
86 # Both versions specify the cpu, so we can run both regardless of
87 # the interlocking in the configured default cpu.
88 run_dump_test "lb-xgot"
89 run_dump_test "lb-xgot-ilocks"
90 }
91 if $ecoff { run_dump_test "lb-empic" }
92 if !$aout {
93 if !$gpr_ilocks {
94 run_dump_test "ld"
95 } else {
96 if !$addr32 {
97 run_dump_test "ld-ilocks"
98 } else {
99 run_dump_test "ld-ilocks-addr32"
100 }
101 }
102 }
103 if $elf { run_dump_test "ld-svr4pic" }
104 if $elf { run_dump_test "ld-xgot" }
105 if $ecoff { run_dump_test "ld-empic" }
106 run_dump_test "li"
107 if !$aout { run_dump_test "lifloat" }
108 if $elf { run_dump_test "lif-svr4pic" }
109 if $elf { run_dump_test "lif-xgot" }
110 # LOSE: As of 2002-02-08, the lif-empic test fails for target mips-ecoff.
111 # It appears that it broke between 2000-03-11 00:00UTC and
112 # 2000-03-12 00:00 UTC.
113 if $ecoff { run_dump_test "lif-empic" }
114 run_dump_test "mips4"
115 if !$ilocks { run_dump_test "mul" } else { run_dump_test "mul-ilocks" }
116 run_dump_test "rol"
117 if !$aout { run_dump_test "sb" }
118 run_dump_test "trunc"
119 if !$aout { run_dump_test "ulh" }
120 if $elf { run_dump_test "ulh-svr4pic" }
121 if $elf { run_dump_test "ulh-xgot" }
122 if $ecoff { run_dump_test "ulh-empic" }
123 if !$aout {
124 run_dump_test "ulw"
125 run_dump_test "uld"
126 run_dump_test "ush"
127 run_dump_test "usw"
128 run_dump_test "usd"
129 }
130 # The mips16 test can only be run on ELF, because only ELF
131 # supports the necessary mips16 reloc.
132 if { $elf && !$no_mips16 } { run_dump_test "mips16" }
133 run_dump_test "delay"
134 run_dump_test "nodelay"
135 run_dump_test "mips4010"
136 run_dump_test "mips4650"
137 run_dump_test "mips4100"
138 run_dump_test "perfcount"
139 # Linux uses ELF stabs, which doesn't support line number.
140 setup_xfail "mips*-*-*linux*"
141 run_dump_test "lineno"
142 run_dump_test "sync"
143 run_dump_test "mips32"
144 run_dump_test "mips64"
145 run_dump_test "sb1-ext-ps"
146
147 # It will always fail until someone fixes it.
148 setup_xfail "mips*-*-*"
149 run_dump_test "relax"
150
151 run_list_test "illegal" ""
152
153 # LOSE: As of 2002-02-08, the next 4 tests fail for target mips-ecoff.
154 # It's unknown whether they _should_ pass as-is, or whether different
155 # variants are needed for ELF and ECOFF.
156 run_dump_test "mips-gp32-fp32"
157 run_dump_test "mips-gp32-fp64"
158 run_dump_test "mips-gp64-fp32"
159 run_dump_test "mips-gp64-fp64"
160
161 if $elf {
162 # Make sure that -mcpu=FOO and -mFOO are equivalent. Assemble a file
163 # containing 4650-specific instructions with -m4650 and -mcpu=4650,
164 # and verify that they're the same. Specifically, we're checking
165 # that the EF_MIPS_MACH field is set, and that the 4650 'mul'
166 # instruction does get used. In previous versions of GAS,
167 # only -mcpu=4650 would set the EF_MIPS_MACH field; -m4650 wouldn't.
168 run_dump_test "elf_e_flags1"
169 run_dump_test "elf_e_flags2"
170 run_dump_test "elf_e_flags3"
171 run_dump_test "elf_e_flags4"
172
173 run_dump_test "mips-gp32-fp32-pic"
174 run_dump_test "mips-gp32-fp64-pic"
175 run_dump_test "mips-gp64-fp32-pic"
176 run_dump_test "mips-gp64-fp64-pic"
177
178 run_dump_test "mips-abi32"
179 run_dump_test "mips-abi32-pic"
180
181 run_dump_test "elf${el}-rel"
182 if {[istarget mips64*-*-*] || [istarget mipsisa32*-*-*]} {
183 run_dump_test "elf${el}-rel2"
184 } else {
185 run_dump_test "e32${el}-rel2"
186 }
187 run_dump_test "elf${el}-rel3"
188 if {[istarget mips64*-*-*]} {
189 run_dump_test "elf-rel4"
190 } else {
191 run_dump_test "e32-rel4"
192 }
193 run_dump_test "elf-rel5"
194 run_dump_test "${tmips}${el}empic"
195 run_dump_test "empic2"
196 run_dump_test "empic3_e"
197 run_dump_test "empic3_g1"
198 run_dump_test "empic3_g2"
199 if { !$no_mips16 } {
200 run_dump_test "${tmips}mips${el}16-e"
201 run_dump_test "${tmips}mips${el}16-f"
202 }
203 }
204 }