[gas/]
[platform/upstream/binutils.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     run_dump_test "branch-misc-1"
60     run_dump_test "branch-misc-2"
61
62     if $ilocks {
63         run_dump_test "div-ilocks"
64     } else {
65         run_dump_test "div"
66     }
67     run_dump_test "dli"
68     if $elf {
69         run_dump_test "elf-jal"
70     } else {
71         run_dump_test "jal"
72     }
73     if $elf { run_dump_test "jal-svr4pic" }
74     if $elf { run_dump_test "jal-xgot" }
75     # LOSE: As of 2002-02-08, the jal-empic test fails for target mips-ecoff.
76     # It appears that it broke between 2000-03-11 00:00UTC and
77     # 2000-03-12 00:00 UTC.
78     if $ecoff { run_dump_test "jal-empic" }
79     if $elf { run_dump_test "jal-empic-elf" }
80     if $elf { run_dump_test "jal-empic-elf-2" }
81     if $elf { run_dump_test "jal-empic-elf-3" }
82     run_list_test "jal-range" ""
83     if !$aout { run_dump_test "la" }
84     if $elf { run_dump_test "la-svr4pic" }
85     if $elf { run_dump_test "la-xgot" }
86     # LOSE: As of 2002-02-08, the la-empic test fails for target mips-ecoff.
87     # Not sure when it first cropped up, but may be related to addition of
88     # "la" -> "addiu" pattern in MIPS opcode table long ago.
89     if $ecoff { run_dump_test "la-empic" }
90     if !$aout { run_dump_test "lb" }
91     if $elf { run_dump_test "lb-svr4pic" }
92     if $elf {
93         # Both versions specify the cpu, so we can run both regardless of
94         # the interlocking in the configured default cpu.
95         run_dump_test "lb-xgot"
96         run_dump_test "lb-xgot-ilocks"
97     }
98     if $ecoff { run_dump_test "lb-empic" }
99     if !$aout {
100         if !$gpr_ilocks {
101             run_dump_test "ld"
102         } else { 
103             if !$addr32 {
104                 run_dump_test "ld-ilocks"
105             } else {
106                 run_dump_test "ld-ilocks-addr32"
107             }
108         }
109     }
110     if $elf { run_dump_test "ld-svr4pic" }
111     if $elf { run_dump_test "ld-xgot" }
112     if $ecoff { run_dump_test "ld-empic" }
113     run_dump_test "li"
114     if !$aout { run_dump_test "lifloat" }
115     if $elf { run_dump_test "lif-svr4pic" }
116     if $elf { run_dump_test "lif-xgot" }
117     # LOSE: As of 2002-02-08, the lif-empic test fails for target mips-ecoff.
118     # It appears that it broke between 2000-03-11 00:00UTC and
119     # 2000-03-12 00:00 UTC.
120     if $ecoff { run_dump_test "lif-empic" }
121     run_dump_test "mips4"
122     if $ilocks {
123         run_dump_test "mul-ilocks"
124     } else {
125         run_dump_test "mul"
126     }
127     run_dump_test "rol"
128     run_dump_test "rol64"
129     if !$aout { run_dump_test "sb" }
130     run_dump_test "trunc"
131     if !$aout { run_dump_test "ulh" }
132     if $elf { run_dump_test "ulh-svr4pic" }
133     if $elf { run_dump_test "ulh-xgot" }
134     if $ecoff { run_dump_test "ulh-empic" }
135     if !$aout {
136         run_dump_test "ulw"
137         run_dump_test "uld"
138         run_dump_test "ush"
139         run_dump_test "usw"
140         run_dump_test "usd"
141     }
142     # The mips16 test can only be run on ELF, because only ELF
143     # supports the necessary mips16 reloc.
144     if { $elf && !$no_mips16 } {
145         run_dump_test "mips16"
146         # Check jalx handling
147         run_dump_test "mips16-jalx"
148         run_dump_test "mips-jalx"
149     }
150     run_list_test "mips-no-jalx" ""
151     run_dump_test "delay"
152     run_dump_test "nodelay"
153     run_dump_test "mips4010"
154     run_dump_test "mips4650"
155     run_dump_test "mips4100"
156     run_dump_test "vr4111"
157     run_dump_test "vr4120"
158     run_dump_test "vr4122"
159     run_dump_test "vr5400"
160     run_dump_test "vr5500"
161     run_dump_test "perfcount"
162     run_dump_test "lineno"
163     run_dump_test "sync"
164     run_dump_test "mips32"
165     run_dump_test "mips64"
166     run_dump_test "mips64-mips3d"
167     run_dump_test "mips64-mdmx"
168     run_dump_test "sb1-ext-mdmx"
169     run_dump_test "sb1-ext-ps"
170
171     # It will always fail until someone fixes it.
172     setup_xfail "mips*-*-*"
173     run_dump_test "relax"
174
175     run_list_test "illegal" ""
176     run_list_test "baddata1" ""
177
178     # LOSE: As of 2002-02-08, the next 4 tests fail for target mips-ecoff.
179     # It's unknown whether they _should_ pass as-is, or whether different
180     # variants are needed for ELF and ECOFF.
181     run_dump_test "mips-gp32-fp32"
182     run_dump_test "mips-gp32-fp64"
183     run_dump_test "mips-gp64-fp32"
184     run_dump_test "mips-gp64-fp64"
185
186     if $elf {
187         # Make sure that -mcpu=FOO and -mFOO are equivalent.  Assemble a file
188         # containing 4650-specific instructions with -m4650 and -mcpu=4650,
189         # and verify that they're the same.  Specifically, we're checking
190         # that the EF_MIPS_MACH field is set, and that the 4650 'mul'
191         # instruction does get used.  In previous versions of GAS,
192         # only -mcpu=4650 would set the EF_MIPS_MACH field; -m4650 wouldn't.
193         run_dump_test "elf_e_flags1"
194         run_dump_test "elf_e_flags2"
195         run_dump_test "elf_e_flags3"
196         run_dump_test "elf_e_flags4"
197
198         # Verify that ASE markings are handled properly.
199         if { !$no_mips16 } { run_dump_test "elf_ase_mips16" }
200
201         run_dump_test "mips-gp32-fp32-pic"
202         run_dump_test "mips-gp32-fp64-pic"
203         run_dump_test "mips-gp64-fp32-pic"
204         run_dump_test "mips-gp64-fp64-pic"
205
206         run_dump_test "mips-abi32"
207         run_dump_test "mips-abi32-pic"
208         run_dump_test "mips-abi32-pic2"
209
210         run_dump_test "elf${el}-rel"
211         if {[istarget mips64*-*-*] || [istarget mipsisa32*-*-*]
212             || [istarget mipsisa64*-*-*]} { 
213             run_dump_test "elf${el}-rel2"
214         } else {
215             run_dump_test "e32${el}-rel2"
216         }
217         run_dump_test "elf${el}-rel3"
218         if {[istarget mips64*-*-*]} {
219             run_dump_test "elf-rel4"
220         } else {
221             run_dump_test "e32-rel4"
222         }
223         run_dump_test "elf-rel5"
224         run_dump_test "elf-rel6"
225         run_dump_test "${tmips}${el}empic"
226         run_dump_test "empic2"
227         run_dump_test "empic3_e"
228         run_dump_test "empic3_g1"
229         run_dump_test "empic3_g2"
230         if { !$no_mips16 } {
231             run_dump_test "${tmips}mips${el}16-e"
232             run_dump_test "${tmips}mips${el}16-f"
233         }
234         run_dump_test "elf-consthilo"
235     }
236 }