| ... | @@ -7515,13 +7515,12 @@ fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil | ... | @@ -7515,13 +7515,12 @@ fn zirSplatOpResultType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil |
| 7515 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; | 7515 | const un_node = sema.code.instructions.items(.data)[@backingInt(inst)].un_node; |
| 7516 | | 7516 | |
| 7517 | const raw_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; | 7517 | const raw_ty = try sema.resolveTypeOrPoison(block, LazySrcLoc.unneeded, un_node.operand) orelse return .generic_poison_type; |
| 7518 | const vec_ty = raw_ty.optEuBaseType(zcu); | 7518 | const base_ty = raw_ty.optEuBaseType(zcu); |
| 7519 | | 7519 | |
| 7520 | switch (vec_ty.zigTypeTag(zcu)) { | 7520 | switch (base_ty.zigTypeTag(zcu)) { |
| 7521 | .array, .vector => {}, | 7521 | .array, .vector => return Air.internedToRef(base_ty.childType(zcu).toIntern()), |
| 7522 | else => return sema.fail(block, block.nodeOffset(un_node.src_node), "expected array or vector type, found '{f}'", .{vec_ty.fmt(zcu)}), | 7522 | else => return Air.internedToRef(base_ty.toIntern()), |
| 7523 | } | 7523 | } |
| 7524 | return Air.internedToRef(vec_ty.childType(zcu).toIntern()); | | |
| 7525 | } | 7524 | } |
| 7526 | | 7525 | |
| 7527 | fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { | 7526 | fn zirVectorType(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.Inst.Ref { |
| ... | @@ -23314,17 +23313,17 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -23314,17 +23313,17 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 23314 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; | 23313 | const inst_data = sema.code.instructions.items(.data)[@backingInt(inst)].pl_node; |
| 23315 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; | 23314 | const extra = sema.code.extraData(Zir.Inst.Bin, inst_data.payload_index).data; |
| 23316 | const src = block.nodeOffset(inst_data.src_node); | 23315 | const src = block.nodeOffset(inst_data.src_node); |
| 23317 | const scalar_src = block.builtinCallArgSrc(inst_data.src_node, 0); | 23316 | const operand_src = block.builtinCallArgSrc(inst_data.src_node, 0); |
| 23318 | const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu_opt, "@splat"); | 23317 | const dest_ty = try sema.resolveDestType(block, src, extra.lhs, .remove_eu_opt, "@splat"); |
| | 23318 | const operand = sema.resolveInst(extra.rhs); |
| 23319 | | 23319 | |
| 23320 | switch (dest_ty.zigTypeTag(zcu)) { | 23320 | switch (dest_ty.zigTypeTag(zcu)) { |
| 23321 | .array, .vector => {}, | 23321 | .array, .vector => {}, |
| 23322 | else => return sema.fail(block, src, "expected array or vector type, found '{f}'", .{dest_ty.fmt(zcu)}), | 23322 | else => return sema.coerce(block, dest_ty, operand, operand_src), |
| 23323 | } | 23323 | } |
| 23324 | | 23324 | |
| 23325 | const operand = sema.resolveInst(extra.rhs); | | |
| 23326 | const scalar_ty = dest_ty.childType(zcu); | 23325 | const scalar_ty = dest_ty.childType(zcu); |
| 23327 | const scalar = try sema.coerce(block, scalar_ty, operand, scalar_src); | 23326 | const scalar = try sema.coerce(block, scalar_ty, operand, operand_src); |
| 23328 | | 23327 | |
| 23329 | const len = try sema.usizeCast(block, src, dest_ty.arrayLen(zcu)); | 23328 | const len = try sema.usizeCast(block, src, dest_ty.arrayLen(zcu)); |
| 23330 | | 23329 | |
| ... | @@ -23348,7 +23347,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I | ... | @@ -23348,7 +23347,7 @@ fn zirSplat(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air.I |
| 23348 | return .fromValue(try pt.aggregateSplatValue(dest_ty, scalar_val)); | 23347 | return .fromValue(try pt.aggregateSplatValue(dest_ty, scalar_val)); |
| 23349 | } | 23348 | } |
| 23350 | | 23349 | |
| 23351 | try sema.requireRuntimeBlock(block, src, scalar_src); | 23350 | try sema.requireRuntimeBlock(block, src, operand_src); |
| 23352 | | 23351 | |
| 23353 | switch (dest_ty.zigTypeTag(zcu)) { | 23352 | switch (dest_ty.zigTypeTag(zcu)) { |
| 23354 | .vector, .array => return block.addTyOp(.splat, dest_ty, scalar), | 23353 | .vector, .array => return block.addTyOp(.splat, dest_ty, scalar), |