Rustup to rustc 1.31.0-nightly (de3d640f5 2018-10-01), fix a atomic bug and implement intrinsic bitreverse

This commit is contained in:
bjorn3 2018-10-02 18:12:03 +02:00
parent 69fe4d6f92
commit fce5fa5231
2 changed files with 8 additions and 14 deletions

View file

@ -51,17 +51,5 @@ index 5d00949..f077f1d 100644
}
}
@@ -2295,7 +2297,9 @@ assert_eq!(m, ", $reversed, ");
#[unstable(feature = "reverse_bits", issue = "48763")]
#[rustc_const_unstable(feature = "const_int_conversion")]
#[inline]
#[cfg(not(stage0))]
pub const fn reverse_bits(self) -> Self {
- unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
+ // TODO support bitreverse
+ //unsafe { intrinsics::bitreverse(self as $ActualT) as Self }
+ 0
}
}
--
2.11.0

View file

@ -853,6 +853,12 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
let res = CValue::ByVal(fx.bcx.ins().popcnt(arg), args[0].layout());
ret.write_cvalue(fx, res);
}
"bitreverse" => {
assert_eq!(args.len(), 1);
let arg = args[0].load_value(fx);
let res = CValue::ByVal(fx.bcx.ins().bitrev(arg), args[0].layout());
ret.write_cvalue(fx, res);
}
"needs_drop" => {
assert_eq!(args.len(), 0);
let ty = substs.type_at(0);
@ -884,7 +890,7 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
let amount = args[1].load_value(fx);
let old = fx.bcx.ins().load(clif_ty, MemFlags::new(), ptr, 0);
let new = fx.bcx.ins().iadd(old, amount);
fx.bcx.ins().store(MemFlags::new(), ptr, new, 0);
fx.bcx.ins().store(MemFlags::new(), new, ptr, 0);
ret.write_cvalue(fx, CValue::ByVal(old, fx.layout_of(substs.type_at(0))));
}
_ if intrinsic.starts_with("atomic_xsub") => {
@ -894,7 +900,7 @@ fn codegen_intrinsic_call<'a, 'tcx: 'a>(
let amount = args[1].load_value(fx);
let old = fx.bcx.ins().load(clif_ty, MemFlags::new(), ptr, 0);
let new = fx.bcx.ins().isub(old, amount);
fx.bcx.ins().store(MemFlags::new(), ptr, new, 0);
fx.bcx.ins().store(MemFlags::new(), new, ptr, 0);
ret.write_cvalue(fx, CValue::ByVal(old, fx.layout_of(substs.type_at(0))));
}
_ => unimpl!("unsupported intrinsic {}", intrinsic),