Rollup merge of #39519 - nagisa:more-snap, r=alexcrichton
More snap cleanup r? @alexcrichton
This commit is contained in:
commit
13b8e4b416
@ -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 {
|
||||
|
@ -482,12 +482,9 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>,
|
||||
(&LitKind::Int(I64_OVERFLOW, Signed(IntTy::I64)), _) => {
|
||||
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, _), Some(&ty::TyInt(IntTy::I128))) |
|
||||
(&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)), _) => {
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -229,15 +229,10 @@ 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::<u128>() == 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)
|
||||
pub fn C_big_integral(t: Type, u: u128) -> ValueRef {
|
||||
unsafe {
|
||||
let words = [u as u64, u.wrapping_shr(64) as u64];
|
||||
llvm::LLVMConstIntOfArbitraryPrecision(t.to_ref(), 2, words.as_ptr())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ impl<'tcx> Const<'tcx> {
|
||||
ConstVal::Integral(I16(v)) => C_integral(Type::i16(ccx), v as u64, true),
|
||||
ConstVal::Integral(I32(v)) => C_integral(Type::i32(ccx), v as u64, true),
|
||||
ConstVal::Integral(I64(v)) => C_integral(Type::i64(ccx), v as u64, true),
|
||||
ConstVal::Integral(I128(v)) => C_big_integral(Type::i128(ccx), v as u128, true),
|
||||
ConstVal::Integral(I128(v)) => C_big_integral(Type::i128(ccx), v as u128),
|
||||
ConstVal::Integral(Isize(v)) => {
|
||||
let i = v.as_i64(ccx.tcx().sess.target.int_type);
|
||||
C_integral(Type::int(ccx), i as u64, true)
|
||||
@ -84,7 +84,7 @@ impl<'tcx> Const<'tcx> {
|
||||
ConstVal::Integral(U16(v)) => C_integral(Type::i16(ccx), v as u64, false),
|
||||
ConstVal::Integral(U32(v)) => C_integral(Type::i32(ccx), v as u64, false),
|
||||
ConstVal::Integral(U64(v)) => C_integral(Type::i64(ccx), v, false),
|
||||
ConstVal::Integral(U128(v)) => C_big_integral(Type::i128(ccx), v, false),
|
||||
ConstVal::Integral(U128(v)) => C_big_integral(Type::i128(ccx), v),
|
||||
ConstVal::Integral(Usize(v)) => {
|
||||
let u = v.as_u64(ccx.tcx().sess.target.uint_type);
|
||||
C_integral(Type::int(ccx), u, false)
|
||||
|
@ -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.
|
||||
|
@ -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)]
|
||||
|
@ -9,10 +9,6 @@
|
||||
// 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
|
||||
|
||||
fn main() {
|
||||
let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user