@@ -76,20 +76,22 @@ pub(crate) fn maybe_codegen_mul_checked<'tcx>(
7676    } 
7777
7878    let  is_signed = type_sign ( lhs. layout ( ) . ty ) ; 
79- 
80-     let  out_ty = Ty :: new_tup ( fx. tcx ,  & [ lhs. layout ( ) . ty ,  fx. tcx . types . bool ] ) ; 
81-     let  out_place = CPlace :: new_stack_slot ( fx,  fx. layout_of ( out_ty) ) ; 
79+     let  oflow_out_place = CPlace :: new_stack_slot ( fx,  fx. layout_of ( fx. tcx . types . i32 ) ) ; 
8280    let  param_types = vec ! [ 
83-         AbiParam :: special( fx. pointer_type,  ArgumentPurpose :: StructReturn ) , 
8481        AbiParam :: new( types:: I128 ) , 
8582        AbiParam :: new( types:: I128 ) , 
83+         AbiParam :: special( fx. pointer_type,  ArgumentPurpose :: Normal ) , 
8684    ] ; 
87-     let  args = [ out_place . to_ptr ( ) . get_addr ( fx) ,  lhs . load_scalar ( fx) ,  rhs . load_scalar ( fx) ] ; 
88-     fx. lib_call ( 
85+     let  args = [ lhs . load_scalar ( fx) ,  rhs . load_scalar ( fx) ,  oflow_out_place . to_ptr ( ) . get_addr ( fx) ] ; 
86+     let  ret =  fx. lib_call ( 
8987        if  is_signed {  "__rust_i128_mulo"  }  else  {  "__rust_u128_mulo"  } , 
9088        param_types, 
91-         vec ! [ ] , 
89+         vec ! [ AbiParam :: new ( types :: I128 ) ] , 
9290        & args, 
9391    ) ; 
94-     Some ( out_place. to_cvalue ( fx) ) 
92+     let  mul = ret[ 0 ] ; 
93+     let  oflow = oflow_out_place. to_cvalue ( fx) . load_scalar ( fx) ; 
94+     let  oflow = clif_intcast ( fx,  oflow,  types:: I8 ,  false ) ; 
95+     let  layout = fx. layout_of ( Ty :: new_tup ( fx. tcx ,  & [ lhs. layout ( ) . ty ,  fx. tcx . types . bool ] ) ) ; 
96+     Some ( CValue :: by_val_pair ( mul,  oflow,  layout) ) 
9597} 
0 commit comments