From 419e1171aa6170a5fa60c989d452bc970914ac2c Mon Sep 17 00:00:00 2001 From: dzaima Date: Thu, 1 May 2025 18:29:46 +0300 Subject: [PATCH] avoid UB on i64~~1 << 63 --- src/singeli/src/slash.singeli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/singeli/src/slash.singeli b/src/singeli/src/slash.singeli index a5cf304d..24df73b0 100644 --- a/src/singeli/src/slash.singeli +++ b/src/singeli/src/slash.singeli @@ -249,7 +249,7 @@ fn slash{c, T if hasarch{if (width{T}>=32) 'AVX512F' else 'AVX512VBMI2'}}(w:*u64 # The compress-store instruction performs very poorly on Zen4, # and is also a lot worse than the following on Tiger Lake # emitT{void, 'mask_compressstoreu', r, m, x} - cs := cast_i{I,promote{i64,1}<<(c%64) - 1} + cs := cast_i{I, tail{u64, c%64}} if (vl==64) cs -= cast_i{I,c}>>6 v := emitT{V, 'mask_compress', x, m, x} store_masked_hom{r, [vl]u1~~cs, v}