From 2f6a8e55a178ab34bbd2c67c5ab06e688a980ada Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 17 Jul 2023 16:31:01 -0400 Subject: [PATCH] Always use vectors for for_special_buffered buffer copy --- src/singeli/src/slash.singeli | 6 +++--- src/singeli/src/sse.singeli | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/singeli/src/slash.singeli b/src/singeli/src/slash.singeli index 82fbc340..8af48000 100644 --- a/src/singeli/src/slash.singeli +++ b/src/singeli/src/slash.singeli @@ -74,10 +74,10 @@ def for_special_buffered{r, write_len}{vars,begin,sum,iter} = { buf_used = 1; goto{restart} } } else { - def vc = 256/tw; - if (hasarch{'AVX2'} and write_len >= vc) { + if (hasarch{'X86_64'} | hasarch{'AARCH64'}) { + def vc = (if (hasarch{'AVX2'}) 256 else 128)/tw; def R = [vc]T - if (ov>vc and end-buf>vc) { store{*R~~r0, 0, load{*R~~buf}}; r0+=vc; buf+=vc } + @unroll ((ov/vc)>>0) if (end-buf>vc) { store{*R~~r0, 0, load{*R~~buf}}; r0+=vc; buf+=vc } homMaskStoreF{*R~~r0, maskOf{R, end-buf}, load{*R~~buf}} } else { @for (r0, buf over u64~~(end-buf)) r0 = buf diff --git a/src/singeli/src/sse.singeli b/src/singeli/src/sse.singeli index b48ee71a..e8c7b895 100644 --- a/src/singeli/src/sse.singeli +++ b/src/singeli/src/sse.singeli @@ -47,8 +47,8 @@ def topBlend{f:T, t:T, m:M & w128{T} & w128i{M,32}} = T ~~ emit{[4]f32, '_mm_ble def topBlend{f:T, t:T, m:M & w128{T} & w128i{M,64}} = T ~~ emit{[2]f64, '_mm_blendv_pd', v2d{f}, v2d{t}, v2d{m}} def topBlend{f:T, t:T, m:M & w128{T} & w128i{M, 8}} = T ~~ emit{[16]i8, '_mm_blendv_epi8', v2i{f}, v2i{t}, v2i{m}} # assumes all bits are the same in each mask item -def homBlend{f:T, t:T, m:M & w128{T} & w128{M} & elwidth{M}!=16} = topBlend{f, t, m} -def homBlend{f:T, t:T, m:M & w128{T} & w128{M,16}} = topBlend{f, t, [16]i8~~m} +def homBlend{f:T, t:T, m:M & hasarch{'SSE4.1'} & w128{T} & w128{M} & elwidth{M}!=16} = topBlend{f, t, m} +def homBlend{f:T, t:T, m:M & hasarch{'SSE4.1'} & w128{T} & w128{M,16}} = topBlend{f, t, [16]i8~~m}