mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-29 20:46:07 +03:00
atomicrmw on pointers: move integer-pointer cast hacks into backend
This commit is contained in:
+12
-12
@@ -969,7 +969,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = amount.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -982,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
let old =
|
||||
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Add, ptr, amount);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_xsub => {
|
||||
@@ -991,7 +991,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = amount.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -1004,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
let old =
|
||||
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Sub, ptr, amount);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_and => {
|
||||
@@ -1013,7 +1013,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = src.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -1025,7 +1025,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::And, ptr, src);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_or => {
|
||||
@@ -1034,7 +1034,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = src.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -1046,7 +1046,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Or, ptr, src);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_xor => {
|
||||
@@ -1055,7 +1055,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = src.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -1067,7 +1067,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Xor, ptr, src);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_nand => {
|
||||
@@ -1076,7 +1076,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let layout = src.layout();
|
||||
match layout.ty.kind() {
|
||||
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
|
||||
ty::Uint(_) | ty::Int(_) => {}
|
||||
_ => {
|
||||
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
|
||||
return Ok(());
|
||||
@@ -1088,7 +1088,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
|
||||
|
||||
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Nand, ptr, src);
|
||||
|
||||
let old = CValue::by_val(old, layout);
|
||||
let old = CValue::by_val(old, ret.layout());
|
||||
ret.write_cvalue(fx, old);
|
||||
}
|
||||
sym::atomic_max => {
|
||||
|
||||
Reference in New Issue
Block a user