From: Markus Wichmann <nullplan@gmx.net>
To: musl@lists.openwall.com
Subject: Re: atomic.h cleanup
Date: Sun, 10 Jan 2016 18:37:13 +0100 [thread overview]
Message-ID: <20160110173713.GH2016@debian> (raw)
In-Reply-To: <20160110165718.GR238@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 79 bytes --]
Hi all,
And once more with the promised attachments. I'm sorry.
Ciao,
Markus
[-- Attachment #2: cas.c --]
[-- Type: text/x-csrc, Size: 477 bytes --]
static inline int a_ll(volatile int *p) {
int x;
asm volatile ("lwarx %0, 0, %1" : "=r"(x) : "r"(p) : "memory");
return x;
}
static inline int a_sc(volatile int *p, int x) {
asm goto ("stwcx. %0, 0, %1\nbne- %l2" : : "r"(x), "r"(p) : "cc","memory" : fail);
return 1;
fail:
return 0;
}
int a_cas(volatile int *p, int t, int s) {
int x;
do {
x = a_ll(p);
if (x != t)
break;
} while (!a_sc(p, s));
return x;
}
[-- Attachment #3: cas.s --]
[-- Type: text/plain, Size: 359 bytes --]
.file "cas.c"
.section ".text"
.align 2
.globl a_cas
.type a_cas, @function
a_cas:
.L2:
#APP
# 3 "cas.c" 1
lwarx 9, 0, 3
# 0 "" 2
#NO_APP
cmpw 7,4,9
bne- 7,.L4
#APP
# 8 "cas.c" 1
stwcx. 5, 0, 3
bne- .L2
# 0 "" 2
#NO_APP
.L3:
mr 3,4
blr
.L4:
mr 4,9
b .L3
.size a_cas, .-a_cas
.ident "GCC: (GNU) 4.9.2"
.section .note.GNU-stack,"",@progbits
next prev parent reply other threads:[~2016-01-10 17:37 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 12:21 Markus Wichmann
2016-01-10 16:57 ` Rich Felker
2016-01-10 17:35 ` Markus Wichmann
2016-01-10 17:50 ` Alexander Monakov
2016-01-11 16:35 ` Markus Wichmann
2016-01-11 17:12 ` Jens Gustedt
2016-01-11 19:03 ` Szabolcs Nagy
2016-01-11 20:56 ` Jens Gustedt
2016-01-14 22:12 ` Rich Felker
2016-01-14 22:37 ` Jens Gustedt
2016-01-14 23:32 ` Rich Felker
2016-01-15 0:46 ` Szabolcs Nagy
2016-01-10 17:37 ` Markus Wichmann [this message]
2016-01-22 0:09 ` Rich Felker
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=20160110173713.GH2016@debian \
--to=nullplan@gmx.net \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).