Skip to content

Commit a50ca31

Browse files
committed
@vector -> std.meta.Vector
1 parent ee5b358 commit a50ca31

19 files changed

+122
-114
lines changed

lib/std/fmt.zig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,9 +1670,9 @@ test "vector" {
16701670
return error.SkipZigTest;
16711671
}
16721672

1673-
const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };
1674-
const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
1675-
const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };
1673+
const vbool: std.meta.Vector(4, bool) = [_]bool{ true, false, true, false };
1674+
const vi64: std.meta.Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
1675+
const vu64: std.meta.Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };
16761676

16771677
try testFmt("{ true, false, true, false }", "{}", .{vbool});
16781678
try testFmt("{ -2, -1, 0, 1 }", "{}", .{vi64});

lib/std/hash/auto_hash.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ test "testHash vector" {
359359
// Disabled because of #3317
360360
if (@import("builtin").arch == .mipsel or @import("builtin").arch == .mips) return error.SkipZigTest;
361361

362-
const a: @Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
363-
const b: @Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
362+
const a: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 4 };
363+
const b: meta.Vector(4, u32) = [_]u32{ 1, 2, 3, 5 };
364364
testing.expect(testHash(a) == testHash(a));
365365
testing.expect(testHash(a) != testHash(b));
366366

367-
const c: @Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
368-
const d: @Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
367+
const c: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 4 };
368+
const d: meta.Vector(4, u31) = [_]u31{ 1, 2, 3, 5 };
369369
testing.expect(testHash(c) == testHash(c));
370370
testing.expect(testHash(c) != testHash(d));
371371
}

