2001-06-08 H.J. Lu <hjl@gnu.org>
[binutils-gdb.git] / gas / testsuite / gas / mips / mips.exp
1 #
2 # Some generic MIPS tests
3 #
4
5 proc run_list_test { name opts } {
6 global srcdir subdir
7 set testname "MIPS $name"
8 set file $srcdir/$subdir/$name
9 gas_run ${name}.s $opts ">&dump.out"
10 if { [regexp_diff "dump.out" "${file}.l"] } then {
11 fail $testname
12 verbose "output is [file_contents "dump.out"]" 2
13 return
14 }
15 pass $testname
16 }
17
18 if { [istarget mips*-*-*] } then {
19 set no_mips16 0
20 set svr4pic [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] ]
21 set empic [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
22 set aout [expr [istarget *-*-bsd*] || [istarget *-*-netbsd*] || [istarget *-*-openbsd*] ]
23 set ilocks [istarget mipstx39*-*-*]
24 set gpr_ilocks [expr [istarget mipstx39*-*-*]]
25 set addr32 [expr [istarget mipstx39*-*-*]]
26
27 if { [istarget mips*el-*-*] || [istarget "mips*-*-*linux*"] } then {
28 set tmips "t"
29 } else {
30 set tmips ""
31 }
32
33 run_dump_test "abs"
34 run_dump_test "add"
35 run_dump_test "and"
36 run_dump_test "break20"
37 run_dump_test "trap20"
38 run_dump_test "beq"
39 run_dump_test "bge"
40 run_dump_test "bgeu"
41 run_dump_test "blt"
42 run_dump_test "bltu"
43 if !$ilocks { run_dump_test "div" } else { run_dump_test "div-ilocks" }
44 run_dump_test "dli"
45 if $svr4pic {
46 run_dump_test "elf-jal"
47 } else {
48 run_dump_test "jal"
49 }
50 if $svr4pic { run_dump_test "jal-svr4pic" }
51 if $svr4pic { run_dump_test "jal-xgot" }
52 if $empic { run_dump_test "jal-empic" }
53 if !$aout { run_dump_test "la" }
54 if $svr4pic { run_dump_test "la-svr4pic" }
55 if $svr4pic { run_dump_test "la-xgot" }
56 if $empic { run_dump_test "la-empic" }
57 if !$aout { run_dump_test "lb" }
58 if $svr4pic { run_dump_test "lb-svr4pic" }
59 if $svr4pic {
60 # Both versions specify the cpu, so we can run both regardless of
61 # the interlocking in the configured default cpu.
62 run_dump_test "lb-xgot"
63 run_dump_test "lb-xgot-ilocks"
64 }
65 if $empic { run_dump_test "lb-empic" }
66 if !$aout {
67 if !$gpr_ilocks {
68 run_dump_test "ld"
69 } else {
70 if !$addr32 {
71 run_dump_test "ld-ilocks"
72 } else {
73 run_dump_test "ld-ilocks-addr32"
74 }
75 }
76 }
77 if $svr4pic { run_dump_test "ld-svr4pic" }
78 if $svr4pic { run_dump_test "ld-xgot" }
79 if $empic { run_dump_test "ld-empic" }
80 run_dump_test "li"
81 if !$aout { run_dump_test "lifloat" }
82 if $svr4pic { run_dump_test "lif-svr4pic" }
83 if $svr4pic { run_dump_test "lif-xgot" }
84 if $empic { run_dump_test "lif-empic" }
85 run_dump_test "mips4"
86 if !$ilocks { run_dump_test "mul" } else { run_dump_test "mul-ilocks" }
87 run_dump_test "rol"
88 if !$aout { run_dump_test "sb" }
89 run_dump_test "trunc"
90 if !$aout { run_dump_test "ulh" }
91 if $svr4pic { run_dump_test "ulh-svr4pic" }
92 if $svr4pic { run_dump_test "ulh-xgot" }
93 if $empic { run_dump_test "ulh-empic" }
94 if !$aout {
95 run_dump_test "ulw"
96 run_dump_test "uld"
97 run_dump_test "ush"
98 run_dump_test "usw"
99 run_dump_test "usd"
100 }
101 # The mips16 test can only be run on ELF, because only ELF
102 # supports the necessary mips16 reloc.
103 if { $svr4pic && !$no_mips16 } { run_dump_test "mips16" }
104 run_dump_test "delay"
105 run_dump_test "nodelay"
106 run_dump_test "mips4010"
107 run_dump_test "mips4650"
108 run_dump_test "mips4100"
109 # Linux uses ELF stabs, which doesn't support line number.
110 setup_xfail "mips*-*-*linux*"
111 run_dump_test "lineno"
112 run_dump_test "sync"
113 run_dump_test "mips32"
114 run_dump_test "mips64"
115
116 # It will always fail until someone fixes it.
117 setup_xfail "mips*-*-*"
118 run_dump_test "relax"
119
120 run_list_test "illegal" ""
121
122 if $svr4pic {
123 # Make sure that -mcpu=FOO and -mFOO are equivalent. Assemble a file
124 # containing 4650-specific instructions with -m4650 and -mcpu=4650,
125 # and verify that they're the same. Specifically, we're checking
126 # that the EF_MIPS_MACH field is set, and that the 4650 'mul'
127 # instruction does get used. In previous versions of GAS,
128 # only -mcpu=4650 would set the EF_MIPS_MACH field; -m4650 wouldn't.
129 run_dump_test "elf_e_flags1"
130 run_dump_test "elf_e_flags2"
131 run_dump_test "elf_e_flags3"
132 run_dump_test "elf_e_flags4"
133
134 if [istarget mips*el-*-*] {
135 run_dump_test "elfel-rel"
136 } {
137 run_dump_test "elf-rel"
138 }
139
140 if [istarget mips64*-*-*] {
141 if [istarget mips*el-*-*] {
142 run_dump_test "elfel-rel2"
143 } {
144 run_dump_test "elf-rel2"
145 }
146 } {
147 if [istarget mips*el-*-*] {
148 run_dump_test "e32el-rel2"
149 } {
150 run_dump_test "e32-rel2"
151 }
152 }
153
154 if [istarget mips*el-*-*] {
155 run_dump_test "elfel-rel3"
156 } {
157 run_dump_test "elf-rel3"
158 }
159
160 if [istarget mips*el-*-*] {
161 run_dump_test "${tmips}elempic"
162 } {
163 run_dump_test "${tmips}empic"
164 }
165
166 if { !$no_mips16 } {
167 if [istarget mips*el-*-*] {
168 run_dump_test "${tmips}mipsel16-e"
169 } {
170 run_dump_test "${tmips}mips16-e"
171 }
172 setup_xfail "mips*-*-*"
173 if [istarget mips*el-*-*] {
174 run_dump_test "mipsel16-f"
175 } {
176 run_dump_test "mips16-f"
177 }
178 }
179 }
180 }