authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-08 00:32:43+02:00
committergravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2026-10-10 12:43:57+02:00
loga91bc9cd0fbb384ec135d5429ad5dcae56449042
tree0168375f9acaa55a34802e9d47b455b69892947b
parent0e494a3345f1c635d5979571dd55a1c663992d97

crypto.ml_kem: work around LLVM23 miscompilation on riscv64

Coefficient extraction generates bogus code with u64 batches. Using u32 batches seems to work around it.

1 files changed, 1 insertions(+), 0 deletions(-)

lib/std/crypto/ml_kem.zig+1
...@@ -1179,6 +1179,7 @@ const Poly = struct {...@@ -1179,6 +1179,7 @@ const Poly = struct {
11791179
1180 const T = switch (builtin.target.cpu.arch) {1180 const T = switch (builtin.target.cpu.arch) {
1181 .x86_64, .x86 => u32, // Generates better code on Intel CPUs1181 .x86_64, .x86 => u32, // Generates better code on Intel CPUs
1182 .riscv64 => u32, // Work around LLVM miscompiling coefficient extraction with u64 batches https://codeberg.org/ziglang/zig/issues/37128
1182 else => u64, // u128 might be faster on some other CPUs.1183 else => u64, // u128 might be faster on some other CPUs.
1183 };1184 };
11841185