pull latest singeli
This commit is contained in:
parent
894c56205f
commit
8c73112d6c
@ -1 +1 @@
|
||||
Subproject commit 4255440afd05c77a0efebdb6d5bd21e0b8a93aa9
|
||||
Subproject commit 4a4cee084d0e0f13593ed1feb678aa85bde02002
|
||||
@ -1,9 +1,7 @@
|
||||
# various utilities
|
||||
|
||||
def w256{T} = 0
|
||||
def w256{T & isvec{T}} = width{T}==256
|
||||
|
||||
def wgen256{F} = {
|
||||
local def wgen256{F} = {
|
||||
def r{T} = 0
|
||||
def r{T & w256{T}} = F{eltype{T}}
|
||||
def r{T,w} = 0
|
||||
@ -50,7 +48,7 @@ def broadcast{T, v & w256f{T, 32}} = emit{T, '_mm256_set1_ps', v}
|
||||
def make{T==[4]f64,a,b,c,d} = emit{T,'_mm256_setr_pd',a,b,c,d}
|
||||
def make{T==[8]f32,a,b,c,d,e,f,g,h} = emit{T,'_mm256_setr_ps',a,b,c,d,e,f,g,h}
|
||||
|
||||
def makeGen{T,s,x} = apply{emit, merge{tup{T,s}, each{{c}=>promote{eltype{T},c}, x}}}
|
||||
local def makeGen{T,s,x} = apply{emit, merge{tup{T,s}, each{{c}=>promote{eltype{T},c}, x}}}
|
||||
def make{T,a,b,c,d & w256i{T,64}} = makeGen{T, '_mm256_setr_epi64x', tup{a,b,c,d}}
|
||||
def make{T,a,b,c,d,e,f,g,h & w256i{T,32}} = makeGen{T, '_mm256_setr_epi32', tup{a,b,c,d,e,f,g,h}}
|
||||
def make{T,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p & w256i{T,16}} = makeGen{T, '_mm256_setr_epi16', tup{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}}
|
||||
@ -69,8 +67,8 @@ def __or {a:T, b:T & w256i{T}} = T ~~ emit{[8]f32, '_mm256_or_ps', v2f{a}, v2f{
|
||||
def __not{a:T & w256u{T}} = a ^ broadcast{T, ~cast{eltype{T},0}}
|
||||
|
||||
# float comparison
|
||||
def f32cmpAVX{a,b,n} = [8]u32 ~~ emit{[8]f32, '_mm256_cmp_ps', a, b, n}
|
||||
def f64cmpAVX{a,b,n} = [4]u64 ~~ emit{[4]f64, '_mm256_cmp_pd', a, b, n}
|
||||
local def f32cmpAVX{a,b,n} = [8]u32 ~~ emit{[8]f32, '_mm256_cmp_ps', a, b, n}
|
||||
local def f64cmpAVX{a,b,n} = [4]u64 ~~ emit{[4]f64, '_mm256_cmp_pd', a, b, n}
|
||||
def __eq{a:T,b:T & T==[8]f32} = f32cmpAVX{a,b, 0}; def __eq{a:T,b:T & T==[4]f64} = f64cmpAVX{a,b, 0}
|
||||
def __ne{a:T,b:T & T==[8]f32} = f32cmpAVX{a,b, 4}; def __ne{a:T,b:T & T==[4]f64} = f64cmpAVX{a,b, 4}
|
||||
def __gt{a:T,b:T & T==[8]f32} = f32cmpAVX{a,b,30}; def __gt{a:T,b:T & T==[4]f64} = f64cmpAVX{a,b,30}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
include 'skin/c'
|
||||
include 'arch/c'
|
||||
|
||||
oper infix right ~~ reinterpret 55
|
||||
oper ~~ reinterpret infix right 55
|
||||
def Size = u64
|
||||
def load{x} = *x
|
||||
|
||||
@ -107,9 +107,9 @@ def maxvalue{T & T==u16} = 0xffff
|
||||
def maxvalue{T & T==u32} = 0xffffffff
|
||||
|
||||
# tuple operations
|
||||
def broadcast{T, v & match{typekind{T},'primitive'}} = v
|
||||
def any{v:T & match{typekind{T},'primitive'}} = v
|
||||
def anyneg{v:T & match{typekind{T},'primitive'}} = v<0
|
||||
def broadcast{T, v & isprim{T}} = v
|
||||
def any{v:T & isprim{T}} = v
|
||||
def anyneg{v:T & isprim{T}} = v<0
|
||||
def iota{n & knum{n}} = @collect(i to n) i
|
||||
def broadcast{n, v & knum{n}} = @collect(n) v
|
||||
|
||||
|
||||
@ -8,15 +8,15 @@ include './bitops'
|
||||
include './mask'
|
||||
|
||||
|
||||
def rootty{T & match{typekind{T},'primitive'}} = T
|
||||
def rootty{T & match{typekind{T},'vector'}} = eltype{T}
|
||||
def rootty{T & isprim{T}} = T
|
||||
def rootty{T & isvec{T}} = eltype{T}
|
||||
|
||||
|
||||
# old scalar code
|
||||
# def ty_dbl{T & isprim{T}} = apply{tern{issigned{T}, ty_s, ty_u}, tup{width{T}*2}}
|
||||
# def ty_dbl{T & isvec{T}} = [vcount{T}/2](ty_dbl{eltype{T}})
|
||||
# def dcast_i{x:T} = promote{ty_dbl{T}, x}
|
||||
# def arithChk2{F, M, w:T, x:T, i & match{F,__mul} & match{typekind{T},'primitive'}} = {
|
||||
# def arithChk2{F, M, w:T, x:T, i & match{F,__mul} & isprim{T}} = {
|
||||
# r:= F{dcast_i{w}, dcast_i{x}}
|
||||
# tup{r, r!=promote{type{r}, trunc{T, r}}}
|
||||
# }
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
# get mask of first n items; n>0 & n<vcount{T}
|
||||
|
||||
def maskInit{w, T} = {
|
||||
local def maskInit{w, T} = {
|
||||
def n = w/width{T} - 1
|
||||
merge{broadcast{n, -1}, broadcast{n, 0}}
|
||||
}
|
||||
def maskInit1{w} = {
|
||||
local def maskInit1{w} = {
|
||||
apply{merge, each{{x} => {
|
||||
merge{broadcast{w/8-1, 255}, (1<<x)-1, broadcast{w/8, 0}}
|
||||
}, iota{8}}}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
def w128{T} = 0
|
||||
def w128{T & isvec{T}} = width{T}==128
|
||||
|
||||
def wgen128{F} = {
|
||||
local def wgen128{F} = {
|
||||
def r{T} = 0
|
||||
def r{T & w128{T}} = F{eltype{T}}
|
||||
def r{T,w} = 0
|
||||
@ -99,7 +99,7 @@ def anyneg{x:T & w128s{T, 16}} = getmask{[32]u8 ~~ (([16]i16~~x) < broadcast{[16
|
||||
def extract{x:T, i & w128i{T,16} & knum{i}} = emit{eltype{T}, '_mm_extract_epi16', x, i}
|
||||
|
||||
# debug stuff
|
||||
def printGen{x, s, n} = apply{emit, merge{tup{void, 'printf', merge{'"', apply{merge,each{{c}=>{if(c>0) merge{',',s}; else s}, iota{n}}}, '"'}}, each{{c}=>extract{x,c}, iota{n}}}}
|
||||
local def printGen{x, s, n} = apply{emit, merge{tup{void, 'printf', merge{'"', apply{merge,each{{c}=>{if(c>0) merge{',',s}; else s}, iota{n}}}, '"'}}, each{{c}=>extract{x,c}, iota{n}}}}
|
||||
def print{x:T & isvec{T}} = printGen{x, printfType{eltype{T}}, vcount{T}}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user