public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Alexandre Oliva <aoliva@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r14-10017] [libstdc++] [testsuite] disable SRA for compare_exchange_padding
Date: Thu, 18 Apr 2024 11:14:51 +0000 (GMT)	[thread overview]
Message-ID: <20240418111451.1D8E3384AB48@sourceware.org> (raw)

https://gcc.gnu.org/g:dcf0bd14cda706be8d0c18963812beefca51df39

commit r14-10017-gdcf0bd14cda706be8d0c18963812beefca51df39
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Thu Apr 18 08:00:59 2024 -0300

    [libstdc++] [testsuite] disable SRA for compare_exchange_padding
    
    On arm-vx7r2, the uses of as.load() as initializer get SRAed, so the
    padding bits in the tests are not what we might expect from full-word
    struct copies.
    
    I tried adding a function to perform bitwise copying, but even taking
    the as.load() argument by const&, we'd still construct a temporary
    with SRAed field-wise copying.  Unable to find another way to ensure
    we wouldn't get a temporary, I went for disabling SRA.
    
    
    for  libstdc++-v3/ChangeLog
    
            * testsuite/29_atomics/atomic/compare_exchange_padding.cc:
            Disable SRA.

Diff:
---
 libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
index 2f18d426e7f..a6081968ca8 100644
--- a/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
+++ b/libstdc++-v3/testsuite/29_atomics/atomic/compare_exchange_padding.cc
@@ -1,6 +1,7 @@
 // { dg-do run { target c++20 } }
 // { dg-require-atomic-cmpxchg-word "" }
 // { dg-add-options libatomic }
+// { dg-additional-options "-fno-tree-sra" }
 
 #include <atomic>
 #include <cstring>
@@ -26,10 +27,10 @@ main ()
   s.s = 42;
 
   std::atomic<S> as{ s };
-  auto ts = as.load();
+  auto ts = as.load(); // SRA might prevent copying of padding bits here.
   VERIFY( !compare_struct(s, ts) ); // padding cleared on construction
   as.exchange(s);
-  auto es = as.load();
+  auto es = as.load(); // SRA might prevent copying of padding bits here.
   VERIFY( compare_struct(ts, es) ); // padding cleared on exchange
 
   S n;

                 reply	other threads:[~2024-04-18 11:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240418111451.1D8E3384AB48@sourceware.org \
    --to=aoliva@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).