@@ -23,19 +23,7 @@ pub(crate) fn maybe_codegen<'tcx>(
2323 match bin_op {
2424 BinOp :: BitAnd | BinOp :: BitOr | BinOp :: BitXor => None ,
2525 BinOp :: Add | BinOp :: AddUnchecked | BinOp :: Sub | BinOp :: SubUnchecked => None ,
26- BinOp :: Mul | BinOp :: MulUnchecked => {
27- let args = [ lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ;
28- let ret_val = fx. lib_call (
29- "__multi3" ,
30- vec ! [ AbiParam :: new( types:: I128 ) , AbiParam :: new( types:: I128 ) ] ,
31- vec ! [ AbiParam :: new( types:: I128 ) ] ,
32- & args,
33- ) [ 0 ] ;
34- Some ( CValue :: by_val (
35- ret_val,
36- fx. layout_of ( if is_signed { fx. tcx . types . i128 } else { fx. tcx . types . u128 } ) ,
37- ) )
38- }
26+ BinOp :: Mul | BinOp :: MulUnchecked => None ,
3927 BinOp :: Offset => unreachable ! ( "offset should only be used on pointers, not 128bit ints" ) ,
4028 BinOp :: Div | BinOp :: Rem => {
4129 let name = match ( bin_op, is_signed) {
@@ -92,6 +80,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
9280
9381 match bin_op {
9482 BinOp :: BitAnd | BinOp :: BitOr | BinOp :: BitXor => unreachable ! ( ) ,
83+ BinOp :: Add | BinOp :: Sub => None ,
9584 BinOp :: Mul if is_signed => {
9685 let out_ty = Ty :: new_tup ( fx. tcx , & [ lhs. layout ( ) . ty , fx. tcx . types . bool ] ) ;
9786 let oflow = CPlace :: new_stack_slot ( fx, fx. layout_of ( fx. tcx . types . i32 ) ) ;
@@ -112,7 +101,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
112101 let oflow = fx. bcx . ins ( ) . ireduce ( types:: I8 , oflow) ;
113102 Some ( CValue :: by_val_pair ( res, oflow, fx. layout_of ( out_ty) ) )
114103 }
115- BinOp :: Add | BinOp :: Sub | BinOp :: Mul => {
104+ BinOp :: Mul => {
116105 let out_ty = Ty :: new_tup ( fx. tcx , & [ lhs. layout ( ) . ty , fx. tcx . types . bool ] ) ;
117106 let out_place = CPlace :: new_stack_slot ( fx, fx. layout_of ( out_ty) ) ;
118107 let param_types = vec ! [
@@ -121,15 +110,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
121110 AbiParam :: new( types:: I128 ) ,
122111 ] ;
123112 let args = [ out_place. to_ptr ( ) . get_addr ( fx) , lhs. load_scalar ( fx) , rhs. load_scalar ( fx) ] ;
124- let name = match ( bin_op, is_signed) {
125- ( BinOp :: Add , false ) => "__rust_u128_addo" ,
126- ( BinOp :: Add , true ) => "__rust_i128_addo" ,
127- ( BinOp :: Sub , false ) => "__rust_u128_subo" ,
128- ( BinOp :: Sub , true ) => "__rust_i128_subo" ,
129- ( BinOp :: Mul , false ) => "__rust_u128_mulo" ,
130- _ => unreachable ! ( ) ,
131- } ;
132- fx. lib_call ( name, param_types, vec ! [ ] , & args) ;
113+ fx. lib_call ( "__rust_u128_mulo" , param_types, vec ! [ ] , & args) ;
133114 Some ( out_place. to_cvalue ( fx) )
134115 }
135116 BinOp :: AddUnchecked | BinOp :: SubUnchecked | BinOp :: MulUnchecked => unreachable ! ( ) ,
0 commit comments