]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/54869 (ext/random/simd_fast_mersenne_twister_engine/cons/default...
authorPaolo Carlini <paolo.carlini@oracle.com>
Tue, 9 Oct 2012 14:50:19 +0000 (14:50 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Tue, 9 Oct 2012 14:50:19 +0000 (14:50 +0000)
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.

From-SVN: r192256

14 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/config/cpu/i486/opt/ext/opt_random.h
libstdc++-v3/include/ext/random
libstdc++-v3/include/ext/random.tcc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/copy.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/default.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed1.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed2.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/cons/seed_seq.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/equal.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/inequal.cc
libstdc++-v3/testsuite/ext/random/simd_fast_mersenne_twister_engine/operators/serialize.cc
libstdc++-v3/testsuite/lib/dg-options.exp
libstdc++-v3/testsuite/lib/libstdc++.exp

index b9f3533798cc8f802e6003b2ac60ac0ff4140508..441f83d2822d3358664ba34adb3122d26236434f 100644 (file)
@@ -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
index 968b1c18bf2b388e681bcb713a27a65c3c5864bc..a954ed8bbacd6b9a1c975020710d9d6cb33931b2 100644 (file)
@@ -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
index 8c40d6d420ad746342281253a2c57dbd7ef6b0db..0207d392261ba0c725490fc79307391c64cf1e82 100644 (file)
@@ -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.
index 4151daff83d05bdd4d7aff20ca966f6edf347b2f..a196f74bdc4265df86f7f3aa1e1cac19ffa86bfd 100644 (file)
@@ -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.
index 8371f4628faba286201c5e07f5f668c38e77e993..f703a090b835ac38c7945b700af00a8df4071760 100644 (file)
@@ -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) 20102012 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
index 5b6489a4028ebfaa159f718b2de7a3806e0aa32b..167839bf43e5501dadb540712723467cfe9f0512 100644 (file)
@@ -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
index 1926958ea4e97534db847d05a21929c494141a90..c8d7eead92f4b9b117a2b15001a9297959f79be8 100644 (file)
@@ -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
index 464512c4521bade809fd99f96bbd447bafa483d6..001b06d998ac2b08c114c1a685a4f060a64abdc5 100644 (file)
@@ -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
index 4820fa493d91bb8976028dd888864b4bf5453217..6fcd202a480db6b44e5faf15ae25fe97ec18fcc7 100644 (file)
@@ -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) 20102012 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
index 80022a68d89ae17cacbc43357ebbab438251a83c..e41efd01131cd405ced05ffc17e49b92de73ca78 100644 (file)
@@ -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
index 15aaf127814c9094431efa288ed12990fad905d8..c39f5ff1200c9887bac5efded40409396479ed5d 100644 (file)
@@ -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) 20102012 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
index ddc62b5605e1fd1a1ee8c86c82583f6669f3a24a..a3d5e766e5db4a8f7850c0e69daba653575b5a30 100644 (file)
@@ -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
index 9d5624aedbb17d8d57779d325c36b5fa34b80de4..14c705a28c070793faa283021b052220b85075a5 100644 (file)
@@ -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"
index 9a9e0cba62528accb396dabf4c3a4711ecb71ca5..09f512b3e9ffa3e1a414074683ea7cff80092214 100644 (file)
@@ -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 ""