Add has='pclmul' option and avoid using broadcast

This commit is contained in:
Marshall Lochbaum 2023-07-11 19:52:47 -04:00
parent 871a81ca5f
commit 03d8919307
2 changed files with 6 additions and 6 deletions

View File

@ -216,7 +216,7 @@ po ← { # parsed options
has Lowercase GetOpt "has"
has has ("slow-pdep"<has)/"bmi2"
{𝕊: "Error: Unsupported 'has' options; options:"1", "¨𝕩}_assert_(´has) "avx2""bmi2""slow-pdep"
{𝕊: "Error: Unsupported 'has' options; options:"1", "¨𝕩}_assert_(´has) "avx2""bmi2""pclmul""slow-pdep"
{𝕊: "Error: Cannot have 'has' options on architecture '"arch"'; add an argument of "compat"arch=x86-64""target_arch=x86-64"}_assert_¬ (arch"x86-64") 0has
avx2 (arch"x86-64") singeli native "avx2"<has
@ -672,7 +672,7 @@ cachedBin‿linkerCache ← {
singeliArgs po.singeliFlags"-l", "gen="AtRoot singeliCache.folder, "-c", "usz=u"•Repr po.usz{
po.native? ;
"-a" ({"x86-64":"X86_64"; "aarch64":"AARCH64"; "none"} po.arch) ','¨ Uppercase "avx2""bmi2"/po.has
"-a" ({"x86-64":"X86_64"; "aarch64":"AARCH64"; "none"} po.arch) ','¨ Uppercase "avx2""bmi2""pclmul"/po.has
}
{𝕊: "Singeli args: "•Repr singeliArgs} _verboseLog @
singeliObjs {MakeSingeliInv singeliArgs, {𝕊:UpdateSubmodule po.singeliDir}, singeliCache, 𝕩, "src/singeli/src/"•file.At 𝕩".singeli", (𝕩"dyarith")/gaRule}¨ 1¨singeliMap

View File

@ -110,11 +110,11 @@ fn pext{T}(x:T, m:T) {
fn pext{T & hasarch{'PCLMUL'} & T==u64}(xs:T, ms:T) {
def num = lb{width{T}}
def V = [2]T
m := V**ms
x := V**xs & m
def vec{s} = make{[2]T, s, 0}
m := vec{ms}
x := vec{xs} & m
d := ~m << 1 # One bit of the position difference at x
c := V**(1<<64-1)
c := vec{1<<64-1}
@unroll (i to num) {
def sh = 1 << i
def shift_at{v, s} = { v = (v&~s) | (v&s)>>sh }