Sync rustc_codegen_cranelift 'ddd4ce2553
'
This commit is contained in:
commit
505aa48f24
43 changed files with 784 additions and 1243 deletions
|
@ -11,6 +11,22 @@ unsafe extern "C" fn my_puts(s: *const i8) {
|
|||
puts(s);
|
||||
}
|
||||
|
||||
macro_rules! assert {
|
||||
($e:expr) => {
|
||||
if !$e {
|
||||
panic(stringify!(! $e));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! assert_eq {
|
||||
($l:expr, $r: expr) => {
|
||||
if $l != $r {
|
||||
panic(stringify!($l != $r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[lang = "termination"]
|
||||
trait Termination {
|
||||
fn report(self) -> i32;
|
||||
|
@ -20,8 +36,9 @@ impl Termination for () {
|
|||
fn report(self) -> i32 {
|
||||
unsafe {
|
||||
NUM = 6 * 7 + 1 + (1u8 == 1u8) as u8; // 44
|
||||
*NUM_REF as i32
|
||||
assert_eq!(*NUM_REF as i32, 44);
|
||||
}
|
||||
0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,29 +99,12 @@ fn start<T: Termination + 'static>(
|
|||
unsafe { puts(*((argv as usize + 2 * intrinsics::size_of::<*const u8>()) as *const *const i8)); }
|
||||
}
|
||||
|
||||
main().report();
|
||||
0
|
||||
main().report() as isize
|
||||
}
|
||||
|
||||
static mut NUM: u8 = 6 * 7;
|
||||
static NUM_REF: &'static u8 = unsafe { &NUM };
|
||||
|
||||
macro_rules! assert {
|
||||
($e:expr) => {
|
||||
if !$e {
|
||||
panic(stringify!(! $e));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
macro_rules! assert_eq {
|
||||
($l:expr, $r: expr) => {
|
||||
if $l != $r {
|
||||
panic(stringify!($l != $r));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct Unique<T: ?Sized> {
|
||||
pointer: *const T,
|
||||
_marker: PhantomData<T>,
|
||||
|
@ -296,6 +296,11 @@ fn main() {
|
|||
unsafe {
|
||||
global_asm_test();
|
||||
}
|
||||
|
||||
// Both statics have a reference that points to the same anonymous allocation.
|
||||
static REF1: &u8 = &42;
|
||||
static REF2: &u8 = REF1;
|
||||
assert_eq!(*REF1, *REF2);
|
||||
}
|
||||
|
||||
#[cfg(all(not(jit), target_os = "linux"))]
|
||||
|
|
|
@ -48,6 +48,8 @@ fn main() {
|
|||
assert_eq!(2.3f32.copysign(-1.0), -2.3f32);
|
||||
println!("{}", 2.3f32.powf(2.0));
|
||||
|
||||
assert_eq!(i64::MAX.checked_mul(2), None);
|
||||
|
||||
assert_eq!(-128i8, (-128i8).saturating_sub(1));
|
||||
assert_eq!(127i8, 127i8.saturating_sub(-128));
|
||||
assert_eq!(-128i8, (-128i8).saturating_add(-128));
|
||||
|
@ -84,6 +86,7 @@ fn main() {
|
|||
assert_eq!(houndred_i128 as f64, 100.0);
|
||||
assert_eq!(houndred_f32 as i128, 100);
|
||||
assert_eq!(houndred_f64 as i128, 100);
|
||||
assert_eq!(1u128.rotate_left(2), 4);
|
||||
|
||||
// Test signed 128bit comparing
|
||||
let max = usize::MAX as i128;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue