@@ -812,11 +812,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
812
812
dest. write_cvalue ( fx, val) ;
813
813
}
814
814
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 => {
820
816
intrinsic_args ! ( fx, args => ( ) ; intrinsic) ;
821
817
822
818
let const_val = fx
@@ -875,7 +871,6 @@ fn codegen_regular_intrinsic_call<'tcx>(
875
871
let ptr = ptr. load_scalar ( fx) ;
876
872
877
873
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
879
874
match ty. kind ( ) {
880
875
ty:: Uint ( UintTy :: U128 ) | ty:: Int ( IntTy :: I128 ) => {
881
876
// FIXME implement 128bit atomics
@@ -906,7 +901,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
906
901
let val = CValue :: by_val ( val, fx. layout_of ( ty) ) ;
907
902
ret. write_cvalue ( fx, val) ;
908
903
}
909
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_store" ) => {
904
+ sym :: atomic_store => {
910
905
intrinsic_args ! ( fx, args => ( ptr, val) ; intrinsic) ;
911
906
let ptr = ptr. load_scalar ( fx) ;
912
907
@@ -939,7 +934,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
939
934
940
935
fx. bcx . ins ( ) . atomic_store ( MemFlags :: trusted ( ) , val, ptr) ;
941
936
}
942
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_xchg" ) => {
937
+ sym :: atomic_xchg => {
943
938
intrinsic_args ! ( fx, args => ( ptr, new) ; intrinsic) ;
944
939
let ptr = ptr. load_scalar ( fx) ;
945
940
@@ -960,8 +955,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
960
955
let old = CValue :: by_val ( old, layout) ;
961
956
ret. write_cvalue ( fx, old) ;
962
957
}
963
- _ if intrinsic. as_str ( ) . starts_with ( "atomic_cxchg" ) => {
964
- // both atomic_cxchg_* and atomic_cxchgweak_*
958
+ sym:: atomic_cxchg | sym:: atomic_cxchgweak => {
965
959
intrinsic_args ! ( fx, args => ( ptr, test_old, new) ; intrinsic) ;
966
960
let ptr = ptr. load_scalar ( fx) ;
967
961
@@ -984,7 +978,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
984
978
ret. write_cvalue ( fx, ret_val)
985
979
}
986
980
987
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_xadd" ) => {
981
+ sym :: atomic_xadd => {
988
982
intrinsic_args ! ( fx, args => ( ptr, amount) ; intrinsic) ;
989
983
let ptr = ptr. load_scalar ( fx) ;
990
984
@@ -1006,7 +1000,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1006
1000
let old = CValue :: by_val ( old, layout) ;
1007
1001
ret. write_cvalue ( fx, old) ;
1008
1002
}
1009
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_xsub" ) => {
1003
+ sym :: atomic_xsub => {
1010
1004
intrinsic_args ! ( fx, args => ( ptr, amount) ; intrinsic) ;
1011
1005
let ptr = ptr. load_scalar ( fx) ;
1012
1006
@@ -1028,7 +1022,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1028
1022
let old = CValue :: by_val ( old, layout) ;
1029
1023
ret. write_cvalue ( fx, old) ;
1030
1024
}
1031
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_and" ) => {
1025
+ sym :: atomic_and => {
1032
1026
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1033
1027
let ptr = ptr. load_scalar ( fx) ;
1034
1028
@@ -1049,7 +1043,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1049
1043
let old = CValue :: by_val ( old, layout) ;
1050
1044
ret. write_cvalue ( fx, old) ;
1051
1045
}
1052
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_or" ) => {
1046
+ sym :: atomic_or => {
1053
1047
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1054
1048
let ptr = ptr. load_scalar ( fx) ;
1055
1049
@@ -1070,7 +1064,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1070
1064
let old = CValue :: by_val ( old, layout) ;
1071
1065
ret. write_cvalue ( fx, old) ;
1072
1066
}
1073
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_xor" ) => {
1067
+ sym :: atomic_xor => {
1074
1068
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1075
1069
let ptr = ptr. load_scalar ( fx) ;
1076
1070
@@ -1091,7 +1085,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1091
1085
let old = CValue :: by_val ( old, layout) ;
1092
1086
ret. write_cvalue ( fx, old) ;
1093
1087
}
1094
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_nand" ) => {
1088
+ sym :: atomic_nand => {
1095
1089
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1096
1090
let ptr = ptr. load_scalar ( fx) ;
1097
1091
@@ -1112,7 +1106,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1112
1106
let old = CValue :: by_val ( old, layout) ;
1113
1107
ret. write_cvalue ( fx, old) ;
1114
1108
}
1115
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_max" ) => {
1109
+ sym :: atomic_max => {
1116
1110
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1117
1111
let ptr = ptr. load_scalar ( fx) ;
1118
1112
@@ -1133,7 +1127,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1133
1127
let old = CValue :: by_val ( old, layout) ;
1134
1128
ret. write_cvalue ( fx, old) ;
1135
1129
}
1136
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_umax" ) => {
1130
+ sym :: atomic_umax => {
1137
1131
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1138
1132
let ptr = ptr. load_scalar ( fx) ;
1139
1133
@@ -1154,7 +1148,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1154
1148
let old = CValue :: by_val ( old, layout) ;
1155
1149
ret. write_cvalue ( fx, old) ;
1156
1150
}
1157
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_min" ) => {
1151
+ sym :: atomic_min => {
1158
1152
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1159
1153
let ptr = ptr. load_scalar ( fx) ;
1160
1154
@@ -1175,7 +1169,7 @@ fn codegen_regular_intrinsic_call<'tcx>(
1175
1169
let old = CValue :: by_val ( old, layout) ;
1176
1170
ret. write_cvalue ( fx, old) ;
1177
1171
}
1178
- _ if intrinsic . as_str ( ) . starts_with ( " atomic_umin" ) => {
1172
+ sym :: atomic_umin => {
1179
1173
intrinsic_args ! ( fx, args => ( ptr, src) ; intrinsic) ;
1180
1174
let ptr = ptr. load_scalar ( fx) ;
1181
1175
0 commit comments