| ... | ... | @@ -5605,14 +5605,24 @@ pub const FuncGen = struct { |
| 5605 | 5605 | |
| 5606 | 5606 | const lhs_ty = self.air.typeOf(extra.lhs); |
| 5607 | 5607 | const scalar_ty = lhs_ty.scalarType(); |
| 5608 | const dest_ty = self.air.typeOfIndex(inst); |
| 5608 | 5609 | |
| 5609 | 5610 | const intrinsic_name = if (scalar_ty.isSignedInt()) signed_intrinsic else unsigned_intrinsic; |
| 5610 | 5611 | |
| 5611 | 5612 | const llvm_lhs_ty = try self.dg.llvmType(lhs_ty); |
| 5613 | const llvm_dest_ty = try self.dg.llvmType(dest_ty); |
| 5614 | |
| 5615 | const tg = self.dg.module.getTarget(); |
| 5612 | 5616 | |
| 5613 | 5617 | const llvm_fn = self.getIntrinsic(intrinsic_name, &.{llvm_lhs_ty}); |
| 5614 | 5618 | const result_struct = self.builder.buildCall(llvm_fn, &[_]*const llvm.Value{ lhs, rhs }, 2, .Fast, .Auto, ""); |
| 5615 | | return result_struct; |
| 5619 | |
| 5620 | const result = self.builder.buildExtractValue(result_struct, 0, ""); |
| 5621 | const overflow_bit = self.builder.buildExtractValue(result_struct, 1, ""); |
| 5622 | |
| 5623 | var ty_buf: Type.Payload.Pointer = undefined; |
| 5624 | const partial = self.builder.buildInsertValue(llvm_dest_ty.getUndef(), result, llvmFieldIndex(dest_ty, 0, tg, &ty_buf).?, ""); |
| 5625 | return self.builder.buildInsertValue(partial, overflow_bit, llvmFieldIndex(dest_ty, 1, tg, &ty_buf).?, ""); |
| 5616 | 5626 | } |
| 5617 | 5627 | |
| 5618 | 5628 | fn buildElementwiseCall( |