Skip to content

Commit 87a5744

Browse files
bors[bot]Amanieu
andauthored
Merge #223
223: Use llvm_asm! instead of asm! r=Amanieu a=Amanieu `asm!` will be deprecated soon in preparation for the new `asm!` macro, so switch to using `llvm_asm!` instead. cc rust-lang/rfcs#2843 Co-authored-by: Amanieu d'Antras <amanieu@gmail.com>
2 parents 9bed8e3 + 806e5c1 commit 87a5744

File tree

4 files changed

+31
-21
lines changed

4 files changed

+31
-21
lines changed

.travis.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,10 @@ matrix:
8282

8383
notifications:
8484
email: false
85+
86+
branches:
87+
# Don't build these branches
88+
except:
89+
# Used by bors
90+
- trying.tmp
91+
- staging.tmp

bors.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
status = [
2+
"continuous-integration/travis-ci/push",
3+
]

src/elision.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ impl AtomicElisionExt for AtomicUsize {
5757
fn elision_compare_exchange_acquire(&self, current: usize, new: usize) -> Result<usize, usize> {
5858
unsafe {
5959
let prev: usize;
60-
asm!("xacquire; lock; cmpxchgl $2, $1"
61-
: "={eax}" (prev), "+*m" (self)
62-
: "r" (new), "{eax}" (current)
63-
: "memory"
64-
: "volatile");
60+
llvm_asm!("xacquire; lock; cmpxchgl $2, $1"
61+
: "={eax}" (prev), "+*m" (self)
62+
: "r" (new), "{eax}" (current)
63+
: "memory"
64+
: "volatile");
6565
if prev == current {
6666
Ok(prev)
6767
} else {
@@ -74,11 +74,11 @@ impl AtomicElisionExt for AtomicUsize {
7474
fn elision_compare_exchange_acquire(&self, current: usize, new: usize) -> Result<usize, usize> {
7575
unsafe {
7676
let prev: usize;
77-
asm!("xacquire; lock; cmpxchgq $2, $1"
78-
: "={rax}" (prev), "+*m" (self)
79-
: "r" (new), "{rax}" (current)
80-
: "memory"
81-
: "volatile");
77+
llvm_asm!("xacquire; lock; cmpxchgq $2, $1"
78+
: "={rax}" (prev), "+*m" (self)
79+
: "r" (new), "{rax}" (current)
80+
: "memory"
81+
: "volatile");
8282
if prev == current {
8383
Ok(prev)
8484
} else {
@@ -92,11 +92,11 @@ impl AtomicElisionExt for AtomicUsize {
9292
fn elision_fetch_sub_release(&self, val: usize) -> usize {
9393
unsafe {
9494
let prev: usize;
95-
asm!("xrelease; lock; xaddl $2, $1"
96-
: "=r" (prev), "+*m" (self)
97-
: "0" (val.wrapping_neg())
98-
: "memory"
99-
: "volatile");
95+
llvm_asm!("xrelease; lock; xaddl $2, $1"
96+
: "=r" (prev), "+*m" (self)
97+
: "0" (val.wrapping_neg())
98+
: "memory"
99+
: "volatile");
100100
prev
101101
}
102102
}
@@ -105,11 +105,11 @@ impl AtomicElisionExt for AtomicUsize {
105105
fn elision_fetch_sub_release(&self, val: usize) -> usize {
106106
unsafe {
107107
let prev: usize;
108-
asm!("xrelease; lock; xaddq $2, $1"
109-
: "=r" (prev), "+*m" (self)
110-
: "0" (val.wrapping_neg())
111-
: "memory"
112-
: "volatile");
108+
llvm_asm!("xrelease; lock; xaddq $2, $1"
109+
: "=r" (prev), "+*m" (self)
110+
: "0" (val.wrapping_neg())
111+
: "memory"
112+
: "volatile");
113113
prev
114114
}
115115
}

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
#![warn(missing_docs)]
1313
#![warn(rust_2018_idioms)]
14-
#![cfg_attr(feature = "nightly", feature(asm))]
14+
#![cfg_attr(feature = "nightly", feature(llvm_asm))]
1515

1616
mod condvar;
1717
mod elision;

0 commit comments

Comments
 (0)