Skip to content

Commit 5e5823c

Browse files
committed
Update the stdsimd submodule
This brings in a few updates: * Update wasm intrinsic naming for atomics * Update and reimplement most simd128 wasm intrinsics * Other misc improvements here and there, including a small start to AVX-512 intrinsics
1 parent adbfec2 commit 5e5823c

File tree

6 files changed

+17
-16
lines changed

6 files changed

+17
-16
lines changed

src/libcore/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
#![feature(mips_target_feature)]
119119
#![feature(aarch64_target_feature)]
120120
#![feature(wasm_target_feature)]
121+
#![feature(avx512_target_feature)]
121122
#![feature(const_slice_len)]
122123
#![feature(const_str_as_bytes)]
123124
#![feature(const_str_len)]

src/libstd/sys/wasm/alloc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mod lock {
7474
return DropLock
7575
}
7676
unsafe {
77-
let r = wasm32::atomic::wait_i32(
77+
let r = wasm32::i32_atomic_wait(
7878
&LOCKED as *const AtomicI32 as *mut i32,
7979
1, // expected value
8080
-1, // timeout
@@ -89,7 +89,7 @@ mod lock {
8989
let r = LOCKED.swap(0, SeqCst);
9090
debug_assert_eq!(r, 1);
9191
unsafe {
92-
wasm32::atomic::wake(
92+
wasm32::atomic_notify(
9393
&LOCKED as *const AtomicI32 as *mut i32,
9494
1, // only one thread
9595
);

src/libstd/sys/wasm/condvar_atomics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use arch::wasm32::atomic;
11+
use arch::wasm32;
1212
use cmp;
1313
use mem;
1414
use sync::atomic::{AtomicUsize, Ordering::SeqCst};
@@ -52,13 +52,13 @@ impl Condvar {
5252

5353
pub unsafe fn notify_one(&self) {
5454
self.cnt.fetch_add(1, SeqCst);
55-
atomic::wake(self.ptr(), 1);
55+
wasm32::atomic_notify(self.ptr(), 1);
5656
}
5757

5858
#[inline]
5959
pub unsafe fn notify_all(&self) {
6060
self.cnt.fetch_add(1, SeqCst);
61-
atomic::wake(self.ptr(), -1); // -1 == "wake everyone"
61+
wasm32::atomic_notify(self.ptr(), u32::max_value()); // -1 == "wake everyone"
6262
}
6363

6464
pub unsafe fn wait(&self, mutex: &Mutex) {
@@ -72,7 +72,7 @@ impl Condvar {
7272
// wake us up once we're asleep.
7373
let ticket = self.cnt.load(SeqCst) as i32;
7474
mutex.unlock();
75-
let val = atomic::wait_i32(self.ptr(), ticket, -1);
75+
let val = wasm32::i32_atomic_wait(self.ptr(), ticket, -1);
7676
// 0 == woken, 1 == not equal to `ticket`, 2 == timeout (shouldn't happen)
7777
debug_assert!(val == 0 || val == 1);
7878
mutex.lock();
@@ -86,7 +86,7 @@ impl Condvar {
8686

8787
// If the return value is 2 then a timeout happened, so we return
8888
// `false` as we weren't actually notified.
89-
let ret = atomic::wait_i32(self.ptr(), ticket, nanos as i64) != 2;
89+
let ret = wasm32::i32_atomic_wait(self.ptr(), ticket, nanos as i64) != 2;
9090
mutex.lock();
9191
return ret
9292
}

src/libstd/sys/wasm/mutex_atomics.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use arch::wasm32::atomic;
11+
use arch::wasm32;
1212
use cell::UnsafeCell;
1313
use mem;
1414
use sync::atomic::{AtomicUsize, AtomicU32, Ordering::SeqCst};
@@ -36,7 +36,7 @@ impl Mutex {
3636

3737
pub unsafe fn lock(&self) {
3838
while !self.try_lock() {
39-
let val = atomic::wait_i32(
39+
let val = wasm32::i32_atomic_wait(
4040
self.ptr(),
4141
1, // we expect our mutex is locked
4242
-1, // wait infinitely
@@ -50,7 +50,7 @@ impl Mutex {
5050
pub unsafe fn unlock(&self) {
5151
let prev = self.locked.swap(0, SeqCst);
5252
debug_assert_eq!(prev, 1);
53-
atomic::wake(self.ptr(), 1); // wake up one waiter, if any
53+
wasm32::atomic_notify(self.ptr(), 1); // wake up one waiter, if any
5454
}
5555

5656
#[inline]
@@ -104,7 +104,7 @@ impl ReentrantMutex {
104104
pub unsafe fn lock(&self) {
105105
let me = thread::my_id();
106106
while let Err(owner) = self._try_lock(me) {
107-
let val = atomic::wait_i32(self.ptr(), owner as i32, -1);
107+
let val = wasm32::i32_atomic_wait(self.ptr(), owner as i32, -1);
108108
debug_assert!(val == 0 || val == 1);
109109
}
110110
}
@@ -143,7 +143,7 @@ impl ReentrantMutex {
143143
match *self.recursions.get() {
144144
0 => {
145145
self.owner.swap(0, SeqCst);
146-
atomic::wake(self.ptr() as *mut i32, 1); // wake up one waiter, if any
146+
wasm32::atomic_notify(self.ptr() as *mut i32, 1); // wake up one waiter, if any
147147
}
148148
ref mut n => *n -= 1,
149149
}

src/libstd/sys/wasm/thread.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Thread {
4141

4242
#[cfg(target_feature = "atomics")]
4343
pub fn sleep(dur: Duration) {
44-
use arch::wasm32::atomic;
44+
use arch::wasm32;
4545
use cmp;
4646

4747
// Use an atomic wait to block the current thread artificially with a
@@ -53,7 +53,7 @@ impl Thread {
5353
while nanos > 0 {
5454
let amt = cmp::min(i64::max_value() as u128, nanos);
5555
let mut x = 0;
56-
let val = unsafe { atomic::wait_i32(&mut x, 0, amt as i64) };
56+
let val = unsafe { wasm32::i32_atomic_wait(&mut x, 0, amt as i64) };
5757
debug_assert_eq!(val, 2);
5858
nanos -= amt;
5959
}
@@ -108,7 +108,7 @@ cfg_if! {
108108
panic!("thread local data not implemented on wasm with atomics yet")
109109
}
110110

111-
pub fn tcb_set(ptr: *mut u8) {
111+
pub fn tcb_set(_ptr: *mut u8) {
112112
panic!("thread local data not implemented on wasm with atomics yet")
113113
}
114114
} else {

src/stdsimd

0 commit comments

Comments
 (0)