From 2e5774320196b864516b15a84fac142eadaeccfe Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 4 Feb 2017 03:23:53 +0100 Subject: [PATCH 1/2] Unignore some tests on stage 0 and 1 thanks to beta update --- src/test/run-pass/i128-ffi.rs | 3 --- src/test/run-pass/i128.rs | 3 --- src/test/run-pass/issue-38987.rs | 5 +---- src/test/run-pass/u128.rs | 3 --- 4 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/test/run-pass/i128-ffi.rs b/src/test/run-pass/i128-ffi.rs index 222f32754fb6b..473f1cc2301dc 100644 --- a/src/test/run-pass/i128-ffi.rs +++ b/src/test/run-pass/i128-ffi.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-stage0 -// ignore-stage1 - // MSVC doesn't support 128 bit integers, and other Windows // C compilers have very inconsistent views on how the ABI // should look like. diff --git a/src/test/run-pass/i128.rs b/src/test/run-pass/i128.rs index 3eb1c95050267..dc4f0774b9771 100644 --- a/src/test/run-pass/i128.rs +++ b/src/test/run-pass/i128.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-stage0 -// ignore-stage1 - // ignore-emscripten #![feature(i128_type, test)] diff --git a/src/test/run-pass/issue-38987.rs b/src/test/run-pass/issue-38987.rs index 29e96c162b8de..6a108a172e502 100644 --- a/src/test/run-pass/issue-38987.rs +++ b/src/test/run-pass/issue-38987.rs @@ -7,11 +7,8 @@ // , at your // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(i128_type)] -// SNAP: run on all stages after snapshot, i128 currently doesn't work on stages 0 and 1 -// ignore-stage1 -// ignore-stage0 +#![feature(i128_type)] fn main() { let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; diff --git a/src/test/run-pass/u128.rs b/src/test/run-pass/u128.rs index 139d42e3a3524..ac3dfcdfde155 100644 --- a/src/test/run-pass/u128.rs +++ b/src/test/run-pass/u128.rs @@ -8,9 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-stage0 -// ignore-stage1 - // ignore-emscripten #![feature(i128_type, test)] From 98bbf7d551a07d23c288efc11c9a029602abccb0 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 4 Feb 2017 05:02:22 +0100 Subject: [PATCH 2/2] Remove some i128 related hacks that were required for bootstrap --- src/libcompiler_builtins/lib.rs | 6 ++---- src/librustc_const_eval/eval.rs | 7 ++----- src/librustc_const_math/int.rs | 6 ++---- src/librustc_trans/common.rs | 11 +++-------- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/src/libcompiler_builtins/lib.rs b/src/libcompiler_builtins/lib.rs index b2a615456aa59..5ed497f6159b0 100644 --- a/src/libcompiler_builtins/lib.rs +++ b/src/libcompiler_builtins/lib.rs @@ -544,8 +544,7 @@ pub mod reimpls { const MD1 : u32 = MANTISSA_DIGITS + 1; const MD2 : u32 = MANTISSA_DIGITS + 2; - // SNAP: replace this with !0u128 - let negn :u128 = !0; + let negn = !0u128; if sd > MANTISSA_DIGITS { a = match sd { @@ -579,8 +578,7 @@ pub mod reimpls { const MD1 : u32 = MANTISSA_DIGITS + 1; const MD2 : u32 = MANTISSA_DIGITS + 2; - // SNAP: replace this with !0u128 - let negn :u128 = !0; + let negn = !0u128; if sd > MANTISSA_DIGITS { a = match sd { diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs index e2e76cdfb6ebd..3e2b9d1809335 100644 --- a/src/librustc_const_eval/eval.rs +++ b/src/librustc_const_eval/eval.rs @@ -483,11 +483,8 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>, return Ok(Integral(I64(i64::min_value()))) }, (&LitKind::Int(n, _), Some(&ty::TyInt(IntTy::I128))) | - (&LitKind::Int(n, Signed(IntTy::I128)), _) => { - // SNAP: replace n in pattern with I128_OVERFLOW and remove this if. - if n == I128_OVERFLOW { - return Ok(Integral(I128(i128::min_value()))) - } + (&LitKind::Int(I128_OVERFLOW, Signed(IntTy::I128)), _) => { + return Ok(Integral(I128(i128::min_value()))) }, (&LitKind::Int(n, _), Some(&ty::TyInt(IntTy::Is))) | (&LitKind::Int(n, Signed(IntTy::Is)), _) => { diff --git a/src/librustc_const_math/int.rs b/src/librustc_const_math/int.rs index 3618bfa20811f..17714f2fb2d6c 100644 --- a/src/librustc_const_math/int.rs +++ b/src/librustc_const_math/int.rs @@ -155,13 +155,11 @@ impl ConstInt { (InferSigned(a @ 0...ibounds::U8MAX), U8(_)) => U8(a as u8), (InferSigned(a @ 0...ibounds::U16MAX), U16(_)) => U16(a as u16), (InferSigned(a @ 0...ibounds::U32MAX), U32(_)) => U32(a as u32), - // SNAP: replace with U64MAX - (InferSigned(a @ 0...ibounds::I64MAX), U64(_)) => U64(a as u64), + (InferSigned(a @ 0...ibounds::U64MAX), U64(_)) => U64(a as u64), (InferSigned(a @ 0...ibounds::I128MAX), U128(_)) => U128(a as u128), (InferSigned(a @ 0...ibounds::U16MAX), Usize(Us16(_))) => Usize(Us16(a as u16)), (InferSigned(a @ 0...ibounds::U32MAX), Usize(Us32(_))) => Usize(Us32(a as u32)), - // SNAP: replace with U64MAX - (InferSigned(a @ 0...ibounds::I64MAX), Usize(Us64(_))) => Usize(Us64(a as u64)), + (InferSigned(a @ 0...ibounds::U64MAX), Usize(Us64(_))) => Usize(Us64(a as u64)), (InferSigned(_), _) => return Err(ConstMathErr::NotInRange), _ => self, // already known types }; diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs index 01b2aeef004db..e5a92b6386807 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_trans/common.rs @@ -230,14 +230,9 @@ pub fn C_integral(t: Type, u: u64, sign_extend: bool) -> ValueRef { } pub fn C_big_integral(t: Type, u: u128, sign_extend: bool) -> ValueRef { - if ::std::mem::size_of::() == 16 { - unsafe { - let words = [u as u64, u.wrapping_shr(64) as u64]; - llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr()) - } - } else { - // SNAP: remove after snapshot - C_integral(t, u as u64, sign_extend) + unsafe { + let words = [u as u64, u.wrapping_shr(64) as u64]; + llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr()) } }