diff --git a/src/stage1/all_types.hpp b/src/stage1/all_types.hpp index 89f3693a1389..cd6964dc65d7 100644 --- a/src/stage1/all_types.hpp +++ b/src/stage1/all_types.hpp @@ -1783,7 +1783,6 @@ enum BuiltinFnId { BuiltinFnIdIntToErr, BuiltinFnIdEnumToInt, BuiltinFnIdIntToEnum, - BuiltinFnIdVectorType, BuiltinFnIdShuffle, BuiltinFnIdSplat, BuiltinFnIdSetCold, @@ -2565,7 +2564,6 @@ enum IrInstSrcId { IrInstSrcIdIntToFloat, IrInstSrcIdFloatToInt, IrInstSrcIdBoolToInt, - IrInstSrcIdVectorType, IrInstSrcIdShuffleVector, IrInstSrcIdSplat, IrInstSrcIdBoolNot, @@ -3599,13 +3597,6 @@ struct IrInstSrcBoolToInt { IrInstSrc *target; }; -struct IrInstSrcVectorType { - IrInstSrc base; - - IrInstSrc *len; - IrInstSrc *elem_type; -}; - struct IrInstSrcBoolNot { IrInstSrc base; diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp index 5e9b84d25ae1..75a20e53e1e2 100644 --- a/src/stage1/codegen.cpp +++ b/src/stage1/codegen.cpp @@ -8601,7 +8601,6 @@ static void define_builtin_fns(CodeGen *g) { create_builtin_fn(g, BuiltinFnIdIntToEnum, "intToEnum", 2); create_builtin_fn(g, BuiltinFnIdCompileErr, "compileError", 1); create_builtin_fn(g, BuiltinFnIdCompileLog, "compileLog", SIZE_MAX); - create_builtin_fn(g, BuiltinFnIdVectorType, "Vector", 2); create_builtin_fn(g, BuiltinFnIdShuffle, "shuffle", 4); create_builtin_fn(g, BuiltinFnIdSplat, "splat", 2); create_builtin_fn(g, BuiltinFnIdSetCold, "setCold", 1); diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 62c52c8a975a..05f2d78114c4 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -419,8 +419,6 @@ static void destroy_instruction_src(IrInstSrc *inst) { return heap::c_allocator.destroy(reinterpret_cast(inst)); case IrInstSrcIdBoolToInt: return heap::c_allocator.destroy(reinterpret_cast(inst)); - case IrInstSrcIdVectorType: - return heap::c_allocator.destroy(reinterpret_cast(inst)); case IrInstSrcIdShuffleVector: return heap::c_allocator.destroy(reinterpret_cast(inst)); case IrInstSrcIdSplat: @@ -1344,10 +1342,6 @@ static constexpr IrInstSrcId ir_inst_id(IrInstSrcBoolToInt *) { return IrInstSrcIdBoolToInt; } -static constexpr IrInstSrcId ir_inst_id(IrInstSrcVectorType *) { - return IrInstSrcIdVectorType; -} - static constexpr IrInstSrcId ir_inst_id(IrInstSrcShuffleVector *) { return IrInstSrcIdShuffleVector; } @@ -3638,19 +3632,6 @@ static IrInstSrc *ir_build_bool_to_int(IrBuilderSrc *irb, Scope *scope, AstNode return &instruction->base; } -static IrInstSrc *ir_build_vector_type(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *len, - IrInstSrc *elem_type) -{ - IrInstSrcVectorType *instruction = ir_build_instruction(irb, scope, source_node); - instruction->len = len; - instruction->elem_type = elem_type; - - ir_ref_instruction(len, irb->current_basic_block); - ir_ref_instruction(elem_type, irb->current_basic_block); - - return &instruction->base; -} - static IrInstSrc *ir_build_shuffle_vector(IrBuilderSrc *irb, Scope *scope, AstNode *source_node, IrInstSrc *scalar_type, IrInstSrc *a, IrInstSrc *b, IrInstSrc *mask) { @@ -6849,21 +6830,6 @@ static IrInstSrc *ir_gen_builtin_fn_call(IrBuilderSrc *irb, Scope *scope, AstNod IrInstSrc *result = ir_build_bool_to_int(irb, scope, node, arg0_value); return ir_lval_wrap(irb, scope, result, lval, result_loc); } - case BuiltinFnIdVectorType: - { - AstNode *arg0_node = node->data.fn_call_expr.params.at(0); - IrInstSrc *arg0_value = ir_gen_node(irb, arg0_node, scope); - if (arg0_value == irb->codegen->invalid_inst_src) - return arg0_value; - - AstNode *arg1_node = node->data.fn_call_expr.params.at(1); - IrInstSrc *arg1_value = ir_gen_node(irb, arg1_node, scope); - if (arg1_value == irb->codegen->invalid_inst_src) - return arg1_value; - - IrInstSrc *vector_type = ir_build_vector_type(irb, scope, node, arg0_value, arg1_value); - return ir_lval_wrap(irb, scope, vector_type, lval, result_loc); - } case BuiltinFnIdShuffle: { AstNode *arg0_node = node->data.fn_call_expr.params.at(0); @@ -27375,20 +27341,6 @@ static IrInstGen *ir_analyze_instruction_bool_to_int(IrAnalyze *ira, IrInstSrcBo return ir_resolve_cast(ira, &instruction->base.base, target, u1_type, CastOpBoolToInt); } -static IrInstGen *ir_analyze_instruction_vector_type(IrAnalyze *ira, IrInstSrcVectorType *instruction) { - uint64_t len; - if (!ir_resolve_unsigned(ira, instruction->len->child, ira->codegen->builtin_types.entry_u32, &len)) - return ira->codegen->invalid_inst_gen; - - ZigType *elem_type = ir_resolve_vector_elem_type(ira, instruction->elem_type->child); - if (type_is_invalid(elem_type)) - return ira->codegen->invalid_inst_gen; - - ZigType *vector_type = get_vector_type(ira->codegen, len, elem_type); - - return ir_const_type(ira, &instruction->base.base, vector_type); -} - static IrInstGen *ir_analyze_shuffle_vector(IrAnalyze *ira, IrInst* source_instr, ZigType *scalar_type, IrInstGen *a, IrInstGen *b, IrInstGen *mask) { @@ -31838,8 +31790,6 @@ static IrInstGen *ir_analyze_instruction_base(IrAnalyze *ira, IrInstSrc *instruc return ir_analyze_instruction_float_to_int(ira, (IrInstSrcFloatToInt *)instruction); case IrInstSrcIdBoolToInt: return ir_analyze_instruction_bool_to_int(ira, (IrInstSrcBoolToInt *)instruction); - case IrInstSrcIdVectorType: - return ir_analyze_instruction_vector_type(ira, (IrInstSrcVectorType *)instruction); case IrInstSrcIdShuffleVector: return ir_analyze_instruction_shuffle_vector(ira, (IrInstSrcShuffleVector *)instruction); case IrInstSrcIdSplat: @@ -32328,7 +32278,6 @@ bool ir_inst_src_has_side_effects(IrInstSrc *instruction) { case IrInstSrcIdRef: case IrInstSrcIdEmbedFile: case IrInstSrcIdTruncate: - case IrInstSrcIdVectorType: case IrInstSrcIdShuffleVector: case IrInstSrcIdSplat: case IrInstSrcIdBoolNot: diff --git a/src/stage1/ir_print.cpp b/src/stage1/ir_print.cpp index 7d7fd4c9ea3f..95807b0c1f5f 100644 --- a/src/stage1/ir_print.cpp +++ b/src/stage1/ir_print.cpp @@ -214,8 +214,6 @@ const char* ir_inst_src_type_str(IrInstSrcId id) { return "SrcFloatToInt"; case IrInstSrcIdBoolToInt: return "SrcBoolToInt"; - case IrInstSrcIdVectorType: - return "SrcVectorType"; case IrInstSrcIdBoolNot: return "SrcBoolNot"; case IrInstSrcIdMemset: @@ -1689,14 +1687,6 @@ static void ir_print_bool_to_int(IrPrintSrc *irp, IrInstSrcBoolToInt *instructio fprintf(irp->f, ")"); } -static void ir_print_vector_type(IrPrintSrc *irp, IrInstSrcVectorType *instruction) { - fprintf(irp->f, "@Vector("); - ir_print_other_inst_src(irp, instruction->len); - fprintf(irp->f, ", "); - ir_print_other_inst_src(irp, instruction->elem_type); - fprintf(irp->f, ")"); -} - static void ir_print_shuffle_vector(IrPrintSrc *irp, IrInstSrcShuffleVector *instruction) { fprintf(irp->f, "@shuffle("); ir_print_other_inst_src(irp, instruction->scalar_type); @@ -2802,9 +2792,6 @@ static void ir_print_inst_src(IrPrintSrc *irp, IrInstSrc *instruction, bool trai case IrInstSrcIdBoolToInt: ir_print_bool_to_int(irp, (IrInstSrcBoolToInt *)instruction); break; - case IrInstSrcIdVectorType: - ir_print_vector_type(irp, (IrInstSrcVectorType *)instruction); - break; case IrInstSrcIdShuffleVector: ir_print_shuffle_vector(irp, (IrInstSrcShuffleVector *)instruction); break; diff --git a/test/compile_errors.zig b/test/compile_errors.zig index 44ee58f0024b..6a42695a9364 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -8104,6 +8104,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { }); cases.add("compare optional to non-optional with invalid types", + \\const Vector = @import("std").meta.Vector; \\export fn inconsistentChildType() void { \\ var x: ?i32 = undefined; \\ const y: comptime_int = 10; @@ -8117,8 +8118,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\} \\ \\export fn optionalVector() void { - \\ var x: ?@Vector(10, i32) = undefined; - \\ var y: @Vector(10, i32) = undefined; + \\ var x: ?Vector(10, i32) = undefined; + \\ var y: Vector(10, i32) = undefined; \\ _ = (x == y); \\} \\ @@ -8128,13 +8129,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { \\ _ = (x == y); \\} , &[_][]const u8{ - ":4:12: error: cannot compare types '?i32' and 'comptime_int'", - ":4:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'", - ":10:12: error: cannot compare types '?i32' and '?i32'", - ":10:12: note: optional to optional comparison is only supported for optional pointer types", - ":16:12: error: TODO add comparison of optional vector", - ":22:12: error: cannot compare types '?[3]i32' and '[3]i32'", - ":22:12: note: operator not supported for type '[3]i32'", + "tmp.zig:5:12: error: cannot compare types '?i32' and 'comptime_int'", + "tmp.zig:5:12: note: optional child type 'i32' must be the same as non-optional type 'comptime_int'", + "tmp.zig:11:12: error: cannot compare types '?i32' and '?i32'", + "tmp.zig:11:12: note: optional to optional comparison is only supported for optional pointer types", + "tmp.zig:17:12: error: TODO add comparison of optional vector", + "tmp.zig:23:12: error: cannot compare types '?[3]i32' and '[3]i32'", + "tmp.zig:23:12: note: operator not supported for type '[3]i32'", }); cases.add("slice cannot have its bytes reinterpreted", diff --git a/test/stage1/behavior/type.zig b/test/stage1/behavior/type.zig index 53a47228db8e..14498b3c779e 100644 --- a/test/stage1/behavior/type.zig +++ b/test/stage1/behavior/type.zig @@ -205,9 +205,6 @@ test "Type.Opaque" { test "Type.Vector" { testTypes(&[_]type{ - @Vector(0, u8), - @Vector(4, u8), - @Vector(8, *u8), std.meta.Vector(0, u8), std.meta.Vector(4, u8), std.meta.Vector(8, *u8),