| ... | @@ -5189,14 +5189,12 @@ pub const FuncGen = struct { | ... | @@ -5189,14 +5189,12 @@ pub const FuncGen = struct { |
| 5189 | if (self.liveness.isUnused(inst)) | 5189 | if (self.liveness.isUnused(inst)) |
| 5190 | return null; | 5190 | return null; |
| 5191 | | 5191 | |
| 5192 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 5192 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5193 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 5193 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5194 | | 5194 | |
| 5195 | const ptr = try self.resolveInst(pl_op.operand); | | |
| 5196 | const lhs = try self.resolveInst(extra.lhs); | 5195 | const lhs = try self.resolveInst(extra.lhs); |
| 5197 | const rhs = try self.resolveInst(extra.rhs); | 5196 | const rhs = try self.resolveInst(extra.rhs); |
| 5198 | | 5197 | |
| 5199 | const ptr_ty = self.air.typeOf(pl_op.operand); | | |
| 5200 | const lhs_ty = self.air.typeOf(extra.lhs); | 5198 | const lhs_ty = self.air.typeOf(extra.lhs); |
| 5201 | | 5199 | |
| 5202 | const intrinsic_name = if (lhs_ty.isSignedInt()) signed_intrinsic else unsigned_intrinsic; | 5200 | const intrinsic_name = if (lhs_ty.isSignedInt()) signed_intrinsic else unsigned_intrinsic; |
| ... | @@ -5205,13 +5203,7 @@ pub const FuncGen = struct { | ... | @@ -5205,13 +5203,7 @@ pub const FuncGen = struct { |
| 5205 | | 5203 | |
| 5206 | const llvm_fn = self.getIntrinsic(intrinsic_name, &.{llvm_lhs_ty}); | 5204 | const llvm_fn = self.getIntrinsic(intrinsic_name, &.{llvm_lhs_ty}); |
| 5207 | const result_struct = self.builder.buildCall(llvm_fn, &[_]*const llvm.Value{ lhs, rhs }, 2, .Fast, .Auto, ""); | 5205 | const result_struct = self.builder.buildCall(llvm_fn, &[_]*const llvm.Value{ lhs, rhs }, 2, .Fast, .Auto, ""); |
| 5208 | | 5206 | return result_struct; |
| 5209 | const result = self.builder.buildExtractValue(result_struct, 0, ""); | | |
| 5210 | const overflow_bit = self.builder.buildExtractValue(result_struct, 1, ""); | | |
| 5211 | | | |
| 5212 | self.store(ptr, ptr_ty, result, .NotAtomic); | | |
| 5213 | | | |
| 5214 | return overflow_bit; | | |
| 5215 | } | 5207 | } |
| 5216 | | 5208 | |
| 5217 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { | 5209 | fn airMulAdd(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { |
| ... | @@ -5293,16 +5285,16 @@ pub const FuncGen = struct { | ... | @@ -5293,16 +5285,16 @@ pub const FuncGen = struct { |
| 5293 | if (self.liveness.isUnused(inst)) | 5285 | if (self.liveness.isUnused(inst)) |
| 5294 | return null; | 5286 | return null; |
| 5295 | | 5287 | |
| 5296 | const pl_op = self.air.instructions.items(.data)[inst].pl_op; | 5288 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 5297 | const extra = self.air.extraData(Air.Bin, pl_op.payload).data; | 5289 | const extra = self.air.extraData(Air.Bin, ty_pl.payload).data; |
| 5298 | | 5290 | |
| 5299 | const ptr = try self.resolveInst(pl_op.operand); | | |
| 5300 | const lhs = try self.resolveInst(extra.lhs); | 5291 | const lhs = try self.resolveInst(extra.lhs); |
| 5301 | const rhs = try self.resolveInst(extra.rhs); | 5292 | const rhs = try self.resolveInst(extra.rhs); |
| 5302 | | 5293 | |
| 5303 | const ptr_ty = self.air.typeOf(pl_op.operand); | | |
| 5304 | const lhs_ty = self.air.typeOf(extra.lhs); | 5294 | const lhs_ty = self.air.typeOf(extra.lhs); |
| 5305 | const rhs_ty = self.air.typeOf(extra.rhs); | 5295 | const rhs_ty = self.air.typeOf(extra.rhs); |
| | 5296 | const dest_ty = self.air.typeOfIndex(inst); |
| | 5297 | const llvm_dest_ty = try self.dg.llvmType(dest_ty); |
| 5306 | | 5298 | |
| 5307 | const tg = self.dg.module.getTarget(); | 5299 | const tg = self.dg.module.getTarget(); |
| 5308 | | 5300 | |
| ... | @@ -5319,9 +5311,8 @@ pub const FuncGen = struct { | ... | @@ -5319,9 +5311,8 @@ pub const FuncGen = struct { |
| 5319 | | 5311 | |
| 5320 | const overflow_bit = self.builder.buildICmp(.NE, lhs, reconstructed, ""); | 5312 | const overflow_bit = self.builder.buildICmp(.NE, lhs, reconstructed, ""); |
| 5321 | | 5313 | |
| 5322 | self.store(ptr, ptr_ty, result, .NotAtomic); | 5314 | const partial = self.builder.buildInsertValue(llvm_dest_ty.getUndef(), result, 0, ""); |
| 5323 | | 5315 | return self.builder.buildInsertValue(partial, overflow_bit, 1, ""); |
| 5324 | return overflow_bit; | | |
| 5325 | } | 5316 | } |
| 5326 | | 5317 | |
| 5327 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { | 5318 | fn airAnd(self: *FuncGen, inst: Air.Inst.Index) !?*const llvm.Value { |