diff --git a/lib/std/crypto/aes/aesni.zig b/lib/std/crypto/aes/aesni.zig index b76e01e70b..27bda52c7b 100644 --- a/lib/std/crypto/aes/aesni.zig +++ b/lib/std/crypto/aes/aesni.zig @@ -2,9 +2,7 @@ const std = @import("../../std.zig"); const builtin = @import("builtin"); const mem = std.mem; const debug = std.debug; -const Vector = std.meta.Vector; - -const BlockVec = Vector(2, u64); +const BlockVec = @Vector(2, u64); /// A single AES block. pub const Block = struct { diff --git a/lib/std/crypto/aes/armcrypto.zig b/lib/std/crypto/aes/armcrypto.zig index 6d3c1e8ddf..b3ff7ff217 100644 --- a/lib/std/crypto/aes/armcrypto.zig +++ b/lib/std/crypto/aes/armcrypto.zig @@ -1,9 +1,7 @@ const std = @import("../../std.zig"); const mem = std.mem; const debug = std.debug; -const Vector = std.meta.Vector; - -const BlockVec = Vector(2, u64); +const BlockVec = @Vector(2, u64); /// A single AES block. pub const Block = struct { @@ -29,7 +27,7 @@ pub const Block = struct { return mem.toBytes(x); } - const zero = Vector(2, u64){ 0, 0 }; + const zero = @Vector(2, u64){ 0, 0 }; /// Encrypt a block with a round key. pub inline fn encrypt(block: Block, round_key: Block) Block { @@ -182,7 +180,7 @@ fn KeySchedule(comptime Aes: type) type { return struct { const Self = @This(); - const zero = Vector(2, u64){ 0, 0 }; + const zero = @Vector(2, u64){ 0, 0 }; const mask1 = @Vector(16, u8){ 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12 }; const mask2 = @Vector(16, u8){ 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15, 12, 13, 14, 15 }; diff --git a/lib/std/crypto/chacha20.zig b/lib/std/crypto/chacha20.zig index 8655121ce0..2a43f4b94c 100644 --- a/lib/std/crypto/chacha20.zig +++ b/lib/std/crypto/chacha20.zig @@ -7,7 +7,6 @@ const mem = std.mem; const assert = std.debug.assert; const testing = std.testing; const maxInt = math.maxInt; -const Vector = std.meta.Vector; const Poly1305 = std.crypto.onetimeauth.Poly1305; const AuthenticationError = std.crypto.errors.AuthenticationError; @@ -79,7 +78,7 @@ pub const XChaCha8Poly1305 = XChaChaPoly1305(8); // Vectorized implementation of the core function fn ChaChaVecImpl(comptime rounds_nb: usize) type { return struct { - const Lane = Vector(4, u32); + const Lane = @Vector(4, u32); const BlockVec = [4]Lane; fn initContext(key: [8]u32, d: [4]u32) BlockVec { diff --git a/lib/std/crypto/ghash.zig b/lib/std/crypto/ghash.zig index c24c16ce77..f3fac0038e 100644 --- a/lib/std/crypto/ghash.zig +++ b/lib/std/crypto/ghash.zig @@ -92,23 +92,21 @@ pub const Ghash = struct { } inline fn clmul_pclmul(x: u64, y: u64) u64 { - const Vector = std.meta.Vector; const product = asm ( \\ vpclmulqdq $0x00, %[x], %[y], %[out] - : [out] "=x" (-> Vector(2, u64)), - : [x] "x" (@bitCast(Vector(2, u64), @as(u128, x))), - [y] "x" (@bitCast(Vector(2, u64), @as(u128, y))), + : [out] "=x" (-> @Vector(2, u64)), + : [x] "x" (@bitCast(@Vector(2, u64), @as(u128, x))), + [y] "x" (@bitCast(@Vector(2, u64), @as(u128, y))), ); return product[0]; } inline fn clmul_pmull(x: u64, y: u64) u64 { - const Vector = std.meta.Vector; const product = asm ( \\ pmull %[out].1q, %[x].1d, %[y].1d - : [out] "=w" (-> Vector(2, u64)), - : [x] "w" (@bitCast(Vector(2, u64), @as(u128, x))), - [y] "w" (@bitCast(Vector(2, u64), @as(u128, y))), + : [out] "=w" (-> @Vector(2, u64)), + : [x] "w" (@bitCast(@Vector(2, u64), @as(u128, x))), + [y] "w" (@bitCast(@Vector(2, u64), @as(u128, y))), ); return product[0]; } diff --git a/lib/std/crypto/gimli.zig b/lib/std/crypto/gimli.zig index 3e2fad4229..96a7d69e6f 100644 --- a/lib/std/crypto/gimli.zig +++ b/lib/std/crypto/gimli.zig @@ -15,7 +15,6 @@ const debug = std.debug; const assert = std.debug.assert; const testing = std.testing; const htest = @import("test.zig"); -const Vector = std.meta.Vector; const AuthenticationError = std.crypto.errors.AuthenticationError; pub const State = struct { @@ -111,7 +110,7 @@ pub const State = struct { self.endianSwap(); } - const Lane = Vector(4, u32); + const Lane = @Vector(4, u32); inline fn shift(x: Lane, comptime n: comptime_int) Lane { return x << @splat(4, @as(u5, n)); diff --git a/lib/std/crypto/salsa20.zig b/lib/std/crypto/salsa20.zig index 0e7d67b78f..7477b7ad69 100644 --- a/lib/std/crypto/salsa20.zig +++ b/lib/std/crypto/salsa20.zig @@ -5,7 +5,6 @@ const debug = std.debug; const math = std.math; const mem = std.mem; const utils = std.crypto.utils; -const Vector = std.meta.Vector; const Poly1305 = crypto.onetimeauth.Poly1305; const Blake2b = crypto.hash.blake2.Blake2b; @@ -16,8 +15,8 @@ const IdentityElementError = crypto.errors.IdentityElementError; const WeakPublicKeyError = crypto.errors.WeakPublicKeyError; const Salsa20VecImpl = struct { - const Lane = Vector(4, u32); - const Half = Vector(2, u32); + const Lane = @Vector(4, u32); + const Half = @Vector(2, u32); const BlockVec = [4]Lane; fn initContext(key: [8]u32, d: [4]u32) BlockVec { diff --git a/lib/std/crypto/utils.zig b/lib/std/crypto/utils.zig index 7cdb79d00b..0a3540d895 100644 --- a/lib/std/crypto/utils.zig +++ b/lib/std/crypto/utils.zig @@ -149,11 +149,11 @@ test "crypto.utils.timingSafeEql (vectors)" { var b: [100]u8 = undefined; random.bytes(a[0..]); random.bytes(b[0..]); - const v1: std.meta.Vector(100, u8) = a; - const v2: std.meta.Vector(100, u8) = b; - try testing.expect(!timingSafeEql(std.meta.Vector(100, u8), v1, v2)); - const v3: std.meta.Vector(100, u8) = a; - try testing.expect(timingSafeEql(std.meta.Vector(100, u8), v1, v3)); + const v1: @Vector(100, u8) = a; + const v2: @Vector(100, u8) = b; + try testing.expect(!timingSafeEql(@Vector(100, u8), v1, v2)); + const v3: @Vector(100, u8) = a; + try testing.expect(timingSafeEql(@Vector(100, u8), v1, v3)); } test "crypto.utils.timingSafeCompare" { diff --git a/lib/std/fmt.zig b/lib/std/fmt.zig index 8ccb337cc4..395c502d61 100644 --- a/lib/std/fmt.zig +++ b/lib/std/fmt.zig @@ -2594,9 +2594,9 @@ test "vector" { return error.SkipZigTest; } - const vbool: std.meta.Vector(4, bool) = [_]bool{ true, false, true, false }; - const vi64: std.meta.Vector(4, i64) = [_]i64{ -2, -1, 0, 1 }; - const vu64: std.meta.Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 }; + const vbool: @Vector(4, bool) = [_]bool{ true, false, true, false }; + const vi64: @Vector(4, i64) = [_]i64{ -2, -1, 0, 1 }; + const vu64: @Vector(4, u64) = [_]u64{ 1000, 2000, 3000, 4000 }; try expectFmt("{ true, false, true, false }", "{}", .{vbool}); try expectFmt("{ -2, -1, 0, 1 }", "{}", .{vi64}); diff --git a/lib/std/math.zig b/lib/std/math.zig index 08019835f7..318d70c726 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -524,9 +524,9 @@ test "shl" { try testing.expect(shl(u8, 0b11111111, 8) == 0); try testing.expect(shl(u8, 0b11111111, 9) == 0); try testing.expect(shl(u8, 0b11111111, -2) == 0b00111111); - try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) << 1); - try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) >> 1); - try testing.expect(shl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, 33)[0] == 0); + try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) << 1); + try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) >> 1); + try testing.expect(shl(@Vector(1, u32), @Vector(1, u32){42}, 33)[0] == 0); } /// Shifts right. Overflowed bits are truncated. @@ -564,9 +564,9 @@ test "shr" { try testing.expect(shr(u8, 0b11111111, 8) == 0); try testing.expect(shr(u8, 0b11111111, 9) == 0); try testing.expect(shr(u8, 0b11111111, -2) == 0b11111100); - try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) >> 1); - try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) << 1); - try testing.expect(shr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){42}, 33)[0] == 0); + try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, @as(usize, 1))[0] == @as(u32, 42) >> 1); + try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, @as(isize, -1))[0] == @as(u32, 42) << 1); + try testing.expect(shr(@Vector(1, u32), @Vector(1, u32){42}, 33)[0] == 0); } /// Rotates right. Only unsigned values can be rotated. Negative shift @@ -593,8 +593,8 @@ test "rotr" { try testing.expect(rotr(u8, 0b00000001, @as(usize, 8)) == 0b00000001); try testing.expect(rotr(u8, 0b00000001, @as(usize, 4)) == 0b00010000); try testing.expect(rotr(u8, 0b00000001, @as(isize, -1)) == 0b00000010); - try testing.expect(rotr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1}, @as(usize, 1))[0] == @as(u32, 1) << 31); - try testing.expect(rotr(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1}, @as(isize, -1))[0] == @as(u32, 1) << 1); + try testing.expect(rotr(@Vector(1, u32), @Vector(1, u32){1}, @as(usize, 1))[0] == @as(u32, 1) << 31); + try testing.expect(rotr(@Vector(1, u32), @Vector(1, u32){1}, @as(isize, -1))[0] == @as(u32, 1) << 1); } /// Rotates left. Only unsigned values can be rotated. Negative shift @@ -621,8 +621,8 @@ test "rotl" { try testing.expect(rotl(u8, 0b00000001, @as(usize, 8)) == 0b00000001); try testing.expect(rotl(u8, 0b00000001, @as(usize, 4)) == 0b00010000); try testing.expect(rotl(u8, 0b00000001, @as(isize, -1)) == 0b10000000); - try testing.expect(rotl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1 << 31}, @as(usize, 1))[0] == 1); - try testing.expect(rotl(std.meta.Vector(1, u32), std.meta.Vector(1, u32){1 << 31}, @as(isize, -1))[0] == @as(u32, 1) << 30); + try testing.expect(rotl(@Vector(1, u32), @Vector(1, u32){1 << 31}, @as(usize, 1))[0] == 1); + try testing.expect(rotl(@Vector(1, u32), @Vector(1, u32){1 << 31}, @as(isize, -1))[0] == @as(u32, 1) << 30); } /// Returns an unsigned int type that can hold the number of bits in T diff --git a/lib/std/simd.zig b/lib/std/simd.zig index 50e0e99d37..02e08b0dad 100644 --- a/lib/std/simd.zig +++ b/lib/std/simd.zig @@ -6,8 +6,6 @@ const std = @import("std"); const builtin = @import("builtin"); -pub const Vector = std.meta.Vector; - pub fn suggestVectorSizeForCpu(comptime T: type, cpu: std.Target.Cpu) ?usize { switch (cpu.arch) { .x86_64 => { @@ -55,7 +53,7 @@ pub fn VectorCount(comptime VectorType: type) type { /// Returns a vector containing the first `len` integers in order from 0 to `len`-1. /// For example, `iota(i32, 8)` will return a vector containing `.{0, 1, 2, 3, 4, 5, 6, 7}`. -pub fn iota(comptime T: type, comptime len: usize) Vector(len, T) { +pub fn iota(comptime T: type, comptime len: usize) @Vector(len, T) { var out: [len]T = undefined; for (out) |*element, i| { element.* = switch (@typeInfo(T)) { @@ -64,12 +62,12 @@ pub fn iota(comptime T: type, comptime len: usize) Vector(len, T) { else => @compileError("Can't use type " ++ @typeName(T) ++ " in iota."), }; } - return @as(Vector(len, T), out); + return @as(@Vector(len, T), out); } /// Returns a vector containing the same elements as the input, but repeated until the desired length is reached. /// For example, `repeat(8, [_]u32{1, 2, 3})` will return a vector containing `.{1, 2, 3, 1, 2, 3, 1, 2}`. -pub fn repeat(comptime len: usize, vec: anytype) Vector(len, std.meta.Child(@TypeOf(vec))) { +pub fn repeat(comptime len: usize, vec: anytype) @Vector(len, std.meta.Child(@TypeOf(vec))) { const Child = std.meta.Child(@TypeOf(vec)); 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 /// Returns a vector containing all elements of the first vector at the lower indices followed by all elements of the second vector /// at the higher indices. -pub fn join(a: anytype, b: anytype) Vector(vectorLength(@TypeOf(a)) + vectorLength(@TypeOf(b)), std.meta.Child(@TypeOf(a))) { +pub fn join(a: anytype, b: anytype) @Vector(vectorLength(@TypeOf(a)) + vectorLength(@TypeOf(b)), std.meta.Child(@TypeOf(a))) { const Child = std.meta.Child(@TypeOf(a)); const a_len = vectorLength(@TypeOf(a)); const b_len = vectorLength(@TypeOf(b)); @@ -87,7 +85,7 @@ pub fn join(a: anytype, b: anytype) Vector(vectorLength(@TypeOf(a)) + vectorLeng /// Returns a vector whose elements alternates between those of each input vector. /// 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}`. -pub fn interlace(vecs: anytype) Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0]))) { +pub fn interlace(vecs: anytype) @Vector(vectorLength(@TypeOf(vecs[0])) * vecs.len, std.meta.Child(@TypeOf(vecs[0]))) { // interlace doesn't work on MIPS, for some reason. // Notes from earlier debug attempt: // 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 pub fn deinterlace( comptime vec_count: usize, interlaced: anytype, -) [vec_count]Vector( +) [vec_count]@Vector( vectorLength(@TypeOf(interlaced)) / vec_count, std.meta.Child(@TypeOf(interlaced)), ) { const vec_len = vectorLength(@TypeOf(interlaced)) / vec_count; const Child = std.meta.Child(@TypeOf(interlaced)); - var out: [vec_count]Vector(vec_len, Child) = undefined; + var out: [vec_count]@Vector(vec_len, Child) = undefined; comptime var i: usize = 0; // for-loops don't work for this, apparently. inline while (i < out.len) : (i += 1) { @@ -150,7 +148,7 @@ pub fn extract( vec: anytype, comptime first: VectorIndex(@TypeOf(vec)), comptime count: VectorCount(@TypeOf(vec)), -) Vector(count, std.meta.Child(@TypeOf(vec))) { +) @Vector(count, std.meta.Child(@TypeOf(vec))) { const Child = std.meta.Child(@TypeOf(vec)); const len = vectorLength(@TypeOf(vec)); @@ -160,15 +158,15 @@ pub fn extract( } test "vector patterns" { - const base = Vector(4, u32){ 10, 20, 30, 40 }; - const other_base = Vector(4, u32){ 55, 66, 77, 88 }; + const base = @Vector(4, u32){ 10, 20, 30, 40 }; + const other_base = @Vector(4, u32){ 55, 66, 77, 88 }; - const small_bases = [5]Vector(2, u8){ - Vector(2, u8){ 0, 1 }, - Vector(2, u8){ 2, 3 }, - Vector(2, u8){ 4, 5 }, - Vector(2, u8){ 6, 7 }, - Vector(2, u8){ 8, 9 }, + const small_bases = [5]@Vector(2, u8){ + @Vector(2, u8){ 0, 1 }, + @Vector(2, u8){ 2, 3 }, + @Vector(2, u8){ 4, 5 }, + @Vector(2, u8){ 6, 7 }, + @Vector(2, u8){ 8, 9 }, }; 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) { } test "vector shifting" { - const base = Vector(4, u32){ 10, 20, 30, 40 }; + const base = @Vector(4, u32){ 10, 20, 30, 40 }; try std.testing.expectEqual([4]u32{ 30, 40, 999, 999 }, shiftElementsLeft(base, 2, 999)); 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))) } test "vector searching" { - const base = Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 }; + const base = @Vector(8, u32){ 6, 4, 7, 4, 4, 2, 3, 7 }; try std.testing.expectEqual(@as(?u3, 1), firstIndexOfValue(base, 4)); try std.testing.expectEqual(@as(?u3, 4), lastIndexOfValue(base, 4)); @@ -382,28 +380,28 @@ test "vector prefix scan" { return error.SkipZigTest; } - const int_base = Vector(4, i32){ 11, 23, 9, -21 }; - const float_base = Vector(4, f32){ 2, 0.5, -10, 6.54321 }; - const bool_base = Vector(4, bool){ true, false, true, false }; + const int_base = @Vector(4, i32){ 11, 23, 9, -21 }; + const float_base = @Vector(4, f32){ 2, 0.5, -10, 6.54321 }; + const bool_base = @Vector(4, bool){ true, false, true, false }; try std.testing.expectEqual(iota(u8, 32) + @splat(32, @as(u8, 1)), prefixScan(.Add, 1, @splat(32, @as(u8, 1)))); - try std.testing.expectEqual(Vector(4, i32){ 11, 3, 1, 1 }, prefixScan(.And, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 31, 31, -1 }, prefixScan(.Or, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 28, 21, -2 }, prefixScan(.Xor, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 34, 43, 22 }, prefixScan(.Add, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 253, 2277, -47817 }, prefixScan(.Mul, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 11, 9, -21 }, prefixScan(.Min, 1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 23, 23, 23 }, prefixScan(.Max, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 3, 1, 1 }, prefixScan(.And, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 31, 31, -1 }, prefixScan(.Or, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 28, 21, -2 }, prefixScan(.Xor, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 34, 43, 22 }, prefixScan(.Add, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 253, 2277, -47817 }, prefixScan(.Mul, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 11, 9, -21 }, prefixScan(.Min, 1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 23, 23 }, prefixScan(.Max, 1, int_base)); // Trying to predict all inaccuracies when adding and multiplying floats with prefixScans would be a mess, so we don't test those. - try std.testing.expectEqual(Vector(4, f32){ 2, 0.5, -10, -10 }, prefixScan(.Min, 1, float_base)); - try std.testing.expectEqual(Vector(4, f32){ 2, 2, 2, 6.54321 }, prefixScan(.Max, 1, float_base)); + try std.testing.expectEqual(@Vector(4, f32){ 2, 0.5, -10, -10 }, prefixScan(.Min, 1, float_base)); + try std.testing.expectEqual(@Vector(4, f32){ 2, 2, 2, 6.54321 }, prefixScan(.Max, 1, float_base)); - try std.testing.expectEqual(Vector(4, bool){ true, true, false, false }, prefixScan(.Xor, 1, bool_base)); - try std.testing.expectEqual(Vector(4, bool){ true, true, true, true }, prefixScan(.Or, 1, bool_base)); - try std.testing.expectEqual(Vector(4, bool){ true, false, false, false }, prefixScan(.And, 1, bool_base)); + try std.testing.expectEqual(@Vector(4, bool){ true, true, false, false }, prefixScan(.Xor, 1, bool_base)); + try std.testing.expectEqual(@Vector(4, bool){ true, true, true, true }, prefixScan(.Or, 1, bool_base)); + try std.testing.expectEqual(@Vector(4, bool){ true, false, false, false }, prefixScan(.And, 1, bool_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 23, 20, 2 }, prefixScan(.Add, 2, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 22, 11, -12, -21 }, prefixScan(.Add, -1, int_base)); - try std.testing.expectEqual(Vector(4, i32){ 11, 23, 9, -10 }, prefixScan(.Add, 3, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 20, 2 }, prefixScan(.Add, 2, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 22, 11, -12, -21 }, prefixScan(.Add, -1, int_base)); + try std.testing.expectEqual(@Vector(4, i32){ 11, 23, 9, -10 }, prefixScan(.Add, 3, int_base)); } diff --git a/lib/std/special/compiler_rt/multi3.zig b/lib/std/special/compiler_rt/multi3.zig index 4e5c49730a..a088dbcf9e 100644 --- a/lib/std/special/compiler_rt/multi3.zig +++ b/lib/std/special/compiler_rt/multi3.zig @@ -17,7 +17,7 @@ pub fn __multi3(a: i128, b: i128) callconv(.C) i128 { return r.all; } -const v128 = std.meta.Vector(2, u64); +const v128 = @Vector(2, u64); pub fn __multi3_windows_x86_64(a: v128, b: v128) callconv(.C) v128 { return @bitCast(v128, @call(.{ .modifier = .always_inline }, __multi3, .{ @bitCast(i128, a), diff --git a/lib/std/target.zig b/lib/std/target.zig index 0b2a4a4df6..45a9c985b5 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -673,8 +673,7 @@ pub const Target = struct { /// Adds the specified feature set but not its dependencies. pub fn addFeatureSet(set: *Set, other_set: Set) void { - set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) | - @as(std.meta.Vector(usize_count, usize), other_set.ints); + set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints); } /// Removes the specified feature but not its dependents. @@ -686,8 +685,7 @@ pub const Target = struct { /// Removes the specified feature but not its dependents. pub fn removeFeatureSet(set: *Set, other_set: Set) void { - set.ints = @as(std.meta.Vector(usize_count, usize), set.ints) & - ~@as(std.meta.Vector(usize_count, usize), other_set.ints); + set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints); } pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void { @@ -716,7 +714,7 @@ pub const Target = struct { } pub fn isSuperSetOf(set: Set, other_set: Set) bool { - const V = std.meta.Vector(usize_count, usize); + const V = @Vector(usize_count, usize); const set_v: V = set.ints; const other_v: V = other_set.ints; return @reduce(.And, (set_v & other_v) == other_v); diff --git a/test/behavior/floatop.zig b/test/behavior/floatop.zig index f8445b6e26..6d8c33efa2 100644 --- a/test/behavior/floatop.zig +++ b/test/behavior/floatop.zig @@ -4,7 +4,6 @@ const expect = std.testing.expect; const math = std.math; const pi = std.math.pi; const e = std.math.e; -const Vector = std.meta.Vector; const has_f80_rt = switch (builtin.cpu.arch) { .x86_64, .i386 => true, else => false, @@ -120,7 +119,7 @@ fn testSqrt() !void { try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.0)), 1.4142135623730950, epsilon)); { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; var result = @sqrt(v); try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @sqrt(@as(f32, 2.2)), result[1], epsilon)); @@ -200,7 +199,7 @@ fn testSin() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; var result = @sin(v); try expect(math.approxEqAbs(f32, @sin(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @sin(@as(f32, 2.2)), result[1], epsilon)); @@ -234,7 +233,7 @@ fn testCos() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 3.3, 4.4 }; var result = @cos(v); try expect(math.approxEqAbs(f32, @cos(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @cos(@as(f32, 2.2)), result[1], epsilon)); @@ -263,7 +262,7 @@ fn testExp() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; var result = @exp(v); try expect(math.approxEqAbs(f32, @exp(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @exp(@as(f32, 2.2)), result[1], epsilon)); @@ -292,7 +291,7 @@ fn testExp2() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; var result = @exp2(v); try expect(math.approxEqAbs(f32, @exp2(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @exp2(@as(f32, 2.2)), result[1], epsilon)); @@ -332,7 +331,7 @@ fn testLog() !void { } } -test "@log with vectors" { +test "@log with @vectors" { if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO @@ -369,7 +368,7 @@ fn testLog2() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; var result = @log2(v); try expect(@log2(@as(f32, 1.1)) == result[0]); try expect(@log2(@as(f32, 2.2)) == result[1]); @@ -398,7 +397,7 @@ fn testLog10() !void { } { - var v: Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, 2.2, 0.3, 0.4 }; var result = @log10(v); try expect(@log10(@as(f32, 1.1)) == result[0]); try expect(@log10(@as(f32, 2.2)) == result[1]); @@ -436,7 +435,7 @@ fn testFabs() !void { // } { - var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; var result = @fabs(v); try expect(math.approxEqAbs(f32, @fabs(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @fabs(@as(f32, -2.2)), result[1], epsilon)); @@ -469,7 +468,7 @@ fn testFloor() !void { // } { - var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; var result = @floor(v); try expect(math.approxEqAbs(f32, @floor(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @floor(@as(f32, -2.2)), result[1], epsilon)); @@ -502,7 +501,7 @@ fn testCeil() !void { // } { - var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; var result = @ceil(v); try expect(math.approxEqAbs(f32, @ceil(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @ceil(@as(f32, -2.2)), result[1], epsilon)); @@ -535,7 +534,7 @@ fn testTrunc() !void { // } { - var v: Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; + var v: @Vector(4, f32) = [_]f32{ 1.1, -2.2, 0.3, -0.4 }; var result = @trunc(v); try expect(math.approxEqAbs(f32, @trunc(@as(f32, 1.1)), result[0], epsilon)); try expect(math.approxEqAbs(f32, @trunc(@as(f32, -2.2)), result[1], epsilon)); diff --git a/test/behavior/math.zig b/test/behavior/math.zig index 815c6e0efc..a79d20dcdb 100644 --- a/test/behavior/math.zig +++ b/test/behavior/math.zig @@ -1280,8 +1280,8 @@ test "vector integer addition" { const S = struct { fn doTheTest() !void { - var a: std.meta.Vector(4, i32) = [_]i32{ 1, 2, 3, 4 }; - var b: std.meta.Vector(4, i32) = [_]i32{ 5, 6, 7, 8 }; + var a: @Vector(4, i32) = [_]i32{ 1, 2, 3, 4 }; + var b: @Vector(4, i32) = [_]i32{ 5, 6, 7, 8 }; var result = a + b; var result_array: [4]i32 = result; const expected = [_]i32{ 6, 8, 10, 12 }; @@ -1338,8 +1338,8 @@ test "vector comparison" { const S = struct { fn doTheTest() !void { - var a: std.meta.Vector(6, i32) = [_]i32{ 1, 3, -1, 5, 7, 9 }; - var b: std.meta.Vector(6, i32) = [_]i32{ -1, 3, 0, 6, 10, -10 }; + var a: @Vector(6, i32) = [_]i32{ 1, 3, -1, 5, 7, 9 }; + var b: @Vector(6, i32) = [_]i32{ -1, 3, 0, 6, 10, -10 }; try expect(mem.eql(bool, &@as([6]bool, a < b), &[_]bool{ false, false, true, true, true, false })); try expect(mem.eql(bool, &@as([6]bool, a <= b), &[_]bool{ false, true, true, true, true, false })); try expect(mem.eql(bool, &@as([6]bool, a == b), &[_]bool{ false, true, false, false, false, false })); diff --git a/test/behavior/type.zig b/test/behavior/type.zig index 65bebff946..c543d4f969 100644 --- a/test/behavior/type.zig +++ b/test/behavior/type.zig @@ -223,9 +223,9 @@ test "Type.Vector" { @Vector(0, u8), @Vector(4, u8), @Vector(8, *u8), - std.meta.Vector(0, u8), - std.meta.Vector(4, u8), - std.meta.Vector(8, *u8), + @Vector(0, u8), + @Vector(4, u8), + @Vector(8, *u8), }); } diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig index 55c6e666ee..32b9671f96 100644 --- a/test/behavior/type_info.zig +++ b/test/behavior/type_info.zig @@ -447,7 +447,7 @@ test "type info: vectors" { } fn testVector() !void { - const vec_info = @typeInfo(std.meta.Vector(4, i32)); + const vec_info = @typeInfo(@Vector(4, i32)); try expect(vec_info == .Vector); try expect(vec_info.Vector.len == 4); try expect(vec_info.Vector.child == i32); diff --git a/test/runtime_safety.zig b/test/runtime_safety.zig index 6d68a2e1dd..0a1e7e00f3 100644 --- a/test/runtime_safety.zig +++ b/test/runtime_safety.zig @@ -711,12 +711,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() void { - \\ var a: std.meta.Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 }; - \\ var b: std.meta.Vector(4, i32) = [_]i32{ 5, 6, 7, 8 }; + \\ var a: @Vector(4, i32) = [_]i32{ 1, 2, 2147483643, 4 }; + \\ var b: @Vector(4, i32) = [_]i32{ 5, 6, 7, 8 }; \\ const x = add(a, b); \\ _ = x; \\} - \\fn add(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) { + \\fn add(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) { \\ return a + b; \\} ); @@ -729,12 +729,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() void { - \\ var a: std.meta.Vector(4, u32) = [_]u32{ 1, 2, 8, 4 }; - \\ var b: std.meta.Vector(4, u32) = [_]u32{ 5, 6, 7, 8 }; + \\ var a: @Vector(4, u32) = [_]u32{ 1, 2, 8, 4 }; + \\ var b: @Vector(4, u32) = [_]u32{ 5, 6, 7, 8 }; \\ const x = sub(b, a); \\ _ = x; \\} - \\fn sub(a: std.meta.Vector(4, u32), b: std.meta.Vector(4, u32)) std.meta.Vector(4, u32) { + \\fn sub(a: @Vector(4, u32), b: @Vector(4, u32)) @Vector(4, u32) { \\ return a - b; \\} ); @@ -747,12 +747,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() void { - \\ var a: std.meta.Vector(4, u8) = [_]u8{ 1, 2, 200, 4 }; - \\ var b: std.meta.Vector(4, u8) = [_]u8{ 5, 6, 2, 8 }; + \\ var a: @Vector(4, u8) = [_]u8{ 1, 2, 200, 4 }; + \\ var b: @Vector(4, u8) = [_]u8{ 5, 6, 2, 8 }; \\ const x = mul(b, a); \\ _ = x; \\} - \\fn mul(a: std.meta.Vector(4, u8), b: std.meta.Vector(4, u8)) std.meta.Vector(4, u8) { + \\fn mul(a: @Vector(4, u8), b: @Vector(4, u8)) @Vector(4, u8) { \\ return a * b; \\} ); @@ -765,11 +765,11 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() void { - \\ var a: std.meta.Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 }; + \\ var a: @Vector(4, i16) = [_]i16{ 1, -32768, 200, 4 }; \\ const x = neg(a); \\ _ = x; \\} - \\fn neg(a: std.meta.Vector(4, i16)) std.meta.Vector(4, i16) { + \\fn neg(a: @Vector(4, i16)) @Vector(4, i16) { \\ return -a; \\} ); @@ -846,12 +846,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() !void { - \\ var a: std.meta.Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 }; - \\ var b: std.meta.Vector(4, i16) = [_]i16{ 1, 2, -1, 4 }; + \\ var a: @Vector(4, i16) = [_]i16{ 1, 2, -32768, 4 }; + \\ var b: @Vector(4, i16) = [_]i16{ 1, 2, -1, 4 }; \\ const x = div(a, b); \\ if (x[2] == 32767) return error.Whatever; \\} - \\fn div(a: std.meta.Vector(4, i16), b: std.meta.Vector(4, i16)) std.meta.Vector(4, i16) { + \\fn div(a: @Vector(4, i16), b: @Vector(4, i16)) @Vector(4, i16) { \\ return @divTrunc(a, b); \\} ); @@ -944,12 +944,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() void { - \\ var a: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 444}; - \\ var b: std.meta.Vector(4, i32) = [4]i32{111, 0, 333, 444}; + \\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444}; + \\ var b: @Vector(4, i32) = [4]i32{111, 0, 333, 444}; \\ const x = div0(a, b); \\ _ = x; \\} - \\fn div0(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) { + \\fn div0(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) { \\ return @divTrunc(a, b); \\} ); @@ -978,12 +978,12 @@ pub fn addCases(cases: *tests.CompareOutputContext) void { \\ std.os.exit(126); \\} \\pub fn main() !void { - \\ var a: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 444}; - \\ var b: std.meta.Vector(4, i32) = [4]i32{111, 222, 333, 441}; + \\ var a: @Vector(4, i32) = [4]i32{111, 222, 333, 444}; + \\ var b: @Vector(4, i32) = [4]i32{111, 222, 333, 441}; \\ const x = divExact(a, b); \\ _ = x; \\} - \\fn divExact(a: std.meta.Vector(4, i32), b: std.meta.Vector(4, i32)) std.meta.Vector(4, i32) { + \\fn divExact(a: @Vector(4, i32), b: @Vector(4, i32)) @Vector(4, i32) { \\ return @divExact(a, b); \\} );