@@ -23,19 +23,7 @@ pub(crate) fn maybe_codegen<'tcx>(
23
23
match bin_op {
24
24
BinOp :: BitAnd | BinOp :: BitOr | BinOp :: BitXor => None ,
25
25
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 ,
39
27
BinOp :: Offset => unreachable ! ( "offset should only be used on pointers, not 128bit ints" ) ,
40
28
BinOp :: Div | BinOp :: Rem => {
41
29
let name = match ( bin_op, is_signed) {
@@ -92,6 +80,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
92
80
93
81
match bin_op {
94
82
BinOp :: BitAnd | BinOp :: BitOr | BinOp :: BitXor => unreachable ! ( ) ,
83
+ BinOp :: Add | BinOp :: Sub => None ,
95
84
BinOp :: Mul if is_signed => {
96
85
let out_ty = Ty :: new_tup ( fx. tcx , & [ lhs. layout ( ) . ty , fx. tcx . types . bool ] ) ;
97
86
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>(
112
101
let oflow = fx. bcx . ins ( ) . ireduce ( types:: I8 , oflow) ;
113
102
Some ( CValue :: by_val_pair ( res, oflow, fx. layout_of ( out_ty) ) )
114
103
}
115
- BinOp :: Add | BinOp :: Sub | BinOp :: Mul => {
104
+ BinOp :: Mul => {
116
105
let out_ty = Ty :: new_tup ( fx. tcx , & [ lhs. layout ( ) . ty , fx. tcx . types . bool ] ) ;
117
106
let out_place = CPlace :: new_stack_slot ( fx, fx. layout_of ( out_ty) ) ;
118
107
let param_types = vec ! [
@@ -121,15 +110,7 @@ pub(crate) fn maybe_codegen_checked<'tcx>(
121
110
AbiParam :: new( types:: I128 ) ,
122
111
] ;
123
112
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) ;
133
114
Some ( out_place. to_cvalue ( fx) )
134
115
}
135
116
BinOp :: AddUnchecked | BinOp :: SubUnchecked | BinOp :: MulUnchecked => unreachable ! ( ) ,
0 commit comments