public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Go patch committed: Define __atomic_fetch_add functions
@ 2022-11-10  0:09 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2022-11-10  0:09 UTC (permalink / raw)
  To: gcc-patches, gofrontend-dev

[-- Attachment #1: Type: text/plain, Size: 409 bytes --]

This patch to the GCC-specific part of the Go frontend defines the
__atomic_fetch_add functions.  The frontend only generates calls to
the __atomic_add_fetch functions, but in some cases the middle-end can
transform the latter into the former.  This patch is originally by
Marc Poulhiès.  This fixes PR  107581.  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1284 bytes --]

diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc
index 1ba7206caeb..6e5887aecab 100644
--- a/gcc/go/go-gcc.cc
+++ b/gcc/go/go-gcc.cc
@@ -886,16 +886,20 @@ Gcc_backend::Gcc_backend()
                                uint32_type_node,
                                integer_type_node,
                                NULL_TREE);
-  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4", NULL,
-                       t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_4, "__atomic_add_fetch_4",
+		       NULL, t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_4, "__atomic_fetch_add_4",
+		       NULL, t, 0);
 
   t = build_function_type_list(uint64_type_node,
                                ptr_type_node,
                                uint64_type_node,
                                integer_type_node,
                                NULL_TREE);
-  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8", NULL,
-                       t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_ADD_FETCH_8, "__atomic_add_fetch_8",
+		       NULL, t, 0);
+  this->define_builtin(BUILT_IN_ATOMIC_FETCH_ADD_8, "__atomic_fetch_add_8",
+		       NULL, t, 0);
 
   t = build_function_type_list(unsigned_char_type_node,
 			       ptr_type_node,

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-10  0:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-10  0:09 Go patch committed: Define __atomic_fetch_add functions Ian Lance Taylor

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).