From: Yap Zhi Heng <[email protected]>

The corrected atomic store & load intrinsics were using post-1.64.0 namings, 
this patch
just adds back the 1.49.0 namings for the wrongly named intrinsics.

gcc/rust/ChangeLog:

        * util/rust-intrinsic-values.h (Rust::Values::Intrinsics): Add entries 
for atomic_store,
        atomic_store_rel, atomic_load, atomic_load_acq.
        * backend/rust-compile-intrinsic.cc (generic_intrinsics): Likewise.

Signed-off-by: Yap Zhi Heng <[email protected]>

Tested on x86_64-pc-linux-gnu.

---
 gcc/rust/backend/rust-compile-intrinsic.cc |  4 ++++
 gcc/rust/util/rust-intrinsic-values.h      | 13 +++++++++++++
 2 files changed, 17 insertions(+)

diff --git a/gcc/rust/backend/rust-compile-intrinsic.cc 
b/gcc/rust/backend/rust-compile-intrinsic.cc
index b4864767008..b13e721a8ca 100644
--- a/gcc/rust/backend/rust-compile-intrinsic.cc
+++ b/gcc/rust/backend/rust-compile-intrinsic.cc
@@ -49,12 +49,16 @@ static const std::map<std::string, 
handlers::HandlerBuilder> generic_intrinsics
      {IValue::COPY_NONOVERLAPPING, handlers::copy (false)},
      {IValue::PREFETCH_READ_DATA, handlers::prefetch_read_data},
      {IValue::PREFETCH_WRITE_DATA, handlers::prefetch_write_data},
+     {IValue::ATOMIC_STORE, handlers::atomic_store (__ATOMIC_SEQ_CST)},
      {IValue::ATOMIC_STORE_SEQCST, handlers::atomic_store (__ATOMIC_SEQ_CST)},
+     {IValue::ATOMIC_STORE_REL, handlers::atomic_store (__ATOMIC_RELEASE)},
      {IValue::ATOMIC_STORE_RELEASE, handlers::atomic_store (__ATOMIC_RELEASE)},
      {IValue::ATOMIC_STORE_RELAXED, handlers::atomic_store (__ATOMIC_RELAXED)},
      {IValue::ATOMIC_STORE_UNORDERED,
       handlers::atomic_store (__ATOMIC_RELAXED)},
+     {IValue::ATOMIC_LOAD, handlers::atomic_load (__ATOMIC_SEQ_CST)},
      {IValue::ATOMIC_LOAD_SEQCST, handlers::atomic_load (__ATOMIC_SEQ_CST)},
+     {IValue::ATOMIC_LOAD_ACQ, handlers::atomic_load (__ATOMIC_ACQUIRE)},
      {IValue::ATOMIC_LOAD_ACQUIRE, handlers::atomic_load (__ATOMIC_ACQUIRE)},
      {IValue::ATOMIC_LOAD_RELAXED, handlers::atomic_load (__ATOMIC_RELAXED)},
      {IValue::ATOMIC_LOAD_UNORDERED, handlers::atomic_load (__ATOMIC_RELAXED)},
diff --git a/gcc/rust/util/rust-intrinsic-values.h 
b/gcc/rust/util/rust-intrinsic-values.h
index f6e36a3867d..43df60fd5a2 100644
--- a/gcc/rust/util/rust-intrinsic-values.h
+++ b/gcc/rust/util/rust-intrinsic-values.h
@@ -97,12 +97,25 @@ public:
   static constexpr auto &PREFETCH_READ_DATA = "prefetch_read_data";
   static constexpr auto &PREFETCH_WRITE_DATA = "prefetch_write_data";
 
+  static constexpr auto &ATOMIC_STORE = "atomic_store";
+  // atomic_store is renamed to atomic_store_seqcst from 1.64.0, the latter is
+  // left in for compatibility
+  // 
https://github.com/rust-lang/rust/commit/4982a59986f7393ace98f63c10e6c435ffba1420
   static constexpr auto &ATOMIC_STORE_SEQCST = "atomic_store_seqcst";
+  static constexpr auto &ATOMIC_STORE_REL = "atomic_store_rel";
+  // atomic_store_rel is nenamed to atomic_store_release from 1.64.0, the
+  // latter is left in for compatibility
   static constexpr auto &ATOMIC_STORE_RELEASE = "atomic_store_release";
   static constexpr auto &ATOMIC_STORE_RELAXED = "atomic_store_relaxed";
   static constexpr auto &ATOMIC_STORE_UNORDERED = "atomic_store_unordered";
 
+  static constexpr auto &ATOMIC_LOAD = "atomic_load";
+  // atomic_load is renamed to atomic_load_seqcst from 1.64.0, the latter is
+  // left in for compatibility
   static constexpr auto &ATOMIC_LOAD_SEQCST = "atomic_load_seqcst";
+  static constexpr auto &ATOMIC_LOAD_ACQ = "atomic_load_acq";
+  // atomic_load_acq is renamed to atomic_load_acquire from 1.64.0, the latter
+  // is left in for compatibility
   static constexpr auto &ATOMIC_LOAD_ACQUIRE = "atomic_load_acquire";
   static constexpr auto &ATOMIC_LOAD_RELAXED = "atomic_load_relaxed";
   static constexpr auto &ATOMIC_LOAD_UNORDERED = "atomic_load_unordered";
-- 
2.55.0

Reply via email to