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