aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite/gas/mips/mips.exp
blob: 1b02f7123b83cd8673b3f1d08d8f787964324062 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#
# Some generic MIPS tests
#

# "LOSE" marks information about tests which fail at a particular point
# in time, but which are not XFAILed.  Either they used to pass
# and indicate either regressions or the need to tweak the tests to keep
# up the with code, or they are new tests and it is unknown whether or not
# they should pass as-is for the given object formats.

proc run_list_test { name opts } {
    global srcdir subdir
    set testname "MIPS $name"
    set file $srcdir/$subdir/$name
    gas_run ${name}.s $opts ">&dump.out"
    if { [regexp_diff "dump.out" "${file}.l"] } then {
	fail $testname
	verbose "output is [file_contents "dump.out"]" 2
	return
    }
    pass $testname
}

if { [istarget mips*-*-*] } then {
    set no_mips16 0
    set elf [expr [istarget *-*-elf*] || [istarget *-*-irix5*] || [istarget *-*-irix6* ] || [istarget *-*-linux*] || [istarget *-*-netbsd*] ]
    set ecoff [expr [istarget *-*-ecoff*] || [istarget *-*-ultrix*] || [istarget *-*-irix\[1-4\]*] ]
    set aout [expr [istarget *-*-bsd*] || [istarget *-*-openbsd*] ]
    set ilocks [istarget mipstx39*-*-*]
    set gpr_ilocks [expr [istarget mipstx39*-*-*]]
    set addr32 [expr [istarget mipstx39*-*-*]]

    if { [istarget "mips*-*-*linux*"] } then {
	set tmips "t"
    } else {
	set tmips ""
    }
    if [istarget mips*el-*-*] {
	set el el
    } {
	set el ""
    }

    run_dump_test "abs"
    run_dump_test "add"
    run_dump_test "and"
    run_dump_test "break20"
    run_dump_test "trap20"

    # LOSE: As of 2002-02-08, "beq" through "bltu" fail for target mips-ecoff.
    # See http://sources.redhat.com/ml/binutils/2001-10/msg00418.html for
    # more information.  Not sure if the fixes there are correct; should
    # branches to external labels be allowed for ECOFF?
    run_dump_test "beq"
    run_dump_test "bge"
    run_dump_test "bgeu"
    run_dump_test "blt"
    run_dump_test "bltu"

    if $ilocks {
	run_dump_test "div-ilocks"
    } else {
	run_dump_test "div"
    }
    run_dump_test "dli"
    if $elf {
	run_dump_test "elf-jal"
    } else {
	run_dump_test "jal"
    }
    if $elf { run_dump_test "jal-svr4pic" }
    if $elf { run_dump_test "jal-xgot" }
    # LOSE: As of 2002-02-08, the jal-empic test fails for target mips-ecoff.
    # It appears that it broke between 2000-03-11 00:00UTC and
    # 2000-03-12 00:00 UTC.
    if $ecoff { run_dump_test "jal-empic" }
    if $elf { run_dump_test "jal-empic-elf" }
    if $elf { run_dump_test "jal-empic-elf-2" }
    if $elf { run_dump_test "jal-empic-elf-3" }
    if !$aout { run_dump_test "la" }
    if $elf { run_dump_test "la-svr4pic" }
    if $elf { run_dump_test "la-xgot" }
    # LOSE: As of 2002-02-08, the la-empic test fails for target mips-ecoff.
    # Not sure when it first cropped up, but may be related to addition of
    # "la" -> "addiu" pattern in MIPS opcode table long ago.
    if $ecoff { run_dump_test "la-empic" }
    if !$aout { run_dump_test "lb" }
    if $elf { run_dump_test "lb-svr4pic" }
    if $elf {
	# Both versions specify the cpu, so we can run both regardless of
	# the interlocking in the configured default cpu.
	run_dump_test "lb-xgot"
	run_dump_test "lb-xgot-ilocks"
    }
    if $ecoff { run_dump_test "lb-empic" }
    if !$aout {
        if !$gpr_ilocks {
            run_dump_test "ld"
        } else { 
            if !$addr32 {
                run_dump_test "ld-ilocks"
            } else {
                run_dump_test "ld-ilocks-addr32"
            }
        }
    }
    if $elf { run_dump_test "ld-svr4pic" }
    if $elf { run_dump_test "ld-xgot" }
    if $ecoff { run_dump_test "ld-empic" }
    run_dump_test "li"
    if !$aout { run_dump_test "lifloat" }
    if $elf { run_dump_test "lif-svr4pic" }
    if $elf { run_dump_test "lif-xgot" }
    # LOSE: As of 2002-02-08, the lif-empic test fails for target mips-ecoff.
    # It appears that it broke between 2000-03-11 00:00UTC and
    # 2000-03-12 00:00 UTC.
    if $ecoff { run_dump_test "lif-empic" }
    run_dump_test "mips4"
    if $ilocks {
	run_dump_test "mul-ilocks"
    } else {
	run_dump_test "mul"
    }
    run_dump_test "rol"
    run_dump_test "rol64"
    if !$aout { run_dump_test "sb" }
    run_dump_test "trunc"
    if !$aout { run_dump_test "ulh" }
    if $elf { run_dump_test "ulh-svr4pic" }
    if $elf { run_dump_test "ulh-xgot" }
    if $ecoff { run_dump_test "ulh-empic" }
    if !$aout {
	run_dump_test "ulw"
	run_dump_test "uld"
	run_dump_test "ush"
	run_dump_test "usw"
	run_dump_test "usd"
    }
    # The mips16 test can only be run on ELF, because only ELF
    # supports the necessary mips16 reloc.
    if { $elf && !$no_mips16 } { run_dump_test "mips16" }
    run_dump_test "delay"
    run_dump_test "nodelay"
    run_dump_test "mips4010"
    run_dump_test "mips4650"
    run_dump_test "mips4100"
    run_dump_test "perfcount"
    run_dump_test "lineno"
    run_dump_test "sync"
    run_dump_test "mips32"
    run_dump_test "mips64"
    run_dump_test "mips64-mips3d"
    run_dump_test "mips64-mdmx"
    run_dump_test "sb1-ext-mdmx"
    run_dump_test "sb1-ext-ps"

    # It will always fail until someone fixes it.
    setup_xfail "mips*-*-*"
    run_dump_test "relax"

    run_list_test "illegal" ""

    # LOSE: As of 2002-02-08, the next 4 tests fail for target mips-ecoff.
    # It's unknown whether they _should_ pass as-is, or whether different
    # variants are needed for ELF and ECOFF.
    run_dump_test "mips-gp32-fp32"
    run_dump_test "mips-gp32-fp64"
    run_dump_test "mips-gp64-fp32"
    run_dump_test "mips-gp64-fp64"

    if $elf {
	# Make sure that -mcpu=FOO and -mFOO are equivalent.  Assemble a file
	# containing 4650-specific instructions with -m4650 and -mcpu=4650,
	# and verify that they're the same.  Specifically, we're checking
	# that the EF_MIPS_MACH field is set, and that the 4650 'mul'
	# instruction does get used.  In previous versions of GAS,
	# only -mcpu=4650 would set the EF_MIPS_MACH field; -m4650 wouldn't.
	run_dump_test "elf_e_flags1"
	run_dump_test "elf_e_flags2"
	run_dump_test "elf_e_flags3"
	run_dump_test "elf_e_flags4"

	# Verify that ASE markings are handled properly.
	if { !$no_mips16 } { run_dump_test "elf_ase_mips16" }

 	run_dump_test "mips-gp32-fp32-pic"
 	run_dump_test "mips-gp32-fp64-pic"
 	run_dump_test "mips-gp64-fp32-pic"
 	run_dump_test "mips-gp64-fp64-pic"

  	run_dump_test "mips-abi32"
  	run_dump_test "mips-abi32-pic"

	run_dump_test "elf${el}-rel"
	if {[istarget mips64*-*-*] || [istarget mipsisa32*-*-*]
	    || [istarget mipsisa64*-*-*]} { 
	    run_dump_test "elf${el}-rel2"
	} else {
	    run_dump_test "e32${el}-rel2"
	}
	run_dump_test "elf${el}-rel3"
	if {[istarget mips64*-*-*]} {
	    run_dump_test "elf-rel4"
	} else {
	    run_dump_test "e32-rel4"
	}
	run_dump_test "elf-rel5"
	run_dump_test "${tmips}${el}empic"
	run_dump_test "empic2"
	run_dump_test "empic3_e"
	run_dump_test "empic3_g1"
	run_dump_test "empic3_g2"
	if { !$no_mips16 } {
	    run_dump_test "${tmips}mips${el}16-e"
	    run_dump_test "${tmips}mips${el}16-f"
	}
    }
}