libstdc++ testsuite: atomic_float/value_init.cc requires libatomic

Message ID CAGWvny=NuMHOmKseyNfGBP19_A2SZqdcOhwmTdXmLxzuUTR5ZQ@mail.gmail.com
State New
Headers show
Series
  • libstdc++ testsuite: atomic_float/value_init.cc requires libatomic
Related show

Commit Message

Qing Zhao via Gcc-patches July 29, 2020, 1:44 a.m.
atomic_float/value_init.cc requires libatomic on some targets, i.e.,
when it tries to perform an atomic operation with a 64 bit floating
point double type on a 32 bit target.  This patch adds AIX to the list
of targets that require the libatomic option and adds the option to
the atomic_float/value_init.cc testcase.

Bootstrapped on powerpc-ibm-aix7.2.0.0

Okay?

Thanks, David

    2020-07-28  David Edelsohn  <dje.gcc@gmail.com>
                        Jonathan Wakely  <jwakely@redhat.com>

            * testsuite/lib/dg-options.exp (add_options_for_libatomic): Add
            target powerpc-ibm-aix*.
            * testsuite/29_atomics/atomic_float/value_init.cc: Add options
            for libatomic.

Comments

Qing Zhao via Gcc-patches July 29, 2020, 9:09 a.m. | #1
On 28/07/20 21:44 -0400, David Edelsohn via Libstdc++ wrote:
>atomic_float/value_init.cc requires libatomic on some targets, i.e.,

>when it tries to perform an atomic operation with a 64 bit floating

>point double type on a 32 bit target.  This patch adds AIX to the list

>of targets that require the libatomic option and adds the option to

>the atomic_float/value_init.cc testcase.

>

>Bootstrapped on powerpc-ibm-aix7.2.0.0

>

>Okay?

>

>Thanks, David

>

>    2020-07-28  David Edelsohn  <dje.gcc@gmail.com>

>                        Jonathan Wakely  <jwakely@redhat.com>

>

>            * testsuite/lib/dg-options.exp (add_options_for_libatomic): Add

>            target powerpc-ibm-aix*.

>            * testsuite/29_atomics/atomic_float/value_init.cc: Add options

>            for libatomic.

>

>diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc

>b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc

>index 237c0dd13ed..38af9bdc8d4 100644

>--- a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc

>+++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc

>@@ -17,6 +17,7 @@

>

> // { dg-options "-std=gnu++2a" }

> // { dg-do run { target c++2a } }

>+// { dg-add-options libatomic }

>

> #include <atomic>

> #include <testsuite_hooks.h>

>

>diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp

>b/libstdc++-v3/testsuite/lib/dg-options.exp

>index 9bfae71adf3..bf6219c3042 100644

>--- a/libstdc++-v3/testsuite/lib/dg-options.exp

>+++ b/libstdc++-v3/testsuite/lib/dg-options.exp

>@@ -260,7 +260,8 @@ proc add_options_for_net_ts { flags } {

> # Add to FLAGS all the target-specific flags to link to libatomic, if required.

>

> proc add_options_for_libatomic { flags } {

>-    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*] } {

>+    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*]

>+        || [istarget powerpc-ibm-aix*] } {


Could you add || [istarget powerpc*-darwin*] here too please?

Iain agreed that's needed.

OK with that change, thanks.


>        return "$flags -L../../libatomic/.libs -latomic"

>     }

>     return $flags

>
Rainer Orth July 29, 2020, 9:28 a.m. | #2
Jonathan Wakely via Gcc-patches <gcc-patches@gcc.gnu.org> writes:

>>diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp

>>b/libstdc++-v3/testsuite/lib/dg-options.exp

>>index 9bfae71adf3..bf6219c3042 100644

>>--- a/libstdc++-v3/testsuite/lib/dg-options.exp

>>+++ b/libstdc++-v3/testsuite/lib/dg-options.exp

>>@@ -260,7 +260,8 @@ proc add_options_for_net_ts { flags } {

>> # Add to FLAGS all the target-specific flags to link to libatomic, if required.

>>

>> proc add_options_for_libatomic { flags } {

>>-    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*] } {

>>+    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*]

>>+        || [istarget powerpc-ibm-aix*] } {

>

> Could you add || [istarget powerpc*-darwin*] here too please?

>

> Iain agreed that's needed.

>

> OK with that change, thanks.


And please keep the target list sorted alphabetically.

Thanks.
	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

Patch

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
index 237c0dd13ed..38af9bdc8d4 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic_float/value_init.cc
@@ -17,6 +17,7 @@ 

 // { dg-options "-std=gnu++2a" }
 // { dg-do run { target c++2a } }
+// { dg-add-options libatomic }

 #include <atomic>
 #include <testsuite_hooks.h>

diff --git a/libstdc++-v3/testsuite/lib/dg-options.exp
b/libstdc++-v3/testsuite/lib/dg-options.exp
index 9bfae71adf3..bf6219c3042 100644
--- a/libstdc++-v3/testsuite/lib/dg-options.exp
+++ b/libstdc++-v3/testsuite/lib/dg-options.exp
@@ -260,7 +260,8 @@  proc add_options_for_net_ts { flags } {
 # Add to FLAGS all the target-specific flags to link to libatomic, if required.

 proc add_options_for_libatomic { flags } {
-    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*] } {
+    if { [istarget hppa*-*-hpux*] || [istarget riscv*-*-*]
+        || [istarget powerpc-ibm-aix*] } {
        return "$flags -L../../libatomic/.libs -latomic"
     }
     return $flags