@@ -5499,14 +5499,24 @@ pub const FuncGen = struct {
5499
5499
5500
5500
const lhs_ty = self .air .typeOf (extra .lhs );
5501
5501
const scalar_ty = lhs_ty .scalarType ();
5502
+ const dest_ty = self .air .typeOfIndex (inst );
5502
5503
5503
5504
const intrinsic_name = if (scalar_ty .isSignedInt ()) signed_intrinsic else unsigned_intrinsic ;
5504
5505
5505
5506
const llvm_lhs_ty = try self .dg .llvmType (lhs_ty );
5507
+ const llvm_dest_ty = try self .dg .llvmType (dest_ty );
5508
+
5509
+ const tg = self .dg .module .getTarget ();
5506
5510
5507
5511
const llvm_fn = self .getIntrinsic (intrinsic_name , &.{llvm_lhs_ty });
5508
5512
const result_struct = self .builder .buildCall (llvm_fn , &[_ ]* const llvm.Value { lhs , rhs }, 2 , .Fast , .Auto , "" );
5509
- return result_struct ;
5513
+
5514
+ const result = self .builder .buildExtractValue (result_struct , 0 , "" );
5515
+ const overflow_bit = self .builder .buildExtractValue (result_struct , 1 , "" );
5516
+
5517
+ var ty_buf : Type.Payload.Pointer = undefined ;
5518
+ const partial = self .builder .buildInsertValue (llvm_dest_ty .getUndef (), result , llvmFieldIndex (dest_ty , 0 , tg , & ty_buf ).? , "" );
5519
+ return self .builder .buildInsertValue (partial , overflow_bit , llvmFieldIndex (dest_ty , 1 , tg , & ty_buf ).? , "" );
5510
5520
}
5511
5521
5512
5522
fn airMulAdd (self : * FuncGen , inst : Air.Inst.Index ) ! ? * const llvm.Value {
0 commit comments