diff options
| author | bors <bors@rust-lang.org> | 2017-06-02 04:58:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-06-02 04:58:09 +0000 |
| commit | 668e698bbaacfeacb712512a58db1bd5e78ee371 (patch) | |
| tree | 49704edc575a8b2963bb7d00b63da9b3238b6192 /src/libcore | |
| parent | 4ed2edaafe82fb8d44e81e00ca3e4f7659855ba2 (diff) | |
| parent | f83901bb89e4043268ec3bf033b435d56e1ed303 (diff) | |
| download | rust-668e698bbaacfeacb712512a58db1bd5e78ee371.tar.gz rust-668e698bbaacfeacb712512a58db1bd5e78ee371.zip | |
Auto merge of #41418 - hirschenberger:prefetch-intrinsic, r=nagisa
Adding support for the llvm `prefetch` intrinsic Optimize `slice::binary_search` by using prefetching.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/intrinsics.rs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 9f1870e56d3..3566bbdebc2 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -564,8 +564,55 @@ extern "rust-intrinsic" { pub fn atomic_umax_rel<T>(dst: *mut T, src: T) -> T; pub fn atomic_umax_acqrel<T>(dst: *mut T, src: T) -> T; pub fn atomic_umax_relaxed<T>(dst: *mut T, src: T) -> T; + + /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction + /// if supported; otherwise, it is a noop. + /// Prefetches have no effect on the behavior of the program but can change its performance + /// characteristics. + /// + /// The `locality` argument must be a constant integer and is a temporal locality specifier + /// ranging from (0) - no locality, to (3) - extremely local keep in cache + #[cfg(not(stage0))] + pub fn prefetch_read_data<T>(data: *const T, locality: i32); + /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction + /// if supported; otherwise, it is a noop. + /// Prefetches have no effect on the behavior of the program but can change its performance + /// characteristics. + /// + /// The `locality` argument must be a constant integer and is a temporal locality specifier + /// ranging from (0) - no locality, to (3) - extremely local keep in cache + #[cfg(not(stage0))] + pub fn prefetch_write_data<T>(data: *const T, locality: i32); + /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction + /// if supported; otherwise, it is a noop. + /// Prefetches have no effect on the behavior of the program but can change its performance + /// characteristics. + /// + /// The `locality` argument must be a constant integer and is a temporal locality specifier + /// ranging from (0) - no locality, to (3) - extremely local keep in cache + #[cfg(not(stage0))] + pub fn prefetch_read_instruction<T>(data: *const T, locality: i32); + /// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction + /// if supported; otherwise, it is a noop. + /// Prefetches have no effect on the behavior of the program but can change its performance + /// characteristics. + /// + /// The `locality` argument must be a constant integer and is a temporal locality specifier + /// ranging from (0) - no locality, to (3) - extremely local keep in cache + #[cfg(not(stage0))] + pub fn prefetch_write_instruction<T>(data: *const T, locality: i32); } +// Empty bootstrap implementations for stage0 compilation +#[cfg(stage0)] +pub fn prefetch_read_data<T>(_data: *const T, _locality: i32) { /* EMPTY */ } +#[cfg(stage0)] +pub fn prefetch_write_data<T>(_data: *const T, _locality: i32) { /* EMPTY */ } +#[cfg(stage0)] +pub fn prefetch_read_instruction<T>(_data: *const T, _locality: i32) { /* EMPTY */ } +#[cfg(stage0)] +pub fn prefetch_write_instruction<T>(_data: *const T, _locality: i32) { /* EMPTY */ } + extern "rust-intrinsic" { pub fn atomic_fence(); |
