public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/87548] Optimize fetch atomics with unused results
[not found] <bug-87548-4@http.gcc.gnu.org/bugzilla/>
@ 2021-12-21 11:03 ` pinskia at gcc dot gnu.org
2021-12-21 11:04 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-21 11:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87548
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |WORKSFORME
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This was implemented back in GCC 4.7.x when __atomic_fetch_and and
__atomic_and_fetch was added.
I get the lock and and lock xor for the following already back then:
void f (int *a)
{
__atomic_fetch_and(a, 10, 5);
}
void f1 (int *a)
{
__atomic_and_fetch(a, 10, 5);
}
void f2 (int *a)
{
__atomic_fetch_xor(a, 10, 5);
}
void f12 (int *a)
{
__atomic_xor_fetch(a, 10, 5);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug target/87548] Optimize fetch atomics with unused results
[not found] <bug-87548-4@http.gcc.gnu.org/bugzilla/>
2021-12-21 11:03 ` [Bug target/87548] Optimize fetch atomics with unused results pinskia at gcc dot gnu.org
@ 2021-12-21 11:04 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-21 11:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87548
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.file "example.cpp"
.intel_syntax noprefix
.text
.p2align 4,,15
.globl f(int*)
.type f(int*), @function
f(int*):
.LFB0:
.cfi_startproc
lock and DWORD PTR [rdi], 10
ret
.cfi_endproc
.LFE0:
.size f(int*), .-f(int*)
.p2align 4,,15
.globl f1(int*)
.type f1(int*), @function
f1(int*):
.LFB1:
.cfi_startproc
lock and DWORD PTR [rdi], 10
ret
.cfi_endproc
.LFE1:
.size f1(int*), .-f1(int*)
.p2align 4,,15
.globl f2(int*)
.type f2(int*), @function
f2(int*):
.LFB2:
.cfi_startproc
lock xor DWORD PTR [rdi], 10
ret
.cfi_endproc
.LFE2:
.size f2(int*), .-f2(int*)
.p2align 4,,15
.globl f12(int*)
.type f12(int*), @function
f12(int*):
.LFB3:
.cfi_startproc
lock xor DWORD PTR [rdi], 10
ret
.cfi_endproc
.LFE3:
.size f12(int*), .-f12(int*)
.ident "GCC: (GCC-Explorer-Build) 4.7.1"
.section .note.GNU-stack,"",@progbits
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-21 11:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-87548-4@http.gcc.gnu.org/bugzilla/>
2021-12-21 11:03 ` [Bug target/87548] Optimize fetch atomics with unused results pinskia at gcc dot gnu.org
2021-12-21 11:04 ` 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).