-# Copyright (C) 2003 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006, 2007, 2008 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 2 of the License, or
+# 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,
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
# Please email any bugs, comments, and/or additions to this file to
# the author.
# This file was written by Steven Bosscher (s.bosscher@student.tudelft.nl)
# based on f-torture.exp, which was written by Rob Savoye.
-# The biggest change from g77 is that we always test all testcases with
-# loop options, because it is much harder to figure out whether a testcase
-# has loops if you have array syntax, like Fortran 95. In fact, the whole
-# point of F95 is arrays, so loops show up in most testcases anyway.
-
+load_lib target-supports.exp
+# Return the list of options to use for fortran torture tests.
# The default option list can be overridden by
# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
+proc get-fortran-torture-options { } {
+ global TORTURE_OPTIONS
+
+ if [info exists TORTURE_OPTIONS] {
+ return $TORTURE_OPTIONS
+ }
-if ![info exists TORTURE_OPTIONS] {
- set TORTURE_OPTIONS [list \
- { -O0 } { -O1 } { -O2 } \
+ # determine if host supports vectorization, and the necessary set
+ # of options, based on code from testsuite/vect/vect.exp
+
+ set vectorizer_options [list "-O2" "-ftree-vectorize"]
+
+ if { [istarget "powerpc*-*-*"]
+ && [is-effective-target powerpc_altivec_ok]
+ && [check_vmx_hw_available] } {
+ lappend vectorizer_options "-maltivec"
+ set test_tree_vectorize 1
+ } elseif { [istarget "spu-*-*"] } {
+ set test_tree_vectorize 1
+ } elseif { ( [istarget "i?86-*-*"] || [istarget "x86_64-*-*"] )
+ && [check_sse2_hw_available] } {
+ lappend vectorizer_options "-msse2"
+ set test_tree_vectorize 1
+ } elseif { [istarget "mips*-*-*"]
+ && [check_effective_target_mpaired_single]
+ && [check_effective_target_nomips16] } {
+ lappend vectorizer_options "-mpaired-single"
+ set test_tree_vectorize 1
+ } elseif { [istarget "sparc*-*-*"]
+ && [check_effective_target_ultrasparc_hw] } {
+ lappend vectorizer_options "-mcpu=ultrasparc" "-mvis"
+ set test_tree_vectorize 1
+ } elseif { [istarget "alpha*-*-*"]
+ && [check_alpha_max_hw_available] } {
+ lappend vectorizer_options "-mmax"
+ set test_tree_vectorize 1
+ } elseif [istarget "ia64-*-*"] {
+ set test_tree_vectorize 1
+ } else {
+ set test_tree_vectorize 0
+ }
+
+ set options {}
+
+ lappend options \
+ { -O0 } \
+ { -O1 } \
+ { -O2 } \
{ -O2 -fomit-frame-pointer -finline-functions } \
{ -O2 -fomit-frame-pointer -finline-functions -funroll-loops } \
- { -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops } \
- { -O2 -fno-repack-arrays } \
+ { -O2 -fbounds-check } \
{ -O3 -g } \
- { -Os }]
+ { -Os }
+ if { $test_tree_vectorize } {
+ lappend options $vectorizer_options
+ }
+
+ if [info exists ADDITIONAL_TORTURE_OPTIONS] {
+ set options [concat $options $ADDITIONAL_TORTURE_OPTIONS]
+ }
+
+ return $options
}
set output "$tmpdir/[file tail [file rootname $src]].o"
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?q)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
set options ""
lappend options "additional_flags=-w $option"
- set comp_output [gfortran_target_compile "$src" "$output" object $options];
+ set comp_output [gfortran_target_compile "$src" "$output" object $options]
# See if we got something bad.
set fatal_signal "*95*: Internal compiler error: program*got fatal signal"
if [string match "$fatal_signal 6" $comp_output] then {
gfortran_fail $testcase "Got Signal 6, $option"
- remote_file build delete $output
+ catch { remote_file build delete $output }
return
}
if [string match "$fatal_signal 11" $comp_output] then {
gfortran_fail $testcase "Got Signal 11, $option"
- remote_file build delete $output
+ catch { remote_file build delete $output }
+ return
+ }
+
+ if [string match "*internal compiler error*" $comp_output] then {
+ gfortran_fail $testcase "$option (internal compiler error)"
+ catch { remote_file build delete $output }
return
}
warning "$testcase: (with warnings) $option"
send_log "$comp_output\n"
unresolved "$testcase, $option"
- remote_file build delete $output
+ catch { remote_file build delete $output }
return
}
set unsupported_message [gfortran_check_unsupported_p $comp_output]
if { $unsupported_message != "" } {
unsupported "$testcase: $unsupported_message"
- remote_file build delete $output
+ catch { remote_file build delete $output }
return
}
# If any message remains, we fail.
if ![string match "" $comp_output] then {
gfortran_fail $testcase $option
- remote_file build delete $output
+ catch { remote_file build delete $output }
return
}
gfortran_pass $testcase $option
- remote_file build delete $output
+ catch { remote_file build delete $output }
}
global srcdir tmpdir
global tool
global compiler_conditional_xfail_data
- global TORTURE_OPTIONS
+ global torture_with_loops
# Check for alternate driver.
- set additional_flags "";
+ set additional_flags ""
if [file exists [file rootname $src].x] {
verbose "Using alternate driver [file rootname [file tail $src]].x" 2
set done_p 0
}
# Setup the options for the testcase run.
- set option_list $TORTURE_OPTIONS
+ set option_list $torture_with_loops
set executable $tmpdir/[file tail [file rootname $src].x]
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?q)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# exist. If not, the testcase should XFAIL.
# Compile the testcase.
- remote_file build delete $executable
+ catch { remote_file build delete $executable }
verbose "Testing $testcase, $option" 1
set options ""
lappend options "additional_flags=-w $option"
if { $additional_flags != "" } {
- lappend options "additional_flags=$additional_flags";
+ lappend options "additional_flags=$additional_flags"
}
- set comp_output [gfortran_target_compile "$src" "$executable" executable $options];
+ set comp_output [gfortran_target_compile "$src" "$executable" executable $options]
# See if we got something bad.
set fatal_signal "*95*: Internal compiler error: program*got fatal signal"
if [string match "$fatal_signal 6" $comp_output] then {
gfortran_fail $testcase "Got Signal 6, $option"
- remote_file build delete $executable
+ catch { remote_file build delete $executable }
continue
}
if [string match "$fatal_signal 11" $comp_output] then {
gfortran_fail $testcase "Got Signal 11, $option"
- remote_file build delete $executable
+ catch { remote_file build delete $executable }
+ continue
+ }
+
+ if [string match "*internal compiler error*" $comp_output] then {
+ gfortran_fail $testcase "$option (internal compiler error)"
+ catch { remote_file build delete $executable }
continue
}
warning "$testcase: (with warnings) $option"
send_log "$comp_output\n"
unresolved "$testcase, $option"
- remote_file build delete $executable
+ catch { remote_file build delete $executable }
continue
}
untested "$testcase execution, $option"
continue
} else {
- # FIXME: since we can't test for the existance of a remote
+ # FIXME: since we can't test for the existence of a remote
# file without short of doing an remote file list, we assume
# that since we got no output, it must have compiled.
pass "$testcase compilation, $option"
# Run the testcase, and analyse the output.
set result [gfortran_load "$executable" "" ""]
- set status [lindex $result 0];
- set output [lindex $result 1];
+ set status [lindex $result 0]
+ set output [lindex $result 1]
if { $status == "pass" } {
- remote_file build delete $executable
+ catch { remote_file build delete $executable }
}
$status "$testcase execution, $option"
}
proc fortran-torture { args } {
global srcdir subdir
global compiler_conditional_xfail_data
+ global torture_with_loops
- set src [lindex $args 0];
+ set src [lindex $args 0]
if { [llength $args] > 1 } {
- set options [lindex $args 1];
+ set options [lindex $args 1]
} else {
set options ""
}
}
# loop through all the options
- set option_list [list { "-O" } ]
+ set option_list $torture_with_loops
foreach option $option_list {
# torture_compile_xfail is set by the .x script (if present)
}
#
-# ieee-options -- return options necessary for 100% ieee conformance.
+# add-ieee-options -- add options necessary for 100% ieee conformance.
#
-proc ieee-options { } {
+proc add-ieee-options { } {
# Ensure that excess precision does not cause problems.
- if [istarget "i?86-*-*"] then {
- return "-ffloat-store"
+ if { [istarget "i?86-*-*"]
+ || [istarget "m68k-*-*"] } then {
+ uplevel 1 lappend additional_flags "-ffloat-store"
}
- if [istarget "m68k-*-*"] then {
- return "-ffloat-store"
- }
-
+
# Enable full IEEE compliance mode.
if { [istarget "alpha*-*-*"]
|| [istarget "sh*-*-*"] } then {
- return "-mieee"
+ uplevel 1 lappend additional_flags "-mieee"
}
}