lib/std/special/compiler_rt.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ comptime {
291291
@export(@import("compiler_rt/umodti3.zig").__umodti3, .{ .name = "__umodti3", .linkage = linkage });
292292
},
293293
.x86_64 => {
294-
// The "ti" functions must use @Vector(2, u64) parameter types to adhere to the ABI
294+
// The "ti" functions must use Vector(2, u64) parameter types to adhere to the ABI
295295
// that LLVM expects compiler-rt to have.
296296
@export(@import("compiler_rt/divti3.zig").__divti3_windows_x86_64, .{ .name = "__divti3", .linkage = linkage });
297297
@export(@import("compiler_rt/modti3.zig").__modti3_windows_x86_64, .{ .name = "__modti3", .linkage = linkage });

lib/std/special/compiler_rt/divti3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn __divti3(a: i128, b: i128) callconv(.C) i128 {
1515
return (@bitCast(i128, r) ^ s) -% s;
1616
}
1717

18-
const v128 = @Vector(2, u64);
18+
const v128 = @import("std").meta.Vector(2, u64);
1919
pub fn __divti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
2020
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __divti3, .{
2121
@bitCast(i128, a),

lib/std/special/compiler_rt/modti3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub fn __modti3(a: i128, b: i128) callconv(.C) i128 {
2020
return (@bitCast(i128, r) ^ s_a) -% s_a; // negate if s == -1
2121
}
2222

23-
const v128 = @Vector(2, u64);
23+
const v128 = @import("std").meta.Vector(2, u64);
2424
pub fn __modti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
2525
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __modti3, .{
2626
@bitCast(i128, a),

lib/std/special/compiler_rt/multi3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
1414
return r.all;
1515
}
1616

17-
const v128 = @Vector(2, u64);
17+
const v128 = @import("std").meta.Vector(2, u64);
1818
pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1919
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
2020
@bitCast(i128, a),

lib/std/special/compiler_rt/udivmodti4.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub fn __udivmodti4(a: u128, b: u128, maybe_rem: ?*u128) callconv(.C) u128 {
77
return udivmod(u128, a, b, maybe_rem);
88
}
99

10-
const v128 = @Vector(2, u64);
10+
const v128 = @import("std").meta.Vector(2, u64);
1111
pub fn __udivmodti4_windows_x86_64(a: v128, b: v128, maybe_rem: ?*u128) callconv(.C) v128 {
1212
@setRuntimeSafety(builtin.is_test);
1313
return @bitCast(v128, udivmod(u128, @bitCast(u128, a), @bitCast(u128, b), maybe_rem));

lib/std/special/compiler_rt/udivti3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub fn __udivti3(a: u128, b: u128) callconv(.C) u128 {
66
return udivmodti4.__udivmodti4(a, b, null);
77
}
88

9-
const v128 = @Vector(2, u64);
9+
const v128 = @import("std").meta.Vector(2, u64);
1010
pub fn __udivti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1111
@setRuntimeSafety(builtin.is_test);
1212
return udivmodti4.__udivmodti4_windows_x86_64(a, b, null);

lib/std/special/compiler_rt/umodti3.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn __umodti3(a: u128, b: u128) callconv(.C) u128 {
99
return r;
1010
}
1111

12-
const v128 = @Vector(2, u64);
12+
const v128 = @import("std").meta.Vector(2, u64);
1313
pub fn __umodti3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
1414
return @bitCast(v128, @call(.{ .modifier = .always_inline }, __umodti3, .{
1515
@bitCast(u128, a),

lib/std/target.zig

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,8 +488,8 @@ pub const Target = struct {
488488

489489
/// Adds the specified feature set but not its dependencies.
490490
pub fn addFeatureSet(set: *Set, other_set: Set) void {
491-
set.ints = @as(@Vector(usize_count, usize), set.ints) |
492-
@as(@Vector(usize_count, usize), other_set.ints);
491+
set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) |
492+
@as(std.meta.Vector(usize_count, usize), other_set.ints);
493493
}
494494

495495
/// Removes the specified feature but not its dependents.
@@ -501,8 +501,8 @@ pub const Target = struct {
501501

502502
/// Removes the specified feature but not its dependents.
503503
pub fn removeFeatureSet(set: *Set, other_set: Set) void {
504-
set.ints = @as(@Vector(usize_count, usize), set.ints) &
505-
~@as(@Vector(usize_count, usize), other_set.ints);
504+
set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) &
505+
~@as(std.meta.Vector(usize_count, usize), other_set.ints);
506506
}
507507

508508
pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void {

test/compile_errors.zig

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
984984

985985
cases.add("store vector pointer with unknown runtime index",
986986
\\export fn entry() void {
987-
\\ var v: @Vector(4, i32) = [_]i32{ 1, 5, 3, undefined };
987+
\\ var v: @import("std").meta.Vector(4, i32) = [_]i32{ 1, 5, 3, undefined };
988988
\\
989989
\\ var i: u32 = 0;
990990
\\ storev(&v[i], 42);
@@ -999,7 +999,7 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
999999

10001000
cases.add("load vector pointer with unknown runtime index",
10011001
\\export fn entry() void {
1002-
\\ var v: @Vector(4, i32) = [_]i32{ 1, 5, 3, undefined };
1002+
\\ var v: @import("std").meta.Vector(4, i32) = [_]i32{ 1, 5, 3, undefined };
10031003
\\
10041004
\\ var i: u32 = 0;
10051005
\\ var x = loadv(&v[i]);
@@ -1885,8 +1885,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
18851885

18861886
cases.addTest("comptime vector overflow shows the index",
18871887
\\comptime {
1888-
\\ var a: @Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
1889-
\\ var b: @Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
1888+
\\ var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 255, 4 };
1889+
\\ var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 1, 8 };
18901890
\\ var x = a + b;
18911891
\\}
18921892
, &[_][]const u8{
@@ -6846,8 +6846,8 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
68466846

68476847
cases.addTest("@shuffle with selected index past first vector length",
68486848
\\export fn entry() void {
6849-
\\ const v: @Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
6850-
\\ const x: @Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
6849+
\\ const v: @import("std").meta.Vector(4, u32) = [4]u32{ 10, 11, 12, 13 };
6850+
\\ const x: @import("std").meta.Vector(4, u32) = [4]u32{ 14, 15, 16, 17 };
68516851
\\ var z = @shuffle(u32, v, x, [8]i32{ 0, 1, 2, 3, 7, 6, 5, 4 });
68526852
\\}
68536853
, &[_][]const u8{
@@ -6858,11 +6858,13 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
68586858

68596859
cases.addTest("nested vectors",
68606860
\\export fn entry() void {
6861-
\\ const V = @Vector(4, @Vector(4, u8));
6862-
\\ var v: V = undefined;
6861+
\\ const V1 = @import("std").meta.Vector(4, u8);
6862+
\\ const V2 = @Type(@import("builtin").TypeInfo{ .Vector = .{ .len = 4, .child = V1 } });
6863+
\\ var v: V2 = undefined;
68636864
\\}
68646865
, &[_][]const u8{
6865-
"tmp.zig:2:26: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid",
6866+
"tmp.zig:3:49: error: vector element type must be integer, float, bool, or pointer; '@Vector(4, u8)' is invalid",
6867+
"tmp.zig:3:16: note: referenced here",
68666868
});
68676869

68686870
cases.addTest("bad @splat type",

test/runtime_safety.zig

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
472472
\\ @import("std").os.exit(126);
473473
\\}
474474
\\pub fn main() void {
475-
\\ var a: @Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 };
476-
\\ var b: @Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };
475+
\\ var a: @import("std").meta.Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 };
476+
\\ var b: @import("std").meta.Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };
477477
\\ const x = add(a, b);
478478
\\}
479-
\\fn add(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
479+
\\fn add(a: @import("std").meta.Vector(4, i32), b: @import("std").meta.Vector(4, i32)) @import("std").meta.Vector(4, i32) {
480480
\\ return a + b;
481481
\\}
482482
);
@@ -486,11 +486,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
486486
\\ @import("std").os.exit(126);
487487
\\}
488488
\\pub fn main() void {
489-
\\ var a: @Vector(4, u32) = [_]u32{ 1, 2, 8, 4 };
490-
\\ var b: @Vector(4, u32) = [_]u32{ 5, 6, 7, 8 };
489+
\\ var a: @import("std").meta.Vector(4, u32) = [_]u32{ 1, 2, 8, 4 };
490+
\\ var b: @import("std").meta.Vector(4, u32) = [_]u32{ 5, 6, 7, 8 };
491491
\\ const x = sub(b, a);
492492
\\}
493-
\\fn sub(a: @Vector(4, u32), b: @Vector(4, u32)) @Vector(4, u32) {
493+
\\fn sub(a: @import("std").meta.Vector(4, u32), b: @import("std").meta.Vector(4, u32)) @import("std").meta.Vector(4, u32) {
494494
\\ return a - b;
495495
\\}
496496
);
@@ -500,11 +500,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
500500
\\ @import("std").os.exit(126);
501501
\\}
502502
\\pub fn main() void {
503-
\\ var a: @Vector(4, u8) = [_]u8{ 1, 2, 200, 4 };
504-
\\ var b: @Vector(4, u8) = [_]u8{ 5, 6, 2, 8 };
503+
\\ var a: @import("std").meta.Vector(4, u8) = [_]u8{ 1, 2, 200, 4 };
504+
\\ var b: @import("std").meta.Vector(4, u8) = [_]u8{ 5, 6, 2, 8 };
505505
\\ const x = mul(b, a);
506506
\\}
507-
\\fn mul(a: @Vector(4, u8), b: @Vector(4, u8)) @Vector(4, u8) {
507+
\\fn mul(a: @import("std").meta.Vector(4, u8), b: @import("std").meta.Vector(4, u8)) @import("std").meta.Vector(4, u8) {
508508
\\ return a * b;
509509
\\}
510510
);
@@ -514,10 +514,10 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
514514
\\ @import("std").os.exit(126);
515515
\\}
516516
\\pub fn main() void {
517-
\\ var a: @Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 };
517+
\\ var a: @import("std").meta.Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 };
518518
\\ const x = neg(a);
519519
\\}
520-
\\fn neg(a: @Vector(4, i16)) @Vector(4, i16) {
520+
\\fn neg(a: @import("std").meta.Vector(4, i16)) @import("std").meta.Vector(4, i16) {
521521
\\ return -a;
522522
\\}
523523
);
@@ -579,12 +579,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
579579
\\ @import("std").os.exit(126);
580580
\\}
581581
\\pub fn main() !void {
582-
\\ var a: @Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 };
583-
\\ var b: @Vector(4, i16) = [_]i16{ 1, 2, -1, 4 };
582+
\\ var a: @import("std").meta.Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 };
583+
\\ var b: @import("std").meta.Vector(4, i16) = [_]i16{ 1, 2, -1, 4 };
584584
\\ const x = div(a, b);
585585
\\ if (x[2] == 32767) return error.Whatever;
586586
\\}
587-
\\fn div(a: @Vector(4, i16), b: @Vector(4, i16)) @Vector(4, i16) {
587+
\\fn div(a: @import("std").meta.Vector(4, i16), b: @import("std").meta.Vector(4, i16)) @import("std").meta.Vector(4, i16) {
588588
\\ return @divTrunc(a, b);
589589
\\}
590590
);
@@ -658,11 +658,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
658658
\\ @import("std").os.exit(126);
659659
\\}
660660
\\pub fn main() void {
661-
\\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444};
662-
\\ var b: @Vector(4, i32) = [4]i32{111, 0, 333, 444};
661+
\\ var a: @import("std").meta.Vector(4, i32) = [4]i32{111, 222, 333, 444};
662+
\\ var b: @import("std").meta.Vector(4, i32) = [4]i32{111, 0, 333, 444};
663663
\\ const x = div0(a, b);
664664
\\}
665-
\\fn div0(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
665+
\\fn div0(a: @import("std").meta.Vector(4, i32), b: @import("std").meta.Vector(4, i32)) @import("std").meta.Vector(4, i32) {
666666
\\ return @divTrunc(a, b);
667667
\\}
668668
);
@@ -685,11 +685,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
685685
\\ @import("std").os.exit(126);
686686
\\}
687687
\\pub fn main() !void {
688-
\\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444};
689-
\\ var b: @Vector(4, i32) = [4]i32{111, 222, 333, 441};
688+
\\ var a: @import("std").meta.Vector(4, i32) = [4]i32{111, 222, 333, 444};
689+
\\ var b: @import("std").meta.Vector(4, i32) = [4]i32{111, 222, 333, 441};
690690
\\ const x = divExact(a, b);
691691
\\}
692-
\\fn divExact(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
692+
\\fn divExact(a: @import("std").meta.Vector(4, i32), b: @import("std").meta.Vector(4, i32)) @import("std").meta.Vector(4, i32) {
693693
\\ return @divExact(a, b);
694694
\\}
695695
);

test/stage1/behavior/byteswap.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ test "@byteSwap vectors" {
5555
fn t(
5656
comptime I: type,
5757
comptime n: comptime_int,
58-
input: @Vector(n, I),
59-
expected_vector: @Vector(n, I),
58+
input: std.meta.Vector(n, I),
59+
expected_vector: std.meta.Vector(n, I),
6060
) void {
6161
const actual_output: [n]I = @byteSwap(I, input);
6262
const expected_output: [n]I = expected_vector;

0 commit comments

Comments
 (0)