public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/64991] New: Issues depending on atomic variable type.
@ 2015-02-09 22:44 u17263 at att dot net
2021-12-14 18:01 ` [Bug target/64991] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: u17263 at att dot net @ 2015-02-09 22:44 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64991
Bug ID: 64991
Summary: Issues depending on atomic variable type.
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: u17263 at att dot net
Created attachment 34709
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34709&action=edit
test case
When a variable associated with an atomic update is an integer, the generated
gimple will contain a __atomic_fetch_add_4 (). The emitted instruction on an
x86 will load the value, add to it, and write it as a single atomic
instruction.
However, when the variable is a real, the generated gimple will contain an
atomic operation to load the variable (__atomic_load_4), the addition
operation, and an atomic operation to store the variable
(__sync_val_compare_and_swap_4). Given the integer example, I would have
expected that in the case of the real, that the load, addition, and store would
be an entire critical section.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/64991] Issues depending on atomic variable type.
2015-02-09 22:44 [Bug middle-end/64991] New: Issues depending on atomic variable type u17263 at att dot net
@ 2021-12-14 18:01 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14 18:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64991
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INVALID
Status|UNCONFIRMED |RESOLVED
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
There is no way to do lock prefix to the SSE instructions so you need to do a
compare and exchange loop as you need to make sure the value has been updated
atomically. That is no other changes happened to that memory location after the
load/addition happens.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-14 18:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-09 22:44 [Bug middle-end/64991] New: Issues depending on atomic variable type u17263 at att dot net
2021-12-14 18:01 ` [Bug target/64991] " pinskia at gcc dot gnu.org
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).