| author | |
| committer | |
| log | c5ee73f65b4c77fe08aa44b8611bf084ae700f24 |
| tree | aca72ec5f4fe45695bf7eea6bb288ee2f3ef27e9 |
| parent | 9bf2bda68356212168a213141e0a21d9dab22655 |
Fixes regression introduced in 93b854eb745ab3294054ae71150fe60f134f4d10.11 files changed, 20 insertions(+), 13 deletions(-)
src/Liveness.zig+1-1| ... | ... | @@ -368,7 +368,7 @@ fn analyzeInst( |
| 368 | 368 | .vector_init => { |
| 369 | 369 | const ty_pl = inst_datas[inst].ty_pl; |
| 370 | 370 | const vector_ty = a.air.getRefType(ty_pl.ty); |
| 371 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 371 | const len = vector_ty.vectorLen(); | |
| 372 | 372 | const elements = @bitCast([]const Air.Inst.Ref, a.air.extra[ty_pl.payload..][0..len]); |
| 373 | 373 | |
| 374 | 374 | if (elements.len <= bpi - 1) { |
src/Sema.zig+2-2| ... | ... | @@ -11010,7 +11010,7 @@ fn zirClzCtz( |
| 11010 | 11010 | const result_scalar_ty = try Type.smallestUnsignedInt(sema.arena, bits); |
| 11011 | 11011 | switch (operand_ty.zigTypeTag()) { |
| 11012 | 11012 | .Vector => { |
| 11013 | const vec_len = operand_ty.arrayLen(); | |
| 11013 | const vec_len = operand_ty.vectorLen(); | |
| 11014 | 11014 | const result_ty = try Type.vector(sema.arena, vec_len, result_scalar_ty); |
| 11015 | 11015 | if (try sema.resolveMaybeUndefVal(block, operand_src, operand)) |val| { |
| 11016 | 11016 | if (val.isUndef()) return sema.addConstUndef(result_ty); |
| ... | ... | @@ -14578,7 +14578,7 @@ fn coerceVectors( |
| 14578 | 14578 | ) !Air.Inst.Ref { |
| 14579 | 14579 | const inst_ty = sema.typeOf(inst); |
| 14580 | 14580 | const inst_len = inst_ty.arrayLen(); |
| 14581 | const dest_len = dest_ty.arrayLen(); | |
| 14581 | const dest_len = try sema.usizeCast(block, dest_ty_src, dest_ty.arrayLen()); | |
| 14582 | 14582 | |
| 14583 | 14583 | if (dest_len != inst_len) { |
| 14584 | 14584 | const msg = msg: { |
src/arch/aarch64/CodeGen.zig+1-1| ... | ... | @@ -2577,7 +2577,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 2577 | 2577 | |
| 2578 | 2578 | fn airVectorInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2579 | 2579 | const vector_ty = self.air.typeOfIndex(inst); |
| 2580 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 2580 | const len = vector_ty.vectorLen(); | |
| 2581 | 2581 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 2582 | 2582 | const elements = @bitCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 2583 | 2583 | const result: MCValue = res: { |
src/arch/arm/CodeGen.zig+1-1| ... | ... | @@ -3675,7 +3675,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 3675 | 3675 | |
| 3676 | 3676 | fn airVectorInit(self: *Self, inst: Air.Inst.Index) !void { |
| 3677 | 3677 | const vector_ty = self.air.typeOfIndex(inst); |
| 3678 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 3678 | const len = vector_ty.vectorLen(); | |
| 3679 | 3679 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 3680 | 3680 | const elements = @bitCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 3681 | 3681 | const result: MCValue = res: { |
src/arch/riscv64/CodeGen.zig+1-1| ... | ... | @@ -2076,7 +2076,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 2076 | 2076 | |
| 2077 | 2077 | fn airVectorInit(self: *Self, inst: Air.Inst.Index) !void { |
| 2078 | 2078 | const vector_ty = self.air.typeOfIndex(inst); |
| 2079 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 2079 | const len = vector_ty.vectorLen(); | |
| 2080 | 2080 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 2081 | 2081 | const elements = @bitCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 2082 | 2082 | const result: MCValue = res: { |
src/arch/wasm/CodeGen.zig+1-1| ... | ... | @@ -3239,7 +3239,7 @@ fn airVectorInit(self: *Self, inst: Air.Inst.Index) !void { |
| 3239 | 3239 | if (self.liveness.isUnused(inst)) return WValue{ .none = {} }; |
| 3240 | 3240 | |
| 3241 | 3241 | const vector_ty = self.air.typeOfIndex(inst); |
| 3242 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 3242 | const len = vector_ty.vectorLen(); | |
| 3243 | 3243 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 3244 | 3244 | const elements = @bitCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 3245 | 3245 |
src/arch/x86_64/CodeGen.zig+1-1| ... | ... | @@ -3669,7 +3669,7 @@ fn airSplat(self: *Self, inst: Air.Inst.Index) !void { |
| 3669 | 3669 | |
| 3670 | 3670 | fn airVectorInit(self: *Self, inst: Air.Inst.Index) !void { |
| 3671 | 3671 | const vector_ty = self.air.typeOfIndex(inst); |
| 3672 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 3672 | const len = vector_ty.vectorLen(); | |
| 3673 | 3673 | const ty_pl = self.air.instructions.items(.data)[inst].ty_pl; |
| 3674 | 3674 | const elements = @bitCast([]const Air.Inst.Ref, self.air.extra[ty_pl.payload..][0..len]); |
| 3675 | 3675 | const result: MCValue = res: { |
src/codegen/c.zig+1-1| ... | ... | @@ -3038,7 +3038,7 @@ fn airVectorInit(f: *Function, inst: Air.Inst.Index) !CValue { |
| 3038 | 3038 | const inst_ty = f.air.typeOfIndex(inst); |
| 3039 | 3039 | const ty_pl = f.air.instructions.items(.data)[inst].ty_pl; |
| 3040 | 3040 | const vector_ty = f.air.getRefType(ty_pl.ty); |
| 3041 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 3041 | const len = vector_ty.vectorLen(); | |
| 3042 | 3042 | const elements = @bitCast([]const Air.Inst.Ref, f.air.extra[ty_pl.payload..][0..len]); |
| 3043 | 3043 | |
| 3044 | 3044 | const writer = f.object.writer(); |
src/codegen/llvm.zig+3-3| ... | ... | @@ -873,7 +873,7 @@ pub const DeclGen = struct { |
| 873 | 873 | }, |
| 874 | 874 | .Vector => { |
| 875 | 875 | const elem_type = try dg.llvmType(t.childType()); |
| 876 | return elem_type.vectorType(@intCast(c_uint, t.arrayLen())); | |
| 876 | return elem_type.vectorType(t.vectorLen()); | |
| 877 | 877 | }, |
| 878 | 878 | .Optional => { |
| 879 | 879 | var buf: Type.Payload.ElemType = undefined; |
| ... | ... | @@ -4170,7 +4170,7 @@ pub const FuncGen = struct { |
| 4170 | 4170 | const target = self.dg.module.getTarget(); |
| 4171 | 4171 | const bits = operand_ty.intInfo(target).bits; |
| 4172 | 4172 | const vec_len: ?u32 = switch (operand_ty.zigTypeTag()) { |
| 4173 | .Vector => @intCast(u32, operand_ty.arrayLen()), | |
| 4173 | .Vector => operand_ty.vectorLen(), | |
| 4174 | 4174 | else => null, |
| 4175 | 4175 | }; |
| 4176 | 4176 | |
| ... | ... | @@ -4372,7 +4372,7 @@ pub const FuncGen = struct { |
| 4372 | 4372 | const scalar = try self.resolveInst(ty_op.operand); |
| 4373 | 4373 | const scalar_ty = self.air.typeOf(ty_op.operand); |
| 4374 | 4374 | const vector_ty = self.air.typeOfIndex(inst); |
| 4375 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 4375 | const len = vector_ty.vectorLen(); | |
| 4376 | 4376 | const scalar_llvm_ty = try self.dg.llvmType(scalar_ty); |
| 4377 | 4377 | const op_llvm_ty = scalar_llvm_ty.vectorType(1); |
| 4378 | 4378 | const u32_llvm_ty = self.context.intType(32); |
src/print_air.zig+1-1| ... | ... | @@ -295,7 +295,7 @@ const Writer = struct { |
| 295 | 295 | fn writeVectorInit(w: *Writer, s: anytype, inst: Air.Inst.Index) @TypeOf(s).Error!void { |
| 296 | 296 | const ty_pl = w.air.instructions.items(.data)[inst].ty_pl; |
| 297 | 297 | const vector_ty = w.air.getRefType(ty_pl.ty); |
| 298 | const len = @intCast(u32, vector_ty.arrayLen()); | |
| 298 | const len = vector_ty.vectorLen(); | |
| 299 | 299 | const elements = @bitCast([]const Air.Inst.Ref, w.air.extra[ty_pl.payload..][0..len]); |
| 300 | 300 | |
| 301 | 301 | try s.print("{}, [", .{vector_ty}); |
src/type.zig+7| ... | ... | @@ -3005,6 +3005,13 @@ pub const Type = extern union { |
| 3005 | 3005 | return ty.arrayLen() + @boolToInt(ty.sentinel() != null); |
| 3006 | 3006 | } |
| 3007 | 3007 | |
| 3008 | pub fn vectorLen(ty: Type) u32 { | |
| 3009 | return switch (ty.tag()) { | |
| 3010 | .vector => @intCast(u32, ty.castTag(.vector).?.data.len), | |
| 3011 | else => unreachable, | |
| 3012 | }; | |
| 3013 | } | |
| 3014 | ||
| 3008 | 3015 | /// Asserts the type is an array, pointer or vector. |
| 3009 | 3016 | pub fn sentinel(self: Type) ?Value { |
| 3010 | 3017 | return switch (self.tag()) { |