mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-28 09:44:08 +00:00
Remove sign extension for ty::Int from CValue::const_val
This commit is contained in:
parent
648b634e21
commit
6b54b7c9f4
@ -217,17 +217,13 @@ impl<'tcx> CValue<'tcx> {
|
||||
.iconst(types::I64, (const_val >> 64) as u64 as i64);
|
||||
fx.bcx.ins().iconcat(lsb, msb)
|
||||
}
|
||||
ty::Bool | ty::Char | ty::Uint(_) | ty::Ref(..)
|
||||
ty::Bool | ty::Char | ty::Uint(_) | ty::Int(_) | ty::Ref(..)
|
||||
| ty::RawPtr(..) => {
|
||||
fx
|
||||
.bcx
|
||||
.ins()
|
||||
.iconst(clif_ty, u64::try_from(const_val).expect("uint") as i64)
|
||||
}
|
||||
ty::Int(_) => {
|
||||
let const_val = rustc_middle::mir::interpret::sign_extend(const_val, layout.size);
|
||||
fx.bcx.ins().iconst(clif_ty, i64::try_from(const_val as i128).unwrap())
|
||||
}
|
||||
ty::Float(FloatTy::F32) => {
|
||||
fx.bcx.ins().f32const(Ieee32::with_bits(u32::try_from(const_val).unwrap()))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user