Skip to content

Commit 047a106

Browse files
committed
Sync from rust e703dff
2 parents 30c48bc + d5e9833 commit 047a106

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

src/intrinsics/mod.rs

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -812,11 +812,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
812812
dest.write_cvalue(fx, val);
813813
}
814814

815-
sym::pref_align_of
816-
| sym::needs_drop
817-
| sym::type_id
818-
| sym::type_name
819-
| sym::variant_count => {
815+
sym::needs_drop | sym::type_id | sym::type_name | sym::variant_count => {
820816
intrinsic_args!(fx, args => (); intrinsic);
821817

822818
let const_val = fx
@@ -875,7 +871,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
875871
let ptr = ptr.load_scalar(fx);
876872

877873
let ty = generic_args.type_at(0);
878-
let _ord = generic_args.const_at(1).to_value(); // FIXME: forward this to cranelift once they support that
879874
match ty.kind() {
880875
ty::Uint(UintTy::U128) | ty::Int(IntTy::I128) => {
881876
// FIXME implement 128bit atomics
@@ -906,7 +901,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
906901
let val = CValue::by_val(val, fx.layout_of(ty));
907902
ret.write_cvalue(fx, val);
908903
}
909-
_ if intrinsic.as_str().starts_with("atomic_store") => {
904+
sym::atomic_store => {
910905
intrinsic_args!(fx, args => (ptr, val); intrinsic);
911906
let ptr = ptr.load_scalar(fx);
912907

@@ -939,7 +934,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
939934

940935
fx.bcx.ins().atomic_store(MemFlags::trusted(), val, ptr);
941936
}
942-
_ if intrinsic.as_str().starts_with("atomic_xchg") => {
937+
sym::atomic_xchg => {
943938
intrinsic_args!(fx, args => (ptr, new); intrinsic);
944939
let ptr = ptr.load_scalar(fx);
945940

@@ -960,8 +955,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
960955
let old = CValue::by_val(old, layout);
961956
ret.write_cvalue(fx, old);
962957
}
963-
_ if intrinsic.as_str().starts_with("atomic_cxchg") => {
964-
// both atomic_cxchg_* and atomic_cxchgweak_*
958+
sym::atomic_cxchg | sym::atomic_cxchgweak => {
965959
intrinsic_args!(fx, args => (ptr, test_old, new); intrinsic);
966960
let ptr = ptr.load_scalar(fx);
967961

@@ -984,7 +978,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
984978
ret.write_cvalue(fx, ret_val)
985979
}
986980

987-
_ if intrinsic.as_str().starts_with("atomic_xadd") => {
981+
sym::atomic_xadd => {
988982
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
989983
let ptr = ptr.load_scalar(fx);
990984

@@ -1006,7 +1000,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10061000
let old = CValue::by_val(old, layout);
10071001
ret.write_cvalue(fx, old);
10081002
}
1009-
_ if intrinsic.as_str().starts_with("atomic_xsub") => {
1003+
sym::atomic_xsub => {
10101004
intrinsic_args!(fx, args => (ptr, amount); intrinsic);
10111005
let ptr = ptr.load_scalar(fx);
10121006

@@ -1028,7 +1022,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10281022
let old = CValue::by_val(old, layout);
10291023
ret.write_cvalue(fx, old);
10301024
}
1031-
_ if intrinsic.as_str().starts_with("atomic_and") => {
1025+
sym::atomic_and => {
10321026
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10331027
let ptr = ptr.load_scalar(fx);
10341028

@@ -1049,7 +1043,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10491043
let old = CValue::by_val(old, layout);
10501044
ret.write_cvalue(fx, old);
10511045
}
1052-
_ if intrinsic.as_str().starts_with("atomic_or") => {
1046+
sym::atomic_or => {
10531047
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10541048
let ptr = ptr.load_scalar(fx);
10551049

@@ -1070,7 +1064,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10701064
let old = CValue::by_val(old, layout);
10711065
ret.write_cvalue(fx, old);
10721066
}
1073-
_ if intrinsic.as_str().starts_with("atomic_xor") => {
1067+
sym::atomic_xor => {
10741068
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10751069
let ptr = ptr.load_scalar(fx);
10761070

@@ -1091,7 +1085,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
10911085
let old = CValue::by_val(old, layout);
10921086
ret.write_cvalue(fx, old);
10931087
}
1094-
_ if intrinsic.as_str().starts_with("atomic_nand") => {
1088+
sym::atomic_nand => {
10951089
intrinsic_args!(fx, args => (ptr, src); intrinsic);
10961090
let ptr = ptr.load_scalar(fx);
10971091

@@ -1112,7 +1106,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11121106
let old = CValue::by_val(old, layout);
11131107
ret.write_cvalue(fx, old);
11141108
}
1115-
_ if intrinsic.as_str().starts_with("atomic_max") => {
1109+
sym::atomic_max => {
11161110
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11171111
let ptr = ptr.load_scalar(fx);
11181112

@@ -1133,7 +1127,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11331127
let old = CValue::by_val(old, layout);
11341128
ret.write_cvalue(fx, old);
11351129
}
1136-
_ if intrinsic.as_str().starts_with("atomic_umax") => {
1130+
sym::atomic_umax => {
11371131
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11381132
let ptr = ptr.load_scalar(fx);
11391133

@@ -1154,7 +1148,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11541148
let old = CValue::by_val(old, layout);
11551149
ret.write_cvalue(fx, old);
11561150
}
1157-
_ if intrinsic.as_str().starts_with("atomic_min") => {
1151+
sym::atomic_min => {
11581152
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11591153
let ptr = ptr.load_scalar(fx);
11601154

@@ -1175,7 +1169,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
11751169
let old = CValue::by_val(old, layout);
11761170
ret.write_cvalue(fx, old);
11771171
}
1178-
_ if intrinsic.as_str().starts_with("atomic_umin") => {
1172+
sym::atomic_umin => {
11791173
intrinsic_args!(fx, args => (ptr, src); intrinsic);
11801174
let ptr = ptr.load_scalar(fx);
11811175

0 commit comments

Comments
 (0)