diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2024-02-25 21:43:20 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-25 21:43:20 -0800 |
| commit | 91fb211faa3f37d08da55b0c8df92a6475624316 (patch) | |
| tree | ad824c8fcdd386e378669c21a3e65923b52d0133 /lib/std/crypto | |
| parent | d656c2a7abe90d00ef6dbc3731b82bd26180038a (diff) | |
| parent | 4fcc750ba58f51606c49310bdd7c81c156d48cfc (diff) | |
| download | zig-91fb211faa3f37d08da55b0c8df92a6475624316.tar.gz zig-91fb211faa3f37d08da55b0c8df92a6475624316.zip | |
Merge pull request #18906 from jacobly0/x86_64-tests
x86_64: pass more tests
Diffstat (limited to 'lib/std/crypto')
| -rw-r--r-- | lib/std/crypto/aes.zig | 2 | ||||
| -rw-r--r-- | lib/std/crypto/blake3.zig | 2 | ||||
| -rw-r--r-- | lib/std/crypto/salsa20.zig | 5 | ||||
| -rw-r--r-- | lib/std/crypto/sha2.zig | 2 |
4 files changed, 7 insertions, 4 deletions
diff --git a/lib/std/crypto/aes.zig b/lib/std/crypto/aes.zig index f5752888fc..5e5ae04b58 100644 --- a/lib/std/crypto/aes.zig +++ b/lib/std/crypto/aes.zig @@ -6,7 +6,7 @@ const has_aesni = std.Target.x86.featureSetHas(builtin.cpu.features, .aes); const has_avx = std.Target.x86.featureSetHas(builtin.cpu.features, .avx); const has_armaes = std.Target.aarch64.featureSetHas(builtin.cpu.features, .aes); // C backend doesn't currently support passing vectors to inline asm. -const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and has_aesni and has_avx) impl: { +const impl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_c and has_aesni and has_avx) impl: { break :impl @import("aes/aesni.zig"); } else if (builtin.cpu.arch == .aarch64 and builtin.zig_backend != .stage2_c and has_armaes) impl: { diff --git a/lib/std/crypto/blake3.zig b/lib/std/crypto/blake3.zig index d87211fb1e..585c338417 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_x86_64) +const compress = if (builtin.cpu.arch == .x86_64) CompressVectorized.compress else CompressGeneric.compress; diff --git a/lib/std/crypto/salsa20.zig b/lib/std/crypto/salsa20.zig index 7f4c1b0157..c791c6b773 100644 --- a/lib/std/crypto/salsa20.zig +++ b/lib/std/crypto/salsa20.zig @@ -302,7 +302,10 @@ fn SalsaNonVecImpl(comptime rounds: comptime_int) type { }; } -const SalsaImpl = if (builtin.cpu.arch == .x86_64 and builtin.zig_backend != .stage2_x86_64) SalsaVecImpl else SalsaNonVecImpl; +const SalsaImpl = if (builtin.cpu.arch == .x86_64) + SalsaVecImpl +else + SalsaNonVecImpl; fn keyToWords(key: [32]u8) [8]u32 { var k: [8]u32 = undefined; diff --git a/lib/std/crypto/sha2.zig b/lib/std/crypto/sha2.zig index 10909cfaec..31884c7381 100644 --- a/lib/std/crypto/sha2.zig +++ b/lib/std/crypto/sha2.zig @@ -238,7 +238,7 @@ fn Sha2x32(comptime params: Sha2Params32) type { return; }, // C backend doesn't currently support passing vectors to inline asm. - .x86_64 => if (builtin.zig_backend != .stage2_c and builtin.zig_backend != .stage2_x86_64 and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) { + .x86_64 => if (builtin.zig_backend != .stage2_c and comptime std.Target.x86.featureSetHasAll(builtin.cpu.features, .{ .sha, .avx2 })) { var x: v4u32 = [_]u32{ d.s[5], d.s[4], d.s[1], d.s[0] }; var y: v4u32 = [_]u32{ d.s[7], d.s[6], d.s[3], d.s[2] }; const s_v = @as(*[16]v4u32, @ptrCast(&s)); |
