mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
Add unaligned_volatile_{load,store} intrinsics
This commit is contained in:
@@ -823,17 +823,19 @@ fn swap(bcx: &mut FunctionBuilder<'_>, v: Value) -> Value {
|
||||
}
|
||||
};
|
||||
|
||||
volatile_load, (c ptr) {
|
||||
volatile_load | unaligned_volatile_load, (c ptr) {
|
||||
// Cranelift treats loads as volatile by default
|
||||
// FIXME ignore during stack2reg optimization
|
||||
// FIXME correctly handle unaligned_volatile_load
|
||||
let inner_layout =
|
||||
fx.layout_of(ptr.layout().ty.builtin_deref(true).unwrap().ty);
|
||||
let val = CValue::by_ref(Pointer::new(ptr.load_scalar(fx)), inner_layout);
|
||||
ret.write_cvalue(fx, val);
|
||||
};
|
||||
volatile_store, (v ptr, c val) {
|
||||
volatile_store | unaligned_volatile_store, (v ptr, c val) {
|
||||
// Cranelift treats stores as volatile by default
|
||||
// FIXME ignore during stack2reg optimization
|
||||
// FIXME correctly handle unaligned_volatile_store
|
||||
let dest = CPlace::for_ptr(Pointer::new(ptr), val.layout());
|
||||
dest.write_cvalue(fx, val);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user