URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.target/] [mips/] [mips.exp] - Rev 455
Go to most recent revision | Compare with Previous | Blame | View Log
# Copyright (C) 1997, 2007 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
# GCC testsuite that uses the `dg.exp' driver.
# Exit immediately if this isn't a MIPS target.
if ![istarget mips*-*-*] {
return
}
# Load support procs.
load_lib gcc-dg.exp
# Find out which target is selected by the default compiler flags.
# Also remember which aspects of the target are forced on the command
# line (as opposed to being overridable defaults).
#
# $mips_isa: the ISA level specified by __mips
# $mips_arch: the architecture specified by _MIPS_ARCH
# $mips_mips16: true if MIPS16 mode is selected
# $mips_mips64: true if 64-bit output is selected
# $mips_float: "hard" or "soft"
#
# $mips_forced_isa: true if the command line uses -march=* or -mips*
# $mips_forced_abi: true if the command line uses -mabi=* or -mgp*
# $mips_forced_float: true if the command line uses -mhard/soft-float
# $mips_forced_le true if the command line uses -EL or -mel
proc setup_mips_tests {} {
global mips_isa
global mips_arch
global mips_mips16
global mips_mips64
global mips_float
global mips_forced_isa
global mips_forced_abi
global mips_forced_float
global mips_forced_le
global compiler_flags
global tool
set src dummy[pid].c
set f [open $src "w"]
puts $f {
int isa = __mips;
const char *arch = _MIPS_ARCH;
#ifdef __mips16
int mips16 = 1;
#endif
#ifdef __mips64
int mips64 = 1;
#endif
#ifdef __mips_hard_float
const char *float = "hard";
#else
const char *float = "soft";
#endif
}
close $f
set output [${tool}_target_compile $src "" preprocess ""]
file delete $src
regexp {isa = ([^;]*)} $output dummy mips_isa
regexp {arch = "([^"]*)} $output dummy mips_arch
set mips_mips16 [regexp {mips16 = 1} $output]
set mips_mips64 [regexp {mips64 = 1} $output]
regexp {float = "([^"]*)} $output dummy mips_float
set mips_forced_isa [regexp -- {(-mips|-march)} $compiler_flags]
set mips_forced_abi [regexp -- {(-mgp|-mabi)} $compiler_flags]
set mips_forced_float [regexp -- {-m(hard|soft)-float} $compiler_flags]
set mips_forced_le [regexp -- {-(EL|mel)[[:>:]]} $compiler_flags]
}
# Return true if command-line option FLAG forces 32-bit code.
proc is_gp32_flag {flag} {
switch -glob -- $flag {
-march=mips32* -
-mgp32 { return 1 }
default { return 0 }
}
}
# Like dg-options, but treats certain MIPS-specific options specially:
#
# -mgp32
# -march=mips32*
# Force 32-bit code. Skip the test if the multilib flags force
# a 64-bit ABI.
#
# -mgp64
# Force 64-bit code. Also force a 64-bit target architecture
# if the other flags don't do so. Skip the test if the multilib
# flags force a 32-bit ABI or a 32-bit architecture.
#
# -mno-mips16
# Skip the test for MIPS16 targets.
#
# -march=*
# -mips*
# Select the target architecture. Skip the test for MIPS16 targets
# or if the multilib flags force a different architecture.
#
# -msoft-float
# -mhard-float
# Select the given floating-point mode. Skip the test if the
# multilib flags force a different selection.
#
# -EB
# Select big-endian code. Skip the test if the multilib flags
# force a little-endian target.
proc dg-mips-options {args} {
upvar dg-extra-tool-flags extra_tool_flags
upvar dg-do-what do_what
global mips_isa
global mips_arch
global mips_mips16
global mips_mips64
global mips_float
global mips_forced_isa
global mips_forced_abi
global mips_forced_float
global mips_forced_le
set flags [lindex $args 1]
set matches 1
# First handle the -mgp* options. Add an architecture option if necessary.
foreach flag $flags {
if {[is_gp32_flag $flag] && $mips_mips64} {
if {$mips_forced_abi} {
set matches 0
} else {
append flags " -mabi=32"
}
} elseif {$flag == "-mgp64" && !$mips_mips64} {
if {$mips_forced_abi} {
set matches 0
} else {
append flags " -mabi=o64"
if {[lsearch -regexp $flags {^(-mips|-march)}] < 0} {
append flags " -mips3"
}
}
}
}
# Handle the other options.
foreach flag $flags {
if {$flag == "-mno-mips16"} {
if {$mips_mips16} {
set matches 0
}
} elseif {[regexp -- {^-march=(.*)} $flag dummy arch]} {
if {$mips_mips16 || ($arch != $mips_arch && $mips_forced_isa)} {
set matches 0
}
} elseif {[regexp -- {^-mips(.*)} $flag dummy isa] && $isa != 16} {
if {$mips_mips16 || ($isa != $mips_isa && $mips_forced_isa)} {
set matches 0
}
} elseif {[regexp -- {^-m(hard|soft)-float} $flag dummy float]} {
if {$mips_float != $float && $mips_forced_float} {
set matches 0
}
} elseif {[regexp -- {^-(EB|meb)$} $flag]} {
if {$mips_forced_le} {
set matches 0
}
}
}
if {$matches} {
set extra_tool_flags $flags
} else {
set do_what [list [lindex $do_what 0] "N" "P"]
}
}
setup_mips_tests
dg-init
dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.c]] "" ""
dg-finish
Go to most recent revision | Compare with Previous | Blame | View Log