summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-09 14:50:19 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-09 14:50:19 +0000
commit011ea24cdbd3084a1408a5abf015da0ea1eca0ee (patch)
tree97676a530949901acc3ae1b6d60e406dae3eff49
parent42c442a97ffc36f0f3d2d22d04355087345baac3 (diff)
downloadgcc-011ea24cdbd3084a1408a5abf015da0ea1eca0ee.tar.gz
2012-10-09 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/54869 * include/ext/random (simd_fast_mersenne_twister_engine): Provide only for little endian targets. * include/ext/random.tcc: Likewise. * config/cpu/i486/opt/ext/opt_random.h: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_little_endian): Add. * testsuite/lib/dg-options.exp (dg-require-little-endian): Add. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ operators/equal.cc: Use the latter. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ operators/serialize.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ operators/inequal.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ cons/copy.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ cons/seed1.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ cons/seed2.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ cons/default.cc: Likewise. * testsuite/ext/random/simd_fast_mersenne_twister_engine/ cons/seed_seq.cc: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192256 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog26
-rw-r--r--libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h4
-rw-r--r--libstdc++-v3/include/ext/random3
-rw-r--r--libstdc++-v3/include/ext/random.tcc2
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc3
-rw-r--r--libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc3
-rw-r--r--libstdc++-v3/testsuite/lib/dg-options.exp9
-rw-r--r--libstdc++-v3/testsuite/lib/libstdc++.exp51
14 files changed, 111 insertions, 8 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index b9f3533798c..441f83d2822 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,29 @@
+2012-10-09 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR libstdc++/54869
+ * include/ext/random (simd_fast_mersenne_twister_engine): Provide
+ only for little endian targets.
+ * include/ext/random.tcc: Likewise.
+ * config/cpu/i486/opt/ext/opt_random.h: Likewise.
+ * testsuite/lib/libstdc++.exp (check_v3_target_little_endian): Add.
+ * testsuite/lib/dg-options.exp (dg-require-little-endian): Add.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ operators/equal.cc: Use the latter.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ operators/serialize.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ operators/inequal.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ cons/copy.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ cons/seed1.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ cons/seed2.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ cons/default.cc: Likewise.
+ * testsuite/ext/random/simd_fast_mersenne_twister_engine/
+ cons/seed_seq.cc: Likewise.
+
2012-10-09 Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/54754
diff --git a/libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h b/libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h
index 968b1c18bf2..a954ed8bbac 100644
--- a/libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h
+++ b/libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h
@@ -32,6 +32,8 @@
#pragma GCC system_header
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
#ifdef __SSE2__
namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
@@ -133,4 +135,6 @@ _GLIBCXX_END_NAMESPACE_VERSION
#endif // __SSE2__
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
#endif // _EXT_OPT_RANDOM_H
diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random
index 8c40d6d420a..0207d392261 100644
--- a/libstdc++-v3/include/ext/random
+++ b/libstdc++-v3/include/ext/random
@@ -47,6 +47,8 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+
/* Mersenne twister implementation optimized for vector operations.
*
* Reference: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/
@@ -380,6 +382,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
0x3bd2b64bU, 0x0c64b1e4U>
sfmt216091_64;
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* @brief A beta continuous distribution for random numbers.
diff --git a/libstdc++-v3/include/ext/random.tcc b/libstdc++-v3/include/ext/random.tcc
index 4151daff83d..a196f74bdc4 100644
--- a/libstdc++-v3/include/ext/random.tcc
+++ b/libstdc++-v3/include/ext/random.tcc
@@ -37,6 +37,7 @@ namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
template<typename _UIntType, size_t __m,
size_t __pos1, size_t __sl1, size_t __sl2,
@@ -402,6 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __is;
}
+#endif // __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
/**
* Iteration method due to M.D. J<o:>hnk.
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc
index 8371f4628fa..f703a090b83 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-02-16 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc
index 5b6489a4028..167839bf43e 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc
index 1926958ea4e..c8d7eead92f 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc
index 464512c4521..001b06d998a 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc
index 4820fa493d9..6fcd202a480 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-02-01 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc
index 80022a68d89..e41efd01131 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc
index 15aaf127814..c39f5ff1200 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2010-03-16 Paolo Carlini <paolo.carlini@oracle.com>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2010, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2010-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc
index ddc62b5605e..a3d5e766e5d 100644
--- a/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc
+++ b/libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc
@@ -1,10 +1,11 @@
// { dg-options "-std=c++0x" }
// { dg-require-cstdint "" }
+// { dg-require-little-endian "" }
//
// 2008-11-24 Edward M. Smith-Rowland <3dw4rd@verizon.net>
// 2012-08-28 Ulrich Drepper <drepper@gmail.com>, adapted for SFMT
//
-// Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+// Copyright (C) 2008-2012 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp b/libstdc++-v3/testsuite/lib/dg-options.exp
index 9d5624aedbb..14c705a28c0 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -206,6 +206,15 @@ proc dg-require-static-libstdcxx { args } {
return
}
+proc dg-require-little-endian { args } {
+ if { ![ check_v3_target_little_endian ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ return
+ }
+ return
+}
+
proc add_options_for_no_pch { flags } {
# This forces any generated and possibly included PCH to be invalid.
return "-D__GLIBCXX__=99999999"
diff --git a/libstdc++-v3/testsuite/lib/libstdc++.exp b/libstdc++-v3/testsuite/lib/libstdc++.exp
index 9a9e0cba625..09f512b3e9f 100644
--- a/libstdc++-v3/testsuite/lib/libstdc++.exp
+++ b/libstdc++-v3/testsuite/lib/libstdc++.exp
@@ -1736,6 +1736,57 @@ proc check_v3_target_static_libstdcxx { } {
return $et_static_libstdcxx
}
+proc check_v3_target_little_endian { } {
+ global cxxflags
+ global DEFAULT_CXXFLAGS
+ global et_little_endian
+
+ global tool
+
+ if { ![info exists et_little_endian_target_name] } {
+ set et_little_endian_target_name ""
+ }
+
+ # If the target has changed since we set the cached value, clear it.
+ set current_target [current_target_name]
+ if { $current_target != $et_little_endian_target_name } {
+ verbose "check_v3_target_little_endian: `$et_little_endian_target_name'" 2
+ set et_little_endian_target_name $current_target
+ if [info exists et_little_endian] {
+ verbose "check_v3_target_little_endian: removing cached result" 2
+ unset et_little_endian
+ }
+ }
+
+ if [info exists et_little_endian] {
+ verbose "check_v3_target_little_endian: using cached result" 2
+ } else {
+ set et_little_endian 0
+
+ set src little_endian[pid].cc
+ set f [open $src "w"]
+ puts $f "#if __BYTE_ORDER__ != __ORDER_LITTLE_ENDIAN__"
+ puts $f "# error Not little endian"
+ puts $f "#endif"
+ close $f
+
+ set cxxflags_saved $cxxflags
+ set cxxflags "$cxxflags $DEFAULT_CXXFLAGS -Werror"
+
+ set lines [v3_target_compile $src /dev/null preprocess ""]
+ set cxxflags $cxxflags_saved
+ file delete $src
+
+ if [string match "" $lines] {
+ # No error message, preprocessing succeeded.
+ set et_little_endian 1
+ } else {
+ verbose "check_v3_target_little_endian: compilation failed" 2
+ }
+ }
+ verbose "check_v3_target_little_endian: $et_little_endian" 2
+ return $et_little_endian
+}
set additional_prunes ""