From b2724727d52904e104ccb3ce14d9dc60ffee1dec Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Tue, 22 Apr 2014 19:51:14 -0400 Subject: add volatile copy/copy_nonoverlapping/set This exposes volatile versions of the memset/memmove/memcpy intrinsics. The volatile parameter must be constant, so this can't simply be a parameter to our intrinsics. --- src/libstd/intrinsics.rs | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/intrinsics.rs b/src/libstd/intrinsics.rs index 7f02ab28342..1b419e59a70 100644 --- a/src/libstd/intrinsics.rs +++ b/src/libstd/intrinsics.rs @@ -261,10 +261,6 @@ extern "rust-intrinsic" { /// Execute a breakpoint trap, for inspection by a debugger. pub fn breakpoint(); - pub fn volatile_load(src: *T) -> T; - pub fn volatile_store(dst: *mut T, val: T); - - /// The size of a type in bytes. /// /// This is the exact number of bytes in memory taken up by a @@ -338,6 +334,33 @@ extern "rust-intrinsic" { /// `min_align_of::()` pub fn set_memory(dst: *mut T, val: u8, count: uint); + /// Equivalent to the appropriate `llvm.memcpy.p0i8.0i8.*` intrinsic, with + /// a size of `count` * `size_of::()` and an alignment of + /// `min_align_of::()` + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_copy_nonoverlapping_memory(dst: *mut T, src: *T, count: uint); + /// Equivalent to the appropriate `llvm.memmove.p0i8.0i8.*` intrinsic, with + /// a size of `count` * `size_of::()` and an alignment of + /// `min_align_of::()` + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_copy_memory(dst: *mut T, src: *T, count: uint); + /// Equivalent to the appropriate `llvm.memset.p0i8.*` intrinsic, with a + /// size of `count` * `size_of::()` and an alignment of + /// `min_align_of::()`. + /// + /// The volatile parameter parameter is set to `true`, so it will not be optimized out. + #[cfg(not(stage0))] + pub fn volatile_set_memory(dst: *mut T, val: u8, count: uint); + + /// Perform a volatile load from the `src` pointer. + pub fn volatile_load(src: *T) -> T; + /// Perform a volatile store to the `dst` pointer. + pub fn volatile_store(dst: *mut T, val: T); + pub fn sqrtf32(x: f32) -> f32; pub fn sqrtf64(x: f64) -> f64; -- cgit 1.4.1-3-g733a5