From 27701596060c7a8018f9a9add21952a6d7f83d96 Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Sun, 5 Mar 2023 02:58:15 -0500 Subject: [PATCH] std: reenable vectorized code with the C backend --- lib/std/crypto/blake3.zig | 2 +- lib/std/crypto/gimli.zig | 2 +- lib/std/target.zig | 12 ++---------- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index 5b8e21d9227fc6493c3c624f1b0ad771d346c818..36d717387f1d0e9d93608cf6a33422b308888dcb 100644 --- a/lib/std/crypto/blake3.zig +++ b/lib/std/crypto/blake3.zig @@ -200,7 +200,7 @@ const CompressGeneric = struct { } }; -const compress = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c) +const compress = if (builtin.cpu.arch == .x86_64) CompressVectorized.compress else CompressGeneric.compress; diff --git a/lib/std/crypto/gimli.zig b/lib/std/crypto/gimli.zig index 9443b97be79c636bb5cdba4b2905651ab4c6339c..0189f4c35945fde4c6bf9c67862d84b8b9b2a61f 100644 --- a/lib/std/crypto/gimli.zig +++ b/lib/std/crypto/gimli.zig @@ -152,7 +152,7 @@ pub const State = struct { self.endianSwap(); } - pub const permute = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c) impl: { + pub const permute = if (builtin.cpu.arch == .x86_64) impl: { break :impl permute_vectorized; } else if (builtin.mode == .ReleaseSmall) impl: { break :impl permute_small; diff --git a/lib/std/target.zig b/lib/std/target.zig index 9e3a8d62f4b7e3156dbbe4b83c41fff528accbbe..52f41a056361c71fe5fd135cca5c24cc39c158f9 100644 --- a/lib/std/target.zig +++ b/lib/std/target.zig @@ -719,11 +719,7 @@ pub const Target = struct { /// Adds the specified feature set but not its dependencies. pub fn addFeatureSet(set: *Set, other_set: Set) void { - if (builtin.zig_backend == .stage2_c) { - for (&set.ints, 0..) |*int, i| int.* |= other_set.ints[i]; - } else { - set.ints = @as(@Vector(usize_count, usize), set.ints) | @as(@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. @@ -735,11 +731,7 @@ pub const Target = struct { /// Removes the specified feature but not its dependents. pub fn removeFeatureSet(set: *Set, other_set: Set) void { - if (builtin.zig_backend == .stage2_c) { - for (&set.ints, 0..) |*int, i| int.* &= ~other_set.ints[i]; - } else { - set.ints = @as(@Vector(usize_count, usize), set.ints) & ~@as(@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 { -- 2.54.0