2013-02-20 10:57:15 -06:00
|
|
|
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
|
|
/*!
|
2013-02-20 13:41:24 -06:00
|
|
|
An attempt to move all intrinsic declarations to a single place,
|
|
|
|
as mentioned in #3369
|
2013-02-20 10:57:15 -06:00
|
|
|
The intrinsics are defined in librustc/middle/trans/foreign.rs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#[abi = "rust-intrinsic"]
|
2013-03-13 21:25:28 -05:00
|
|
|
pub extern "rust-intrinsic" {
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn atomic_cxchg(dst: &mut int, old: int, src: int) -> int;
|
|
|
|
pub fn atomic_cxchg_acq(dst: &mut int, old: int, src: int) -> int;
|
|
|
|
pub fn atomic_cxchg_rel(dst: &mut int, old: int, src: int) -> int;
|
|
|
|
|
|
|
|
pub fn atomic_xchg(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xchg_acq(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xchg_rel(dst: &mut int, src: int) -> int;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn atomic_xadd(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xadd_acq(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xadd_rel(dst: &mut int, src: int) -> int;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn atomic_xsub(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xsub_acq(dst: &mut int, src: int) -> int;
|
|
|
|
pub fn atomic_xsub_rel(dst: &mut int, src: int) -> int;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn size_of<T>() -> uint;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-05-07 16:20:56 -05:00
|
|
|
pub fn move_val<T>(dst: &mut T, src: T);
|
|
|
|
pub fn move_val_init<T>(dst: &mut T, src: T);
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn min_align_of<T>() -> uint;
|
|
|
|
pub fn pref_align_of<T>() -> uint;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn get_tydesc<T>() -> *();
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-05-09 13:44:52 -05:00
|
|
|
/// init is unsafe because it returns a zeroed-out datum,
|
|
|
|
/// which is unsafe unless T is POD. We don't have a POD
|
|
|
|
/// kind yet. (See #4074)
|
|
|
|
pub unsafe fn init<T>() -> T;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-05-09 05:23:38 -05:00
|
|
|
#[cfg(not(stage0))]
|
|
|
|
pub unsafe fn uninit<T>() -> T;
|
|
|
|
|
2013-05-09 14:15:37 -05:00
|
|
|
/// forget is unsafe because the caller is responsible for
|
|
|
|
/// ensuring the argument is deallocated already
|
|
|
|
pub unsafe fn forget<T>(_: T) -> ();
|
2013-02-20 10:57:15 -06:00
|
|
|
|
|
|
|
pub fn needs_drop<T>() -> bool;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
|
|
|
// XXX: intrinsic uses legacy modes and has reference to TyDesc
|
2013-02-20 10:57:15 -06:00
|
|
|
// and TyVisitor which are in librustc
|
|
|
|
//fn visit_tydesc(++td: *TyDesc, &&tv: TyVisitor) -> ();
|
2013-02-20 13:41:24 -06:00
|
|
|
// XXX: intrinsic uses legacy modes
|
2013-02-20 10:57:15 -06:00
|
|
|
//fn frame_address(f: &once fn(*u8));
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn morestack_addr() -> *();
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn memmove32(dst: *mut u8, src: *u8, size: u32);
|
|
|
|
pub fn memmove64(dst: *mut u8, src: *u8, size: u64);
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn sqrtf32(x: f32) -> f32;
|
|
|
|
pub fn sqrtf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn powif32(a: f32, x: i32) -> f32;
|
|
|
|
pub fn powif64(a: f64, x: i32) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-04-20 06:58:56 -05:00
|
|
|
// the following kill the stack canary without
|
|
|
|
// `fixed_stack_segment`. This possibly only affects the f64
|
|
|
|
// variants, but it's hard to be sure since it seems to only
|
|
|
|
// occur with fairly specific arguments.
|
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn sinf32(x: f32) -> f32;
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn sinf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn cosf32(x: f32) -> f32;
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn cosf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn powf32(a: f32, x: f32) -> f32;
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn powf64(a: f64, x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn expf32(x: f32) -> f32;
|
2013-04-20 06:58:56 -05:00
|
|
|
#[fixed_stack_segment]
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn expf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn exp2f32(x: f32) -> f32;
|
|
|
|
pub fn exp2f64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn logf32(x: f32) -> f32;
|
|
|
|
pub fn logf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn log10f32(x: f32) -> f32;
|
|
|
|
pub fn log10f64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn log2f32(x: f32) -> f32;
|
|
|
|
pub fn log2f64(x: f64) -> f64;
|
|
|
|
|
|
|
|
pub fn fmaf32(a: f32, b: f32, c: f32) -> f32;
|
|
|
|
pub fn fmaf64(a: f64, b: f64, c: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn fabsf32(x: f32) -> f32;
|
|
|
|
pub fn fabsf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn floorf32(x: f32) -> f32;
|
|
|
|
pub fn floorf64(x: f64) -> f64;
|
|
|
|
|
|
|
|
pub fn ceilf32(x: f32) -> f32;
|
|
|
|
pub fn ceilf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn truncf32(x: f32) -> f32;
|
|
|
|
pub fn truncf64(x: f64) -> f64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn ctpop8(x: i8) -> i8;
|
|
|
|
pub fn ctpop16(x: i16) -> i16;
|
|
|
|
pub fn ctpop32(x: i32) -> i32;
|
|
|
|
pub fn ctpop64(x: i64) -> i64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn ctlz8(x: i8) -> i8;
|
|
|
|
pub fn ctlz16(x: i16) -> i16;
|
|
|
|
pub fn ctlz32(x: i32) -> i32;
|
|
|
|
pub fn ctlz64(x: i64) -> i64;
|
|
|
|
|
|
|
|
pub fn cttz8(x: i8) -> i8;
|
|
|
|
pub fn cttz16(x: i16) -> i16;
|
|
|
|
pub fn cttz32(x: i32) -> i32;
|
|
|
|
pub fn cttz64(x: i64) -> i64;
|
2013-02-20 13:41:24 -06:00
|
|
|
|
2013-02-20 10:57:15 -06:00
|
|
|
pub fn bswap16(x: i16) -> i16;
|
|
|
|
pub fn bswap32(x: i32) -> i32;
|
|
|
|
pub fn bswap64(x: i64) -> i64;
|
|
|
|
}
|