From 82520a214ca7149a1acf658c3e4ddf257c450e79 Mon Sep 17 00:00:00 2001 From: Lauri Tirkkonen Date: Wed, 28 Jun 2023 19:42:43 +0900 Subject: [PATCH] std.crypto.hash.sha2: require avx2 on x86_64 according to https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=vpalignr&ig_expand=283,283,284,283,283&techs=AVX_ALL the vpalignr instruction requires AVX2 support --- lib/std/crypto/sha2.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/crypto/sha2.zig b/lib/std/crypto/sha2.zig index ce543d3906b5a8ea1e785289e26b0baee2435cce..122ec6cd809b3ee9a381350ce146c640b787b728 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 comptime std.Target.x86.featureSetHas(builtin.cpu.features, .sha)) { + .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)); -- 2.54.0