authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-03-30 11:12:14-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2022-03-30 14:12:14-04:00
logb73cf97c93bb23150475ac0c23aadf86dbd71bc4
treea2b144c923c303e815502e683f75fd4a9b79bba8
parentb153e156b1d431995e7f89150c93ec05aa3966f8
signaturebadge-question-mark Signed by PGP key 4AEE18F83AFDEB23

replace other uses of `std.meta.Vector` with `@Vector` (#11346)


17 files changed, 113 insertions(+), 127 deletions(-)

lib/std/crypto/aes/aesni.zig+1-3
...@@ -2,9 +2,7 @@ const std = @import("../../std.zig");...@@ -2,9 +2,7 @@ const std = @import("../../std.zig");
2const builtin = @import("builtin");2const builtin = @import("builtin");
3const mem = std.mem;3const mem = std.mem;
4const debug = std.debug;4const debug = std.debug;
5const Vector = std.meta.Vector;5const BlockVec = @Vector(2, u64);
6
7const BlockVec = Vector(2, u64);
86
9/// A single AES block.7/// A single AES block.
10pub const Block = struct {8pub const Block = struct {
lib/std/crypto/aes/armcrypto.zig+3-5
...@@ -1,9 +1,7 @@...@@ -1,9 +1,7 @@
1const std = @import("../../std.zig");1const std = @import("../../std.zig");
2const mem = std.mem;2const mem = std.mem;
3const debug = std.debug;3const debug = std.debug;
4const Vector = std.meta.Vector;4const BlockVec = @Vector(2, u64);
5
6const BlockVec = Vector(2, u64);
75
8/// A single AES block.6/// A single AES block.
9pub const Block = struct {7pub const Block = struct {
...@@ -29,7 +27,7 @@ pub const Block = struct {...@@ -29,7 +27,7 @@ pub const Block = struct {
29 return mem.toBytes(x);27 return mem.toBytes(x);
30 }28 }
3129
32 const zero = Vector(2, u64){ 0, 0 };30 const zero = @Vector(2, u64){ 0, 0 };
3331
34 /// Encrypt a block with a round key.32 /// Encrypt a block with a round key.
35 pub inline fn encrypt(block: Block, round_key: Block) Block {33 pub inline fn encrypt(block: Block, round_key: Block) Block {
...@@ -182,7 +180,7 @@ fn KeySchedule(comptime Aes: type) type {...@@ -182,7 +180,7 @@ fn KeySchedule(comptime Aes: type) type {
182 return struct {180 return struct {
183 const Self = @This();181 const Self = @This();
184182
185 const zero = Vector(2, u64){ 0, 0 };183 const zero = @Vector(2, u64){ 0, 0 };
186 const mask1 = @Vector(16, u8){ 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12 };184 const mask1 = @Vector(16, u8){ 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12 };
187 const mask2 = @Vector(16, u8){ 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15 };185 const mask2 = @Vector(16, u8){ 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15 };
188186
lib/std/crypto/chacha20.zig+1-2
...@@ -7,7 +7,6 @@ const mem = std.mem;...@@ -7,7 +7,6 @@ const mem = std.mem;
7const assert = std.debug.assert;7const assert = std.debug.assert;
8const testing = std.testing;8const testing = std.testing;
9const maxInt = math.maxInt;9const maxInt = math.maxInt;
10const Vector = std.meta.Vector;
11const Poly1305 = std.crypto.onetimeauth.Poly1305;10const Poly1305 = std.crypto.onetimeauth.Poly1305;
12const AuthenticationError = std.crypto.errors.AuthenticationError;11const AuthenticationError = std.crypto.errors.AuthenticationError;
1312
...@@ -79,7 +78,7 @@ pub const XChaCha8Poly1305 = XChaChaPoly1305(8);...@@ -79,7 +78,7 @@ pub const XChaCha8Poly1305 = XChaChaPoly1305(8);
79// Vectorized implementation of the core function78// Vectorized implementation of the core function
80fn ChaChaVecImpl(comptime rounds_nb: usize) type {79fn ChaChaVecImpl(comptime rounds_nb: usize) type {
81 return struct {80 return struct {
82 const Lane = Vector(4, u32);81 const Lane = @Vector(4, u32);
83 const BlockVec = [4]Lane;82 const BlockVec = [4]Lane;
8483
85 fn initContext(key: [8]u32, d: [4]u32) BlockVec {84 fn initContext(key: [8]u32, d: [4]u32) BlockVec {
lib/std/crypto/ghash.zig+6-8
...@@ -92,23 +92,21 @@ pub const Ghash = struct {...@@ -92,23 +92,21 @@ pub const Ghash = struct {
92 }92 }
9393
94 inline fn clmul_pclmul(x: u64, y: u64) u64 {94 inline fn clmul_pclmul(x: u64, y: u64) u64 {
95 const Vector = std.meta.Vector;
96 const product = asm (95 const product = asm (
97 \\ vpclmulqdq $0x00, %[x], %[y], %[out]96 \\ vpclmulqdq $0x00, %[x], %[y], %[out]
98 : [out] "=x" (-> Vector(2, u64)),97 : [out] "=x" (-> @Vector(2, u64)),
99 : [x] "x" (@bitCast(Vector(2, u64), @as(u128, x))),98 : [x] "x" (@bitCast(@Vector(2, u64), @as(u128, x))),
100 [y] "x" (@bitCast(Vector(2, u64), @as(u128, y))),99 [y] "x" (@bitCast(@Vector(2, u64), @as(u128, y))),
101 );100 );
102 return product[0];101 return product[0];
103 }102 }
104103
105 inline fn clmul_pmull(x: u64, y: u64) u64 {104 inline fn clmul_pmull(x: u64, y: u64) u64 {
106 const Vector = std.meta.Vector;
107 const product = asm (105 const product = asm (
108 \\ pmull %[out].1q, %[x].1d, %[y].1d106 \\ pmull %[out].1q, %[x].1d, %[y].1d
109 : [out] "=w" (-> Vector(2, u64)),107 : [out] "=w" (-> @Vector(2, u64)),
110 : [x] "w" (@bitCast(Vector(2, u64), @as(u128, x))),108 : [x] "w" (@bitCast(@Vector(2, u64), @as(u128, x))),
111 [y] "w" (@bitCast(Vector(2, u64), @as(u128, y))),109 [y] "w" (@bitCast(@Vector(2, u64), @as(u128, y))),
112 );110 );
113 return product[0];111 return product[0];
114 }112 }
lib/std/crypto/gimli.zig+1-2
...@@ -15,7 +15,6 @@ const debug = std.debug;...@@ -15,7 +15,6 @@ const debug = std.debug;
15const assert = std.debug.assert;15const assert = std.debug.assert;
16const testing = std.testing;16const testing = std.testing;
17const htest = @import("test.zig");17const htest = @import("test.zig");
18const Vector = std.meta.Vector;
19const AuthenticationError = std.crypto.errors.AuthenticationError;18const AuthenticationError = std.crypto.errors.AuthenticationError;
2019
21pub const State = struct {20pub const State = struct {
...@@ -111,7 +110,7 @@ pub const State = struct {...@@ -111,7 +110,7 @@ pub const State = struct {
111 self.endianSwap();110 self.endianSwap();
112 }111 }
113112
114 const Lane = Vector(4, u32);113 const Lane = @Vector(4, u32);
115114
116 inline fn shift(x: Lane, comptime n: comptime_int) Lane {115 inline fn shift(x: Lane, comptime n: comptime_int) Lane {
117 return x << @splat(4, @as(u5, n));116 return x << @splat(4, @as(u5, n));
lib/std/crypto/salsa20.zig+2-3
...@@ -5,7 +5,6 @@ const debug = std.debug;...@@ -5,7 +5,6 @@ const debug = std.debug;
5const math = std.math;5const math = std.math;
6const mem = std.mem;6const mem = std.mem;
7const utils = std.crypto.utils;7const utils = std.crypto.utils;
8const Vector = std.meta.Vector;
98
10const Poly1305 = crypto.onetimeauth.Poly1305;9const Poly1305 = crypto.onetimeauth.Poly1305;
11const Blake2b = crypto.hash.blake2.Blake2b;10const Blake2b = crypto.hash.blake2.Blake2b;
...@@ -16,8 +15,8 @@ const IdentityElementError = crypto.errors.IdentityElementError;...@@ -16,8 +15,8 @@ const IdentityElementError = crypto.errors.IdentityElementError;
16const WeakPublicKeyError = crypto.errors.WeakPublicKeyError;15const WeakPublicKeyError = crypto.errors.WeakPublicKeyError;
1716
18const Salsa20VecImpl = struct {17const Salsa20VecImpl = struct {
19 const Lane = Vector(4, u32);18 const Lane = @Vector(4, u32);
20 const Half = Vector(2, u32);19 const Half = @Vector(2, u32);
21 const BlockVec = [4]Lane;20 const BlockVec = [4]Lane;
2221
23 fn initContext(key: [8]u32, d: [4]u32) BlockVec {22 fn initContext(key: [8]u32, d: [4]u32) BlockVec {
lib/std/crypto/utils.zig+5-5
...@@ -149,11 +149,11 @@ test "crypto.utils.timingSafeEql (vectors)" {...@@ -149,11 +149,11 @@ test "crypto.utils.timingSafeEql (vectors)" {
149 var b: [100]u8 = undefined;149 var b: [100]u8 = undefined;
150 random.bytes(a[0..]);150 random.bytes(a[0..]);
151 random.bytes(b[0..]);151 random.bytes(b[0..]);
152 const v1: std.meta.Vector(100, u8) = a;152 const v1: @Vector(100, u8) = a;
153 const v2: std.meta.Vector(100, u8) = b;153 const v2: @Vector(100, u8) = b;
154 try testing.expect(!timingSafeEql(std.meta.Vector(100, u8), v1, v2));154 try testing.expect(!timingSafeEql(@Vector(100, u8), v1, v2));
155 const v3: std.meta.Vector(100, u8) = a;155 const v3: @Vector(100, u8) = a;
156 try testing.expect(timingSafeEql(std.meta.Vector(100, u8), v1, v3));156 try testing.expect(timingSafeEql(@Vector(100, u8), v1, v3));
157}157}
158158
159test "crypto.utils.timingSafeCompare" {159test "crypto.utils.timingSafeCompare" {
lib/std/fmt.zig+3-3
...@@ -2594,9 +2594,9 @@ test "vector" {...@@ -2594,9 +2594,9 @@ test "vector" {
2594 return error.SkipZigTest;2594 return error.SkipZigTest;
2595 }2595 }
25962596
2597 const vbool: std.meta.Vector(4, bool) = [_]bool{ true, false, true, false };2597 const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false };
2598 const vi64: std.meta.Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };2598 const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 };
2599 const vu64: std.meta.Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };2599 const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 };
26002600
2601 try expectFmt("{ true, false, true, false }", "{}", .{vbool});2601 try expectFmt("{ true, false, true, false }", "{}", .{vbool});
2602 try expectFmt("{ -2, -1, 0, 1 }", "{}", .{vi64});2602 try expectFmt("{ -2, -1, 0, 1 }", "{}", .{vi64});
lib/std/math.zig+10-10
...@@ -524,9 +524,9 @@ test "shl" {...@@ -524,9 +524,9 @@ test "shl" {
524 try testing.expect(shl(u8, 0b11111111, 8) == 0);524 try testing.expect(shl(u8, 0b11111111, 8) == 0);
525 try testing.expect(shl(u8, 0b11111111, 9) == 0);525 try testing.expect(shl(u8, 0b11111111, 9) == 0);
526 try testing.expect(shl(u8, 0b11111111, -2) == 0b00111111);526 try testing.expect(shl(u8, 0b11111111, -2) == 0b00111111);
527 try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) << 1);527 try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) << 1);
528 try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) >> 1);528 try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) >> 1);
529 try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, 33)[0] == 0);529 try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, 33)[0] == 0);
530}530}
531531
532/// Shifts right. Overflowed bits are truncated.532/// Shifts right. Overflowed bits are truncated.
...@@ -564,9 +564,9 @@ test "shr" {...@@ -564,9 +564,9 @@ test "shr" {
564 try testing.expect(shr(u8, 0b11111111, 8) == 0);564 try testing.expect(shr(u8, 0b11111111, 8) == 0);
565 try testing.expect(shr(u8, 0b11111111, 9) == 0);565 try testing.expect(shr(u8, 0b11111111, 9) == 0);
566 try testing.expect(shr(u8, 0b11111111, -2) == 0b11111100);566 try testing.expect(shr(u8, 0b11111111, -2) == 0b11111100);
567 try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) >> 1);567 try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) >> 1);
568 try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) << 1);568 try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) << 1);
569 try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, 33)[0] == 0);569 try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, 33)[0] == 0);
570}570}
571571
572/// Rotates right. Only unsigned values can be rotated. Negative shift572/// Rotates right. Only unsigned values can be rotated. Negative shift
...@@ -593,8 +593,8 @@ test "rotr" {...@@ -593,8 +593,8 @@ test "rotr" {
593 try testing.expect(rotr(u8, 0b00000001, @as(usize, 8)) == 0b00000001);593 try testing.expect(rotr(u8, 0b00000001, @as(usize, 8)) == 0b00000001);
594 try testing.expect(rotr(u8, 0b00000001, @as(usize, 4)) == 0b00010000);594 try testing.expect(rotr(u8, 0b00000001, @as(usize, 4)) == 0b00010000);
595 try testing.expect(rotr(u8, 0b00000001, @as(isize, -1)) == 0b00000010);595 try testing.expect(rotr(u8, 0b00000001, @as(isize, -1)) == 0b00000010);
596 try testing.expect(rotr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1}, @as(usize, 1))[0] == @as(u32, 1) << 31);596 try testing.expect(rotr(@Vector(1, u32), @Vector(1, u32){1}, @as(usize, 1))[0] == @as(u32, 1) << 31);
597 try testing.expect(rotr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1}, @as(isize, -1))[0] == @as(u32, 1) << 1);597 try testing.expect(rotr(@Vector(1, u32), @Vector(1, u32){1}, @as(isize, -1))[0] == @as(u32, 1) << 1);
598}598}
599599
600/// Rotates left. Only unsigned values can be rotated. Negative shift600/// Rotates left. Only unsigned values can be rotated. Negative shift
...@@ -621,8 +621,8 @@ test "rotl" {...@@ -621,8 +621,8 @@ test "rotl" {
621 try testing.expect(rotl(u8, 0b00000001, @as(usize, 8)) == 0b00000001);621 try testing.expect(rotl(u8, 0b00000001, @as(usize, 8)) == 0b00000001);
622 try testing.expect(rotl(u8, 0b00000001, @as(usize, 4)) == 0b00010000);622 try testing.expect(rotl(u8, 0b00000001, @as(usize, 4)) == 0b00010000);
623 try testing.expect(rotl(u8, 0b00000001, @as(isize, -1)) == 0b10000000);623 try testing.expect(rotl(u8, 0b00000001, @as(isize, -1)) == 0b10000000);
624 try testing.expect(rotl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1 << 31}, @as(usize, 1))[0] == 1);624 try testing.expect(rotl(@Vector(1, u32), @Vector(1, u32){1 << 31}, @as(usize, 1))[0] == 1);
625 try testing.expect(rotl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1 << 31}, @as(isize, -1))[0] == @as(u32, 1) << 30);625 try testing.expect(rotl(@Vector(1, u32), @Vector(1, u32){1 << 31}, @as(isize, -1))[0] == @as(u32, 1) << 30);
626}626}
627627
628/// Returns an unsigned int type that can hold the number of bits in T628/// Returns an unsigned int type that can hold the number of bits in T
lib/std/simd.zig+37-39
...@@ -6,8 +6,6 @@...@@ -6,8 +6,6 @@
6const std = @import("std");6const std = @import("std");
7const builtin = @import("builtin");7const builtin = @import("builtin");
88
9pub const Vector = std.meta.Vector;
10
11pub fn suggestVectorSizeForCpu(comptime T: type, cpu: std.Target.Cpu) ?usize {9pub fn suggestVectorSizeForCpu(comptime T: type, cpu: std.Target.Cpu) ?usize {
12 switch (cpu.arch) {10 switch (cpu.arch) {
13 .x86_64 => {11 .x86_64 => {
...@@ -55,7 +53,7 @@ pub fn VectorCount(comptime VectorType: type) type {...@@ -55,7 +53,7 @@ pub fn VectorCount(comptime VectorType: type) type {
5553
56/// Returns a vector containing the first `len` integers in order from 0 to `len`-1.54/// Returns a vector containing the first `len` integers in order from 0 to `len`-1.
57/// For example, `iota(i32, 8)` will return a vector containing `.{0, 1, 2, 3, 4, 5, 6, 7}`.55/// For example, `iota(i32, 8)` will return a vector containing `.{0, 1, 2, 3, 4, 5, 6, 7}`.
58pub fn iota(comptime T: type, comptime len: usize) Vector(len, T) {56pub fn iota(comptime T: type, comptime len: usize) @Vector(len, T) {
59 var out: [len]T = undefined;57 var out: [len]T = undefined;
60 for (out) |*element, i| {58 for (out) |*element, i| {
61 element.* = switch (@typeInfo(T)) {59 element.* = switch (@typeInfo(T)) {
...@@ -64,12 +62,12 @@ pub fn iota(comptime T: type, comptime len: usize) Vector(len, T) {...@@ -64,12 +62,12 @@ pub fn iota(comptime T: type, comptime len: usize) Vector(len, T) {
64 else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."),62 else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."),
65 };63 };
66 }64 }
67 return @as(Vector(len, T), out);65 return @as(@Vector(len, T), out);
68}66}
6967
70/// Returns a vector containing the same elements as the input, but repeated until the desired length is reached.68/// Returns a vector containing the same elements as the input, but repeated until the desired length is reached.
71/// For example, `repeat(8, [_]u32{1, 2, 3})` will return a vector containing `.{1, 2, 3, 1, 2, 3, 1, 2}`.69/// For example, `repeat(8, [_]u32{1, 2, 3})` will return a vector containing `.{1, 2, 3, 1, 2, 3, 1, 2}`.
72pub fn repeat(comptime len: usize, vec: anytype) Vector(len, std.meta.Child(@TypeOf(vec))) {70pub fn repeat(comptime len: usize, vec: anytype) @Vector(len, std.meta.Child(@TypeOf(vec))) {
73 const Child = std.meta.Child(@TypeOf(vec));71 const Child = std.meta.Child(@TypeOf(vec));
7472
75 return @shuffle(Child, vec, undefined, iota(i32, len) % @splat(len, @intCast(i32, vectorLength(@TypeOf(vec)))));73 return @shuffle(Child, vec, undefined, iota(i32, len) % @splat(len, @intCast(i32, vectorLength(@TypeOf(vec)))));
...@@ -77,7 +75,7 @@ pub fn repeat(comptime len: usize, vec: anytype) Vector(len, std.meta.Child(@Typ...@@ -77,7 +75,7 @@ pub fn repeat(comptime len: usize, vec: anytype) Vector(len, std.meta.Child(@Typ
7775
78/// Returns a vector containing all elements of the first vector at the lower indices followed by all elements of the second vector76/// Returns a vector containing all elements of the first vector at the lower indices followed by all elements of the second vector
79/// at the higher indices.77/// at the higher indices.
80pub fn join(a: anytype, b: anytype) Vector(vectorLength(@TypeOf(a)) + vectorLength(@TypeOf(b)), std.meta.Child(@TypeOf(a))) {78pub fn join(a: anytype, b: anytype) @Vector(vectorLength(@TypeOf(a)) + vectorLength(@TypeOf(b)), std.meta.Child(@TypeOf(a))) {
81 const Child = std.meta.Child(@TypeOf(a));79 const Child = std.meta.Child(@TypeOf(a));
82 const a_len = vectorLength(@TypeOf(a));80 const a_len = vectorLength(@TypeOf(a));
83 const b_len = vectorLength(@TypeOf(b));81 const b_len = vectorLength(@TypeOf(b));
...@@ -87,7 +85,7 @@ pub fn join(a: anytype, b: anytype) Vector(vectorLength(@TypeOf(a)) + vectorLeng...@@ -87,7 +85,7 @@ pub fn join(a: anytype, b: anytype) Vector(vectorLength(@TypeOf(a)) + vectorLeng
8785
88/// Returns a vector whose elements alternates between those of each input vector.86/// Returns a vector whose elements alternates between those of each input vector.
89/// For example, `interlace(.{[4]u32{11, 12, 13, 14}, [4]u32{21, 22, 23, 24}})` returns a vector containing `.{11, 21, 12, 22, 13, 23, 14, 24}`.87/// For example, `interlace(.{[4]u32{11, 12, 13, 14}, [4]u32{21, 22, 23, 24}})` returns a vector containing `.{11, 21, 12, 22, 13, 23, 14, 24}`.
90pub fn interlace(vecs: anytype) Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0]))) {88pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0]))) {
91 // interlace doesn't work on MIPS, for some reason.89 // interlace doesn't work on MIPS, for some reason.
92 // Notes from earlier debug attempt:90 // Notes from earlier debug attempt:
93 // The indices are correct. The problem seems to be with the @shuffle builtin.91 // The indices are correct. The problem seems to be with the @shuffle builtin.
...@@ -128,14 +126,14 @@ pub fn interlace(vecs: anytype) Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len...@@ -128,14 +126,14 @@ pub fn interlace(vecs: anytype) Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len
128pub fn deinterlace(126pub fn deinterlace(
129 comptime vec_count: usize,127 comptime vec_count: usize,
130 interlaced: anytype,128 interlaced: anytype,
131) [vec_count]Vector(129) [vec_count]@Vector(
132 vectorLength(@TypeOf(interlaced)) / vec_count,130 vectorLength(@TypeOf(interlaced)) / vec_count,
133 std.meta.Child(@TypeOf(interlaced)),131 std.meta.Child(@TypeOf(interlaced)),
134) {132) {
135 const vec_len = vectorLength(@TypeOf(interlaced)) / vec_count;133 const vec_len = vectorLength(@TypeOf(interlaced)) / vec_count;
136 const Child = std.meta.Child(@TypeOf(interlaced));134 const Child = std.meta.Child(@TypeOf(interlaced));
137135
138 var out: [vec_count]Vector(vec_len, Child) = undefined;136 var out: [vec_count]@Vector(vec_len, Child) = undefined;
139137
140 comptime var i: usize = 0; // for-loops don't work for this, apparently.138 comptime var i: usize = 0; // for-loops don't work for this, apparently.
141 inline while (i < out.len) : (i += 1) {139 inline while (i < out.len) : (i += 1) {
...@@ -150,7 +148,7 @@ pub fn extract(...@@ -150,7 +148,7 @@ pub fn extract(
150 vec: anytype,148 vec: anytype,
151 comptime first: VectorIndex(@TypeOf(vec)),149 comptime first: VectorIndex(@TypeOf(vec)),
152 comptime count: VectorCount(@TypeOf(vec)),150 comptime count: VectorCount(@TypeOf(vec)),
153) Vector(count, std.meta.Child(@TypeOf(vec))) {151) @Vector(count, std.meta.Child(@TypeOf(vec))) {
154 const Child = std.meta.Child(@TypeOf(vec));152 const Child = std.meta.Child(@TypeOf(vec));
155 const len = vectorLength(@TypeOf(vec));153 const len = vectorLength(@TypeOf(vec));
156154
...@@ -160,15 +158,15 @@ pub fn extract(...@@ -160,15 +158,15 @@ pub fn extract(
160}158}
161159
162test "vector patterns" {160test "vector patterns" {
163 const base = Vector(4, u32){ 10, 20, 30, 40 };161 const base = @Vector(4, u32){ 10, 20, 30, 40 };
164 const other_base = Vector(4, u32){ 55, 66, 77, 88 };162 const other_base = @Vector(4, u32){ 55, 66, 77, 88 };
165163
166 const small_bases = [5]Vector(2, u8){164 const small_bases = [5]@Vector(2, u8){
167 Vector(2, u8){ 0, 1 },165 @Vector(2, u8){ 0, 1 },
168 Vector(2, u8){ 2, 3 },166 @Vector(2, u8){ 2, 3 },
169 Vector(2, u8){ 4, 5 },167 @Vector(2, u8){ 4, 5 },
170 Vector(2, u8){ 6, 7 },168 @Vector(2, u8){ 6, 7 },
171 Vector(2, u8){ 8, 9 },169 @Vector(2, u8){ 8, 9 },
172 };170 };
173171
174 try std.testing.expectEqual([6]u32{ 10, 20, 30, 40, 10, 20 }, repeat(6, base));172 try std.testing.expectEqual([6]u32{ 10, 20, 30, 40, 10, 20 }, repeat(6, base));
...@@ -228,7 +226,7 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {...@@ -228,7 +226,7 @@ pub fn reverseOrder(vec: anytype) @TypeOf(vec) {
228}226}
229227
230test "vector shifting" {228test "vector shifting" {
231 const base = Vector(4, u32){ 10, 20, 30, 40 };229 const base = @Vector(4, u32){ 10, 20, 30, 40 };
232230
233 try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999));231 try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999));
234 try std.testing.expectEqual([4]u32{ 999, 999, 10, 20 }, shiftElementsRight(base, 2, 999));232 try std.testing.expectEqual([4]u32{ 999, 999, 10, 20 }, shiftElementsRight(base, 2, 999));
...@@ -286,7 +284,7 @@ pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec)))...@@ -286,7 +284,7 @@ pub fn countElementsWithValue(vec: anytype, value: std.meta.Child(@TypeOf(vec)))
286}284}
287285
288test "vector searching" {286test "vector searching" {
289 const base = Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };287 const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 };
290288
291 try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4));289 try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4));
292 try std.testing.expectEqual(@as(?u3, 4), lastIndexOfValue(base, 4));290 try std.testing.expectEqual(@as(?u3, 4), lastIndexOfValue(base, 4));
...@@ -382,28 +380,28 @@ test "vector prefix scan" {...@@ -382,28 +380,28 @@ test "vector prefix scan" {
382 return error.SkipZigTest;380 return error.SkipZigTest;
383 }381 }
384382
385 const int_base = Vector(4, i32){ 11, 23, 9, -21 };383 const int_base = @Vector(4, i32){ 11, 23, 9, -21 };
386 const float_base = Vector(4, f32){ 2, 0.5, -10, 6.54321 };384 const float_base = @Vector(4, f32){ 2, 0.5, -10, 6.54321 };
387 const bool_base = Vector(4, bool){ true, false, true, false };385 const bool_base = @Vector(4, bool){ true, false, true, false };
388386
389 try std.testing.expectEqual(iota(u8, 32) + @splat(32, @as(u8, 1)), prefixScan(.Add, 1, @splat(32, @as(u8, 1))));387 try std.testing.expectEqual(iota(u8, 32) + @splat(32, @as(u8, 1)), prefixScan(.Add, 1, @splat(32, @as(u8, 1))));
390 try std.testing.expectEqual(Vector(4, i32){ 11, 3, 1, 1 }, prefixScan(.And, 1, int_base));388 try std.testing.expectEqual(@Vector(4, i32){ 11, 3, 1, 1 }, prefixScan(.And, 1, int_base));
391 try std.testing.expectEqual(Vector(4, i32){ 11, 31, 31, -1 }, prefixScan(.Or, 1, int_base));389 try std.testing.expectEqual(@Vector(4, i32){ 11, 31, 31, -1 }, prefixScan(.Or, 1, int_base));
392 try std.testing.expectEqual(Vector(4, i32){ 11, 28, 21, -2 }, prefixScan(.Xor, 1, int_base));390 try std.testing.expectEqual(@Vector(4, i32){ 11, 28, 21, -2 }, prefixScan(.Xor, 1, int_base));
393 try std.testing.expectEqual(Vector(4, i32){ 11, 34, 43, 22 }, prefixScan(.Add, 1, int_base));391 try std.testing.expectEqual(@Vector(4, i32){ 11, 34, 43, 22 }, prefixScan(.Add, 1, int_base));
394 try std.testing.expectEqual(Vector(4, i32){ 11, 253, 2277, -47817 }, prefixScan(.Mul, 1, int_base));392 try std.testing.expectEqual(@Vector(4, i32){ 11, 253, 2277, -47817 }, prefixScan(.Mul, 1, int_base));
395 try std.testing.expectEqual(Vector(4, i32){ 11, 11, 9, -21 }, prefixScan(.Min, 1, int_base));393 try std.testing.expectEqual(@Vector(4, i32){ 11, 11, 9, -21 }, prefixScan(.Min, 1, int_base));
396 try std.testing.expectEqual(Vector(4, i32){ 11, 23, 23, 23 }, prefixScan(.Max, 1, int_base));394 try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 23, 23 }, prefixScan(.Max, 1, int_base));
397395
398 // Trying to predict all inaccuracies when adding and multiplying floats with prefixScans would be a mess, so we don't test those.396 // Trying to predict all inaccuracies when adding and multiplying floats with prefixScans would be a mess, so we don't test those.
399 try std.testing.expectEqual(Vector(4, f32){ 2, 0.5, -10, -10 }, prefixScan(.Min, 1, float_base));397 try std.testing.expectEqual(@Vector(4, f32){ 2, 0.5, -10, -10 }, prefixScan(.Min, 1, float_base));
400 try std.testing.expectEqual(Vector(4, f32){ 2, 2, 2, 6.54321 }, prefixScan(.Max, 1, float_base));398 try std.testing.expectEqual(@Vector(4, f32){ 2, 2, 2, 6.54321 }, prefixScan(.Max, 1, float_base));
401399
402 try std.testing.expectEqual(Vector(4, bool){ true, true, false, false }, prefixScan(.Xor, 1, bool_base));400 try std.testing.expectEqual(@Vector(4, bool){ true, true, false, false }, prefixScan(.Xor, 1, bool_base));
403 try std.testing.expectEqual(Vector(4, bool){ true, true, true, true }, prefixScan(.Or, 1, bool_base));401 try std.testing.expectEqual(@Vector(4, bool){ true, true, true, true }, prefixScan(.Or, 1, bool_base));
404 try std.testing.expectEqual(Vector(4, bool){ true, false, false, false }, prefixScan(.And, 1, bool_base));402 try std.testing.expectEqual(@Vector(4, bool){ true, false, false, false }, prefixScan(.And, 1, bool_base));
405403
406 try std.testing.expectEqual(Vector(4, i32){ 11, 23, 20, 2 }, prefixScan(.Add, 2, int_base));404 try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 20, 2 }, prefixScan(.Add, 2, int_base));
407 try std.testing.expectEqual(Vector(4, i32){ 22, 11, -12, -21 }, prefixScan(.Add, -1, int_base));405 try std.testing.expectEqual(@Vector(4, i32){ 22, 11, -12, -21 }, prefixScan(.Add, -1, int_base));
408 try std.testing.expectEqual(Vector(4, i32){ 11, 23, 9, -10 }, prefixScan(.Add, 3, int_base));406 try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 9, -10 }, prefixScan(.Add, 3, int_base));
409}407}
lib/std/special/compiler_rt/multi3.zig+1-1
...@@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {...@@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 {
17 return r.all;17 return r.all;
18}18}
1919
20const v128 = std.meta.Vector(2, u64);20const v128 = @Vector(2, u64);
21pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {21pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 {
22 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{22 return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{
23 @bitCast(i128, a),23 @bitCast(i128, a),
lib/std/target.zig+3-5
...@@ -673,8 +673,7 @@ pub const Target = struct {...@@ -673,8 +673,7 @@ pub const Target = struct {
673673
674 /// Adds the specified feature set but not its dependencies.674 /// Adds the specified feature set but not its dependencies.
675 pub fn addFeatureSet(set: *Set, other_set: Set) void {675 pub fn addFeatureSet(set: *Set, other_set: Set) void {
676 set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) |676 set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints);
677 @as(std.meta.Vector(usize_count, usize), other_set.ints);
678 }677 }
679678
680 /// Removes the specified feature but not its dependents.679 /// Removes the specified feature but not its dependents.
...@@ -686,8 +685,7 @@ pub const Target = struct {...@@ -686,8 +685,7 @@ pub const Target = struct {
686685
687 /// Removes the specified feature but not its dependents.686 /// Removes the specified feature but not its dependents.
688 pub fn removeFeatureSet(set: *Set, other_set: Set) void {687 pub fn removeFeatureSet(set: *Set, other_set: Set) void {
689 set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) &688 set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints);
690 ~@as(std.meta.Vector(usize_count, usize), other_set.ints);
691 }689 }
692690
693 pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void {691 pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void {
...@@ -716,7 +714,7 @@ pub const Target = struct {...@@ -716,7 +714,7 @@ pub const Target = struct {
716 }714 }
717715
718 pub fn isSuperSetOf(set: Set, other_set: Set) bool {716 pub fn isSuperSetOf(set: Set, other_set: Set) bool {
719 const V = std.meta.Vector(usize_count, usize);717 const V = @Vector(usize_count, usize);
720 const set_v: V = set.ints;718 const set_v: V = set.ints;
721 const other_v: V = other_set.ints;719 const other_v: V = other_set.ints;
722 return @reduce(.And, (set_v & other_v) == other_v);720 return @reduce(.And, (set_v & other_v) == other_v);
test/behavior/floatop.zig+12-13
...@@ -4,7 +4,6 @@ const expect = std.testing.expect;...@@ -4,7 +4,6 @@ const expect = std.testing.expect;
4const math = std.math;4const math = std.math;
5const pi = std.math.pi;5const pi = std.math.pi;
6const e = std.math.e;6const e = std.math.e;
7const Vector = std.meta.Vector;
8const has_f80_rt = switch (builtin.cpu.arch) {7const has_f80_rt = switch (builtin.cpu.arch) {
9 .x86_64, .i386 => true,8 .x86_64, .i386 => true,
10 else => false,9 else => false,
...@@ -120,7 +119,7 @@ fn testSqrt() !void {...@@ -120,7 +119,7 @@ fn testSqrt() !void {
120 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.0)), 1.4142135623730950, epsilon));119 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.0)), 1.4142135623730950, epsilon));
121120
122 {121 {
123 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };122 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };
124 var result = @sqrt(v);123 var result = @sqrt(v);
125 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 1.1)), result[0], epsilon));124 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 1.1)), result[0], epsilon));
126 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.2)), result[1], epsilon));125 try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.2)), result[1], epsilon));
...@@ -200,7 +199,7 @@ fn testSin() !void {...@@ -200,7 +199,7 @@ fn testSin() !void {
200 }199 }
201200
202 {201 {
203 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };202 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };
204 var result = @sin(v);203 var result = @sin(v);
205 try expect(math.approxEqAbs(f32, @sin(@as(f32, 1.1)), result[0], epsilon));204 try expect(math.approxEqAbs(f32, @sin(@as(f32, 1.1)), result[0], epsilon));
206 try expect(math.approxEqAbs(f32, @sin(@as(f32, 2.2)), result[1], epsilon));205 try expect(math.approxEqAbs(f32, @sin(@as(f32, 2.2)), result[1], epsilon));
...@@ -234,7 +233,7 @@ fn testCos() !void {...@@ -234,7 +233,7 @@ fn testCos() !void {
234 }233 }
235234
236 {235 {
237 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };236 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 };
238 var result = @cos(v);237 var result = @cos(v);
239 try expect(math.approxEqAbs(f32, @cos(@as(f32, 1.1)), result[0], epsilon));238 try expect(math.approxEqAbs(f32, @cos(@as(f32, 1.1)), result[0], epsilon));
240 try expect(math.approxEqAbs(f32, @cos(@as(f32, 2.2)), result[1], epsilon));239 try expect(math.approxEqAbs(f32, @cos(@as(f32, 2.2)), result[1], epsilon));
...@@ -263,7 +262,7 @@ fn testExp() !void {...@@ -263,7 +262,7 @@ fn testExp() !void {
263 }262 }
264263
265 {264 {
266 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };265 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };
267 var result = @exp(v);266 var result = @exp(v);
268 try expect(math.approxEqAbs(f32, @exp(@as(f32, 1.1)), result[0], epsilon));267 try expect(math.approxEqAbs(f32, @exp(@as(f32, 1.1)), result[0], epsilon));
269 try expect(math.approxEqAbs(f32, @exp(@as(f32, 2.2)), result[1], epsilon));268 try expect(math.approxEqAbs(f32, @exp(@as(f32, 2.2)), result[1], epsilon));
...@@ -292,7 +291,7 @@ fn testExp2() !void {...@@ -292,7 +291,7 @@ fn testExp2() !void {
292 }291 }
293292
294 {293 {
295 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };294 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };
296 var result = @exp2(v);295 var result = @exp2(v);
297 try expect(math.approxEqAbs(f32, @exp2(@as(f32, 1.1)), result[0], epsilon));296 try expect(math.approxEqAbs(f32, @exp2(@as(f32, 1.1)), result[0], epsilon));
298 try expect(math.approxEqAbs(f32, @exp2(@as(f32, 2.2)), result[1], epsilon));297 try expect(math.approxEqAbs(f32, @exp2(@as(f32, 2.2)), result[1], epsilon));
...@@ -332,7 +331,7 @@ fn testLog() !void {...@@ -332,7 +331,7 @@ fn testLog() !void {
332 }331 }
333}332}
334333
335test "@log with vectors" {334test "@log with @vectors" {
336 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO335 if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
337 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO336 if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
338 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO337 if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
...@@ -369,7 +368,7 @@ fn testLog2() !void {...@@ -369,7 +368,7 @@ fn testLog2() !void {
369 }368 }
370369
371 {370 {
372 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };371 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };
373 var result = @log2(v);372 var result = @log2(v);
374 try expect(@log2(@as(f32, 1.1)) == result[0]);373 try expect(@log2(@as(f32, 1.1)) == result[0]);
375 try expect(@log2(@as(f32, 2.2)) == result[1]);374 try expect(@log2(@as(f32, 2.2)) == result[1]);
...@@ -398,7 +397,7 @@ fn testLog10() !void {...@@ -398,7 +397,7 @@ fn testLog10() !void {
398 }397 }
399398
400 {399 {
401 var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };400 var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 };
402 var result = @log10(v);401 var result = @log10(v);
403 try expect(@log10(@as(f32, 1.1)) == result[0]);402 try expect(@log10(@as(f32, 1.1)) == result[0]);
404 try expect(@log10(@as(f32, 2.2)) == result[1]);403 try expect(@log10(@as(f32, 2.2)) == result[1]);
...@@ -436,7 +435,7 @@ fn testFabs() !void {...@@ -436,7 +435,7 @@ fn testFabs() !void {
436 // }435 // }
437436
438 {437 {
439 var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };438 var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };
440 var result = @fabs(v);439 var result = @fabs(v);
441 try expect(math.approxEqAbs(f32, @fabs(@as(f32, 1.1)), result[0], epsilon));440 try expect(math.approxEqAbs(f32, @fabs(@as(f32, 1.1)), result[0], epsilon));
442 try expect(math.approxEqAbs(f32, @fabs(@as(f32, -2.2)), result[1], epsilon));441 try expect(math.approxEqAbs(f32, @fabs(@as(f32, -2.2)), result[1], epsilon));
...@@ -469,7 +468,7 @@ fn testFloor() !void {...@@ -469,7 +468,7 @@ fn testFloor() !void {
469 // }468 // }
470469
471 {470 {
472 var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };471 var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };
473 var result = @floor(v);472 var result = @floor(v);
474 try expect(math.approxEqAbs(f32, @floor(@as(f32, 1.1)), result[0], epsilon));473 try expect(math.approxEqAbs(f32, @floor(@as(f32, 1.1)), result[0], epsilon));
475 try expect(math.approxEqAbs(f32, @floor(@as(f32, -2.2)), result[1], epsilon));474 try expect(math.approxEqAbs(f32, @floor(@as(f32, -2.2)), result[1], epsilon));
...@@ -502,7 +501,7 @@ fn testCeil() !void {...@@ -502,7 +501,7 @@ fn testCeil() !void {
502 // }501 // }
503502
504 {503 {
505 var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };504 var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };
506 var result = @ceil(v);505 var result = @ceil(v);
507 try expect(math.approxEqAbs(f32, @ceil(@as(f32, 1.1)), result[0], epsilon));506 try expect(math.approxEqAbs(f32, @ceil(@as(f32, 1.1)), result[0], epsilon));
508 try expect(math.approxEqAbs(f32, @ceil(@as(f32, -2.2)), result[1], epsilon));507 try expect(math.approxEqAbs(f32, @ceil(@as(f32, -2.2)), result[1], epsilon));
...@@ -535,7 +534,7 @@ fn testTrunc() !void {...@@ -535,7 +534,7 @@ fn testTrunc() !void {
535 // }534 // }
536535
537 {536 {
538 var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };537 var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 };
539 var result = @trunc(v);538 var result = @trunc(v);
540 try expect(math.approxEqAbs(f32, @trunc(@as(f32, 1.1)), result[0], epsilon));539 try expect(math.approxEqAbs(f32, @trunc(@as(f32, 1.1)), result[0], epsilon));
541 try expect(math.approxEqAbs(f32, @trunc(@as(f32, -2.2)), result[1], epsilon));540 try expect(math.approxEqAbs(f32, @trunc(@as(f32, -2.2)), result[1], epsilon));
test/behavior/math.zig+4-4
...@@ -1280,8 +1280,8 @@ test "vector integer addition" {...@@ -1280,8 +1280,8 @@ test "vector integer addition" {
12801280
1281 const S = struct {1281 const S = struct {
1282 fn doTheTest() !void {1282 fn doTheTest() !void {
1283 var a: std.meta.Vector(4, i32) = [_]i32{ 1, 2, 3, 4 };1283 var a: @Vector(4, i32) = [_]i32{ 1, 2, 3, 4 };
1284 var b: std.meta.Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };1284 var b: @Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };
1285 var result = a + b;1285 var result = a + b;
1286 var result_array: [4]i32 = result;1286 var result_array: [4]i32 = result;
1287 const expected = [_]i32{ 6, 8, 10, 12 };1287 const expected = [_]i32{ 6, 8, 10, 12 };
...@@ -1338,8 +1338,8 @@ test "vector comparison" {...@@ -1338,8 +1338,8 @@ test "vector comparison" {
13381338
1339 const S = struct {1339 const S = struct {
1340 fn doTheTest() !void {1340 fn doTheTest() !void {
1341 var a: std.meta.Vector(6, i32) = [_]i32{ 1, 3, -1, 5, 7, 9 };1341 var a: @Vector(6, i32) = [_]i32{ 1, 3, -1, 5, 7, 9 };
1342 var b: std.meta.Vector(6, i32) = [_]i32{ -1, 3, 0, 6, 10, -10 };1342 var b: @Vector(6, i32) = [_]i32{ -1, 3, 0, 6, 10, -10 };
1343 try expect(mem.eql(bool, &@as([6]bool, a < b), &[_]bool{ false, false, true, true, true, false }));1343 try expect(mem.eql(bool, &@as([6]bool, a < b), &[_]bool{ false, false, true, true, true, false }));
1344 try expect(mem.eql(bool, &@as([6]bool, a <= b), &[_]bool{ false, true, true, true, true, false }));1344 try expect(mem.eql(bool, &@as([6]bool, a <= b), &[_]bool{ false, true, true, true, true, false }));
1345 try expect(mem.eql(bool, &@as([6]bool, a == b), &[_]bool{ false, true, false, false, false, false }));1345 try expect(mem.eql(bool, &@as([6]bool, a == b), &[_]bool{ false, true, false, false, false, false }));
test/behavior/type.zig+3-3
...@@ -223,9 +223,9 @@ test "Type.Vector" {...@@ -223,9 +223,9 @@ test "Type.Vector" {
223 @Vector(0, u8),223 @Vector(0, u8),
224 @Vector(4, u8),224 @Vector(4, u8),
225 @Vector(8, *u8),225 @Vector(8, *u8),
226 std.meta.Vector(0, u8),226 @Vector(0, u8),
227 std.meta.Vector(4, u8),227 @Vector(4, u8),
228 std.meta.Vector(8, *u8),228 @Vector(8, *u8),
229 });229 });
230}230}
231231
test/behavior/type_info.zig+1-1
...@@ -447,7 +447,7 @@ test "type info: vectors" {...@@ -447,7 +447,7 @@ test "type info: vectors" {
447}447}
448448
449fn testVector() !void {449fn testVector() !void {
450 const vec_info = @typeInfo(std.meta.Vector(4, i32));450 const vec_info = @typeInfo(@Vector(4, i32));
451 try expect(vec_info == .Vector);451 try expect(vec_info == .Vector);
452 try expect(vec_info.Vector.len == 4);452 try expect(vec_info.Vector.len == 4);
453 try expect(vec_info.Vector.child == i32);453 try expect(vec_info.Vector.child == i32);
test/runtime_safety.zig+20-20
...@@ -711,12 +711,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -711,12 +711,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
711 \\ std.os.exit(126);711 \\ std.os.exit(126);
712 \\}712 \\}
713 \\pub fn main() void {713 \\pub fn main() void {
714 \\ var a: std.meta.Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 };714 \\ var a: @Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 };
715 \\ var b: std.meta.Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };715 \\ var b: @Vector(4, i32) = [_]i32{ 5, 6, 7, 8 };
716 \\ const x = add(a, b);716 \\ const x = add(a, b);
717 \\ _ = x;717 \\ _ = x;
718 \\}718 \\}
719 \\fn add(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) {719 \\fn add(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
720 \\ return a + b;720 \\ return a + b;
721 \\}721 \\}
722 );722 );
...@@ -729,12 +729,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -729,12 +729,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
729 \\ std.os.exit(126);729 \\ std.os.exit(126);
730 \\}730 \\}
731 \\pub fn main() void {731 \\pub fn main() void {
732 \\ var a: std.meta.Vector(4, u32) = [_]u32{ 1, 2, 8, 4 };732 \\ var a: @Vector(4, u32) = [_]u32{ 1, 2, 8, 4 };
733 \\ var b: std.meta.Vector(4, u32) = [_]u32{ 5, 6, 7, 8 };733 \\ var b: @Vector(4, u32) = [_]u32{ 5, 6, 7, 8 };
734 \\ const x = sub(b, a);734 \\ const x = sub(b, a);
735 \\ _ = x;735 \\ _ = x;
736 \\}736 \\}
737 \\fn sub(a: std.meta.Vector(4, u32), b: std.meta.Vector(4, u32)) std.meta.Vector(4, u32) {737 \\fn sub(a: @Vector(4, u32), b: @Vector(4, u32)) @Vector(4, u32) {
738 \\ return a - b;738 \\ return a - b;
739 \\}739 \\}
740 );740 );
...@@ -747,12 +747,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -747,12 +747,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
747 \\ std.os.exit(126);747 \\ std.os.exit(126);
748 \\}748 \\}
749 \\pub fn main() void {749 \\pub fn main() void {
750 \\ var a: std.meta.Vector(4, u8) = [_]u8{ 1, 2, 200, 4 };750 \\ var a: @Vector(4, u8) = [_]u8{ 1, 2, 200, 4 };
751 \\ var b: std.meta.Vector(4, u8) = [_]u8{ 5, 6, 2, 8 };751 \\ var b: @Vector(4, u8) = [_]u8{ 5, 6, 2, 8 };
752 \\ const x = mul(b, a);752 \\ const x = mul(b, a);
753 \\ _ = x;753 \\ _ = x;
754 \\}754 \\}
755 \\fn mul(a: std.meta.Vector(4, u8), b: std.meta.Vector(4, u8)) std.meta.Vector(4, u8) {755 \\fn mul(a: @Vector(4, u8), b: @Vector(4, u8)) @Vector(4, u8) {
756 \\ return a * b;756 \\ return a * b;
757 \\}757 \\}
758 );758 );
...@@ -765,11 +765,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -765,11 +765,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
765 \\ std.os.exit(126);765 \\ std.os.exit(126);
766 \\}766 \\}
767 \\pub fn main() void {767 \\pub fn main() void {
768 \\ var a: std.meta.Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 };768 \\ var a: @Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 };
769 \\ const x = neg(a);769 \\ const x = neg(a);
770 \\ _ = x;770 \\ _ = x;
771 \\}771 \\}
772 \\fn neg(a: std.meta.Vector(4, i16)) std.meta.Vector(4, i16) {772 \\fn neg(a: @Vector(4, i16)) @Vector(4, i16) {
773 \\ return -a;773 \\ return -a;
774 \\}774 \\}
775 );775 );
...@@ -846,12 +846,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -846,12 +846,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
846 \\ std.os.exit(126);846 \\ std.os.exit(126);
847 \\}847 \\}
848 \\pub fn main() !void {848 \\pub fn main() !void {
849 \\ var a: std.meta.Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 };849 \\ var a: @Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 };
850 \\ var b: std.meta.Vector(4, i16) = [_]i16{ 1, 2, -1, 4 };850 \\ var b: @Vector(4, i16) = [_]i16{ 1, 2, -1, 4 };
851 \\ const x = div(a, b);851 \\ const x = div(a, b);
852 \\ if (x[2] == 32767) return error.Whatever;852 \\ if (x[2] == 32767) return error.Whatever;
853 \\}853 \\}
854 \\fn div(a: std.meta.Vector(4, i16), b: std.meta.Vector(4, i16)) std.meta.Vector(4, i16) {854 \\fn div(a: @Vector(4, i16), b: @Vector(4, i16)) @Vector(4, i16) {
855 \\ return @divTrunc(a, b);855 \\ return @divTrunc(a, b);
856 \\}856 \\}
857 );857 );
...@@ -944,12 +944,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -944,12 +944,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
944 \\ std.os.exit(126);944 \\ std.os.exit(126);
945 \\}945 \\}
946 \\pub fn main() void {946 \\pub fn main() void {
947 \\ var a: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 444};947 \\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444};
948 \\ var b: std.meta.Vector(4, i32) = [4]i32{111, 0, 333, 444};948 \\ var b: @Vector(4, i32) = [4]i32{111, 0, 333, 444};
949 \\ const x = div0(a, b);949 \\ const x = div0(a, b);
950 \\ _ = x;950 \\ _ = x;
951 \\}951 \\}
952 \\fn div0(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) {952 \\fn div0(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
953 \\ return @divTrunc(a, b);953 \\ return @divTrunc(a, b);
954 \\}954 \\}
955 );955 );
...@@ -978,12 +978,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {...@@ -978,12 +978,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void {
978 \\ std.os.exit(126);978 \\ std.os.exit(126);
979 \\}979 \\}
980 \\pub fn main() !void {980 \\pub fn main() !void {
981 \\ var a: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 444};981 \\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444};
982 \\ var b: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 441};982 \\ var b: @Vector(4, i32) = [4]i32{111, 222, 333, 441};
983 \\ const x = divExact(a, b);983 \\ const x = divExact(a, b);
984 \\ _ = x;984 \\ _ = x;
985 \\}985 \\}
986 \\fn divExact(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) {986 \\fn divExact(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) {
987 \\ return @divExact(a, b);987 \\ return @divExact(a, b);
988 \\}988 \\}
989 );989 );