Skip to content

Commit 66503c1

Browse files
committed
atomicrmw on pointers: move integer-pointer cast hacks into backend
1 parent 7fa8429 commit 66503c1

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/intrinsics/mod.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
969969

970970
let layout = amount.layout();
971971
match layout.ty.kind() {
972-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
972+
ty::Uint(_) | ty::Int(_) => {}
973973
_ => {
974974
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
975975
return Ok(());
@@ -982,7 +982,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
982982
let old =
983983
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Add, ptr, amount);
984984

985-
let old = CValue::by_val(old, layout);
985+
let old = CValue::by_val(old, ret.layout());
986986
ret.write_cvalue(fx, old);
987987
}
988988
sym::atomic_xsub => {
@@ -991,7 +991,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
991991

992992
let layout = amount.layout();
993993
match layout.ty.kind() {
994-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
994+
ty::Uint(_) | ty::Int(_) => {}
995995
_ => {
996996
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
997997
return Ok(());
@@ -1004,7 +1004,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10041004
let old =
10051005
fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Sub, ptr, amount);
10061006

1007-
let old = CValue::by_val(old, layout);
1007+
let old = CValue::by_val(old, ret.layout());
10081008
ret.write_cvalue(fx, old);
10091009
}
10101010
sym::atomic_and => {
@@ -1013,7 +1013,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10131013

10141014
let layout = src.layout();
10151015
match layout.ty.kind() {
1016-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1016+
ty::Uint(_) | ty::Int(_) => {}
10171017
_ => {
10181018
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10191019
return Ok(());
@@ -1025,7 +1025,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10251025

10261026
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::And, ptr, src);
10271027

1028-
let old = CValue::by_val(old, layout);
1028+
let old = CValue::by_val(old, ret.layout());
10291029
ret.write_cvalue(fx, old);
10301030
}
10311031
sym::atomic_or => {
@@ -1034,7 +1034,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10341034

10351035
let layout = src.layout();
10361036
match layout.ty.kind() {
1037-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1037+
ty::Uint(_) | ty::Int(_) => {}
10381038
_ => {
10391039
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10401040
return Ok(());
@@ -1046,7 +1046,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10461046

10471047
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Or, ptr, src);
10481048

1049-
let old = CValue::by_val(old, layout);
1049+
let old = CValue::by_val(old, ret.layout());
10501050
ret.write_cvalue(fx, old);
10511051
}
10521052
sym::atomic_xor => {
@@ -1055,7 +1055,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10551055

10561056
let layout = src.layout();
10571057
match layout.ty.kind() {
1058-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1058+
ty::Uint(_) | ty::Int(_) => {}
10591059
_ => {
10601060
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10611061
return Ok(());
@@ -1067,7 +1067,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10671067

10681068
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Xor, ptr, src);
10691069

1070-
let old = CValue::by_val(old, layout);
1070+
let old = CValue::by_val(old, ret.layout());
10711071
ret.write_cvalue(fx, old);
10721072
}
10731073
sym::atomic_nand => {
@@ -1076,7 +1076,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10761076

10771077
let layout = src.layout();
10781078
match layout.ty.kind() {
1079-
ty::Uint(_) | ty::Int(_) | ty::RawPtr(..) => {}
1079+
ty::Uint(_) | ty::Int(_) => {}
10801080
_ => {
10811081
report_atomic_type_validation_error(fx, intrinsic, source_info.span, layout.ty);
10821082
return Ok(());
@@ -1088,7 +1088,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10881088

10891089
let old = fx.bcx.ins().atomic_rmw(ty, MemFlags::trusted(), AtomicRmwOp::Nand, ptr, src);
10901090

1091-
let old = CValue::by_val(old, layout);
1091+
let old = CValue::by_val(old, ret.layout());
10921092
ret.write_cvalue(fx, old);
10931093
}
10941094
sym::atomic_max => {

0 commit comments

Comments
 (0)