| author | |
| committer | |
| log | 93d60d0de76e5dca666682e51589c0819eed2507 |
| tree | 768bf93fecc0a8c3488b4c215f180c8081546d37 |
| parent | ebf9ffd342a30c7c79657f5dbfc83fde0647e630 |
Vectors are not yet implemented in the C backend, so no reason to
prevent code using the standard library from compiling in the meantime.4 files changed, 25 insertions(+), 7 deletions(-)
lib/std/crypto/blake3.zig+4-1| ... | @@ -200,7 +200,10 @@ const CompressGeneric = struct { | ... | @@ -200,7 +200,10 @@ const CompressGeneric = struct { |
| 200 | } | 200 | } |
| 201 | }; | 201 | }; |
| 202 | 202 | ||
| 203 | const compress = if (builtin.cpu.arch == .x86_64) CompressVectorized.compress else CompressGeneric.compress; | 203 | const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c) |
| 204 | CompressVectorized.compress | ||
| 205 | else | ||
| 206 | CompressGeneric.compress; | ||
| 204 | 207 | ||
| 205 | fn first8Words(words: [16]u32) [8]u32 { | 208 | fn first8Words(words: [16]u32) [8]u32 { |
| 206 | return @ptrCast(*const [8]u32, &words).*; | 209 | return @ptrCast(*const [8]u32, &words).*; |
lib/std/crypto/gimli.zig+1-1| ... | @@ -152,7 +152,7 @@ pub const State = struct { | ... | @@ -152,7 +152,7 @@ pub const State = struct { |
| 152 | self.endianSwap(); | 152 | self.endianSwap(); |
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | pub const permute = if (builtin.cpu.arch == .x86_64) impl: { | 155 | pub const permute = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c) impl: { |
| 156 | break :impl permute_vectorized; | 156 | break :impl permute_vectorized; |
| 157 | } else if (builtin.mode == .ReleaseSmall) impl: { | 157 | } else if (builtin.mode == .ReleaseSmall) impl: { |
| 158 | break :impl permute_small; | 158 | break :impl permute_small; |
lib/std/multi_array_list.zig+9-3| ... | @@ -436,9 +436,15 @@ pub fn MultiArrayList(comptime S: type) type { | ... | @@ -436,9 +436,15 @@ pub fn MultiArrayList(comptime S: type) type { |
| 436 | } | 436 | } |
| 437 | 437 | ||
| 438 | fn capacityInBytes(capacity: usize) usize { | 438 | fn capacityInBytes(capacity: usize) usize { |
| 439 | const sizes_vector: @Vector(sizes.bytes.len, usize) = sizes.bytes; | 439 | if (builtin.zig_backend == .stage2_c) { |
| 440 | const capacity_vector = @splat(sizes.bytes.len, capacity); | 440 | var bytes: usize = 0; |
| 441 | return @reduce(.Add, capacity_vector * sizes_vector); | 441 | for (sizes.bytes) |size| bytes += size * capacity; |
| 442 | return bytes; | ||
| 443 | } else { | ||
| 444 | const sizes_vector: @Vector(sizes.bytes.len, usize) = sizes.bytes; | ||
| 445 | const capacity_vector = @splat(sizes.bytes.len, capacity); | ||
| 446 | return @reduce(.Add, capacity_vector * sizes_vector); | ||
| 447 | } | ||
| 442 | } | 448 | } |
| 443 | 449 | ||
| 444 | fn allocatedBytes(self: Self) []align(@alignOf(S)) u8 { | 450 | fn allocatedBytes(self: Self) []align(@alignOf(S)) u8 { |
lib/std/target.zig+11-2| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std.zig"); | 1 | const std = @import("std.zig"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const mem = std.mem; | 3 | const mem = std.mem; |
| 3 | const Version = std.builtin.Version; | 4 | const Version = std.builtin.Version; |
| 4 | 5 | ||
| ... | @@ -719,7 +720,11 @@ pub const Target = struct { | ... | @@ -719,7 +720,11 @@ pub const Target = struct { |
| 719 | 720 | ||
| 720 | /// Adds the specified feature set but not its dependencies. | 721 | /// Adds the specified feature set but not its dependencies. |
| 721 | pub fn addFeatureSet(set: *Set, other_set: Set) void { | 722 | pub fn addFeatureSet(set: *Set, other_set: Set) void { |
| 722 | set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints); | 723 | if (builtin.zig_backend == .stage2_c) { |
| 724 | for (set.ints) |*int, i| int.* |= other_set.ints[i]; | ||
| 725 | } else { | ||
| 726 | set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@Vector(usize_count, usize), other_set.ints); | ||
| 727 | } | ||
| 723 | } | 728 | } |
| 724 | 729 | ||
| 725 | /// Removes the specified feature but not its dependents. | 730 | /// Removes the specified feature but not its dependents. |
| ... | @@ -731,7 +736,11 @@ pub const Target = struct { | ... | @@ -731,7 +736,11 @@ pub const Target = struct { |
| 731 | 736 | ||
| 732 | /// Removes the specified feature but not its dependents. | 737 | /// Removes the specified feature but not its dependents. |
| 733 | pub fn removeFeatureSet(set: *Set, other_set: Set) void { | 738 | pub fn removeFeatureSet(set: *Set, other_set: Set) void { |
| 734 | set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints); | 739 | if (builtin.zig_backend == .stage2_c) { |
| 740 | for (set.ints) |*int, i| int.* &= ~other_set.ints[i]; | ||
| 741 | } else { | ||
| 742 | set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@Vector(usize_count, usize), other_set.ints); | ||
| 743 | } | ||
| 735 | } | 744 | } |
| 736 | 745 | ||
| 737 | pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void { | 746 | pub fn populateDependencies(set: *Set, all_features_list: []const Cpu.Feature) void { |