summaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/c-compat.exp110
-rw-r--r--gcc/testsuite/lib/compat.exp9
-rw-r--r--gcc/testsuite/lib/target-supports.exp19
3 files changed, 134 insertions, 4 deletions
diff --git a/gcc/testsuite/lib/c-compat.exp b/gcc/testsuite/lib/c-compat.exp
new file mode 100644
index 00000000000..527058d445f
--- /dev/null
+++ b/gcc/testsuite/lib/c-compat.exp
@@ -0,0 +1,110 @@
+# Copyright (C) 2002, 2003, 2005, 02005 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
+# (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 this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+# Please email any bugs, comments, and/or additions to this file to:
+# gcc-patches@gcc.gnu.org
+
+# Globals.
+
+global compat_use_alt
+global compat_same_alt
+global compat_have_dfp
+global compat_skip_list
+
+# This file defines procs for determining features supported by both C
+# compilers for compatibility tests.
+
+load_lib target-supports.exp
+
+#
+# compat-use-alt-compiler -- make the alternate compiler the default
+#
+proc compat-use-alt-compiler { } {
+ global GCC_UNDER_TEST ALT_CC_UNDER_TEST
+ global compat_same_alt
+
+ # We don't need to do this if the alternate compiler is actually
+ # the same as the compiler under test.
+ if { $compat_same_alt == 0 } then {
+ set GCC_UNDER_TEST $ALT_CC_UNDER_TEST
+ }
+}
+
+#
+# compat-use-tst-compiler -- make compiler under test the default
+#
+proc compat-use-tst-compiler { } {
+ global GCC_UNDER_TEST compat_save_gcc_under_test
+ global compat_same_alt
+
+ # We don't need to do this if the alternate compiler is actually
+ # the same as the compiler under test.
+
+ if { $compat_same_alt == 0 } then {
+ set GCC_UNDER_TEST $compat_save_gcc_under_test
+ }
+}
+
+# Find out whether both compilers support decimal float types.
+proc compat_setup_dfp { } {
+ global compat_use_alt
+ global compat_same_alt
+ global compat_have_dfp
+
+ verbose "compat_setup_dfp: $compat_use_alt $compat_same_alt" 2
+ set compat_have_dfp 1
+ # If there is an alternate compiler, does it support decimal float types?
+ if { $compat_use_alt == 1 && $compat_same_alt == 0 } {
+ compat-use-alt-compiler
+ set compat_have_dfp [check_dfp]
+ compat-use-tst-compiler
+ verbose "compat_have_dfp for alt compiler: $compat_have_dfp" 2
+ }
+ # Does the compiler under test support it?
+ if { $compat_have_dfp == 1 } {
+ set compat_have_dfp [check_dfp]
+ verbose "compat_have_dfp for tst compiler: $compat_have_dfp" 2
+ }
+
+ # If decimal float is not supported, add it to the skip list, which
+ # affects code in the header files.
+ if { $compat_have_dfp == 0 } {
+ global compat_skip_list
+ lappend compat_skip_list "DECIMAL_FLOAT"
+ }
+}
+
+# Return 1 if the compiler supports decimal float types, 0 otherwise.
+#
+# Don't use check_effective_target since this will differ depending
+# on the compiler, not the target.
+#
+proc check_dfp { } {
+ set result [string match "" [get_compiler_messages dfp2 object {
+ _Decimal32 x; _Decimal64 y; _Decimal128 z;
+ }]]
+ return $result
+}
+
+# If either compiler does not support decimal float types, skip this test.
+
+proc dg-require-compat-dfp { args } {
+ global compat_have_dfp
+ if { $compat_have_dfp == 0 } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
diff --git a/gcc/testsuite/lib/compat.exp b/gcc/testsuite/lib/compat.exp
index 51d4407597e..86a437fe40b 100644
--- a/gcc/testsuite/lib/compat.exp
+++ b/gcc/testsuite/lib/compat.exp
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004, 2005 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
@@ -62,7 +62,8 @@ if ![info exists COMPAT_SKIPS] {
set COMPAT_SKIPS [list {}]
}
-set skip_list $COMPAT_SKIPS
+global compat_skip_list
+set compat_skip_list $COMPAT_SKIPS
load_lib dg.exp
load_lib gcc-dg.exp
@@ -81,10 +82,10 @@ proc compat-obj { source dest optall optfile optstr xfaildata } {
global testcase
global tool
global compiler_conditional_xfail_data
- global skip_list
+ global compat_skip_list
# Add the skip specifiers.
- foreach skip $skip_list {
+ foreach skip $compat_skip_list {
if { ![string match $skip ""] } {
lappend optall "-DSKIP_$skip"
}
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index 78ceb540853..04ead203480 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -1055,6 +1055,25 @@ proc check_effective_target_lp64 { } {
return $et_lp64_saved
}
+# Return 1 if the target supports Decimal Floating Point, 0 otherwise.
+#
+# This won't change for different subtargets so cache the result.
+
+proc check_effective_target_dfp { } {
+ global et_dfp_saved
+
+ if [info exists et_dfp_saved] {
+ verbose "check_effective_target_dfp: using cached result" 2
+ } else {
+ verbose "check_effective_target_dfp: compiling source" 2
+ set et_dfp_saved [string match "" [get_compiler_messages dfp object {
+ _Decimal32 x; _Decimal64 y; _Decimal128 z;
+ }]]
+ }
+ verbose "check_effective_target_dfp: returning $et_dfp_saved" 2
+ return $et_dfp_saved
+}
+
# Return 1 if the target needs a command line argument to enable a SIMD
# instruction set.
#