1 # Copyright
(C
) 1997 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
2 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program; if not
, write to the Free Software
15 # Foundation
, Inc.
, 51 Franklin Street
, Fifth Floor
, Boston
, MA
02110-1301, USA.
17 # GCC testsuite that uses the `dg.exp
' driver.
19 # Exit immediately if this isn't a MIPS target.
20 if ![istarget mips
*-*-*] {
27 # Find out which target is selected by the default compiler flags.
28 # Also remember which aspects of the target are forced
on the command
29 # line
(as opposed to being overridable defaults
).
31 # $mips_isa
: the ISA level specified by __mips
32 # $mips_arch
: the architecture specified by _MIPS_ARCH
33 # $mips_mips16
: true
if MIPS16
mode is selected
34 # $mips_mips64
: true
if 64-bit output is selected
35 # $mips_float
: "hard" or "soft"
37 # $mips_forced_isa
: true
if the command line uses
-march
=* or
-mips
*
38 # $mips_forced_abi
: true
if the command line uses
-mabi
=* or
-mgp
*
39 # $mips_forced_float
: true
if the command line uses
-mhard
/soft
-float
40 # $mips_forced_le true
if the command line uses
-EL or
-mel
41 proc setup_mips_tests
{} {
48 global mips_forced_isa
49 global mips_forced_abi
50 global mips_forced_float
60 const char
*arch
= _MIPS_ARCH
;
67 #ifdef __mips_hard_float
68 const char
*float
= "hard";
70 const char
*float
= "soft";
74 set output
[$
{tool
}_target_compile $src
"" preprocess ""]
77 regexp
{isa
= ([^
;]*)} $output dummy mips_isa
78 regexp
{arch
= "([^"]*)} $output dummy mips_arch
79 set mips_mips16
[regexp
{mips16
= 1} $output
]
80 set mips_mips64
[regexp
{mips64
= 1} $output
]
81 regexp
{float
= "([^"]*)} $output dummy mips_float
83 set mips_forced_isa
[regexp
-- {(-mips|
-march
)} $compiler_flags
]
84 set mips_forced_abi
[regexp
-- {(-mgp|
-mabi
)} $compiler_flags
]
85 set mips_forced_float
[regexp
-- {-m
(hard|soft
)-float
} $compiler_flags
]
86 set mips_forced_le
[regexp
-- {-(EL|mel
)[[:>:]]} $compiler_flags
]
89 #
Return true
if command
-line option FLAG forces
32-bit code.
90 proc is_gp32_flag
{flag
} {
91 switch -glob
-- $flag
{
98 # Like dg
-options
, but treats certain MIPS
-specific options specially
:
102 # Force
32-bit code. Skip the test
if the multilib flags force
106 # Force
64-bit code. Also force a
64-bit target architecture
107 #
if the other flags don
't do so. Skip the test if the multilib
108 # flags force a 32-bit ABI or a 32-bit architecture.
111 # Skip the test for MIPS16 targets.
115 # Select the target architecture. Skip the test for MIPS16 targets
116 # or if the multilib flags force a different architecture.
120 # Select the given floating-point mode. Skip the test if the
121 # multilib flags force a different selection.
124 # Select big-endian code. Skip the test if the multilib flags
125 # force a little-endian target.
126 proc dg-mips-options {args} {
127 upvar dg-extra-tool-flags extra_tool_flags
128 upvar dg-do-what do_what
136 global mips_forced_isa
137 global mips_forced_abi
138 global mips_forced_float
139 global mips_forced_le
141 set flags [lindex $args 1]
144 # First handle the -mgp* options. Add an architecture option if necessary.
145 foreach flag $flags {
146 if {[is_gp32_flag $flag] && $mips_mips64} {
147 if {$mips_forced_abi} {
150 append flags " -mabi=32"
152 } elseif {$flag == "-mgp64" && !$mips_mips64} {
153 if {$mips_forced_abi} {
156 append flags " -mabi=o64"
157 if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} {
158 append flags " -mips3"
163 # Handle the other options.
164 foreach flag $flags {
165 if {$flag == "-mno-mips16"} {
169 } elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} {
170 if {$mips_mips16 || ($arch != $mips_arch && $mips_forced_isa)} {
173 } elseif {[regexp -- {^-mips(.*)} $flag dummy isa] && $isa != 16} {
174 if {$mips_mips16 || ($isa != $mips_isa && $mips_forced_isa)} {
177 } elseif {[regexp -- {^-m(hard|soft)-float} $flag dummy float]} {
178 if {$mips_float != $float && $mips_forced_float} {
181 } elseif {[regexp -- {^-(EB|meb)$} $flag]} {
182 if {$mips_forced_le} {
188 set extra_tool_flags $flags
190 set do_what [list [lindex $do_what 0] "N" "P"]
197 dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""