rename __mulhi & __mul32

This commit is contained in:
dzaima 2023-07-19 21:54:12 +03:00
parent 700d69e7dd
commit eb46ec8d9c
4 changed files with 15 additions and 15 deletions

View File

@ -69,12 +69,12 @@ def packQQ{{a, b}} = packQQ{a, b}
# arith
def __mul {a:T,b:T & [16]i16==T} = emit{T, '_mm256_mullo_epi16', a, b}
def __mulhi{a:T,b:T & [16]i16==T} = emit{T, '_mm256_mulhi_epi16', a, b}
def __mulhi{a:T,b:T & [16]u16==T} = emit{T, '_mm256_mulhi_epu16', a, b}
def __mul {a:T,b:T & [ 8]i32==T} = emit{T, '_mm256_mullo_epi32', a, b}
def __mul32{a:T,b:T & [ 4]i64==T} = emit{T, '_mm256_mul_epi32', a, b} # reads only low 32 bits of arguments
def __mul32{a:T,b:T & [ 4]u64==T} = emit{T, '_mm256_mul_epu32', a, b} # reads only low 32 bits of arguments
def __mul{a:T,b:T & [16]i16==T} = emit{T, '_mm256_mullo_epi16', a, b}
def mulHi{a:T,b:T & [16]i16==T} = emit{T, '_mm256_mulhi_epi16', a, b}
def mulHi{a:T,b:T & [16]u16==T} = emit{T, '_mm256_mulhi_epu16', a, b}
def __mul{a:T,b:T & [ 8]i32==T} = emit{T, '_mm256_mullo_epi32', a, b}
def mul32{a:T,b:T & [ 4]i64==T} = emit{T, '_mm256_mul_epi32', a, b} # reads only low 32 bits of arguments
def mul32{a:T,b:T & [ 4]u64==T} = emit{T, '_mm256_mul_epu32', a, b} # reads only low 32 bits of arguments
def abs{a:T & w256i{T,8 }} = emit{[32]i8 , '_mm256_abs_epi8', a}
def abs{a:T & w256i{T,16}} = emit{[16]i16, '_mm256_abs_epi16', a}

View File

@ -173,7 +173,7 @@ def unpackQ{...x} = assert{'unpackQ not supported', show{...x}}
def packQ{...x} = assert{'packQ not supported', show{...x}}
def shl{...x} = assert{'shl not supported', show{...x}}
def shr{...x} = assert{'shr not supported', show{...x}}
def __mulhi{...x} = assert{'__mulhi not supported', show{...x}}
def mulHi{...x} = assert{'mulHi not supported', show{...x}}
def fold_addw{...x} = assert{'fold_addw not supported', show{...x}}
def vfold{...x} = assert{'vfold not supported', show{...x}}
def narrowPair{...x} = assert{'narrowPair not supported', show{...x}}

View File

@ -56,8 +56,8 @@ def arithChk2{F, M, w:T, x:T & same{F,__mul} & isvec{T} & i8==eltype{T} & hasarc
}
}
def arithChk2{F, M, w:T, x:T & same{F,__mul} & isvec{T} & i16==eltype{T} & hasarch{'X86_64'}} = {
rl:= __mul {w,x}
rh:= __mulhi{w,x}
rl:= __mul{w,x}
rh:= mulHi{w,x}
tup{rl, tup{'anyne', rh, rl>>15}}
}
def arithChk2{F, M, w:T, x:T & same{F,__mul} & isvec{T} & i32==eltype{T} & hasarch{'X86_64'}} = {
@ -69,7 +69,7 @@ def arithChk2{F, M, w:T, x:T & same{F,__mul} & isvec{T} & i32==eltype{T} & hasar
# TODO don't do this, but instead shuffle one half, do math, unshuffle that half
# def wp = unpackQ{w, T**0}
# def xp = unpackQ{x, T**0}
# def rp = each{__mul32, wp, xp}
# def rp = each{mul32, wp, xp}
# def T2 = to_el{i64, T}
# def bad = each{{v} => {
# ((T2~~v + T2**0x80000000) ^ T2**(cast{i64,1}<<63)) > T2**cast_i{i64, (cast{u64,1}<<63) | 0xFFFFFFFF}

View File

@ -119,12 +119,12 @@ def __sub{a:T,b:T & w128i{T, 16}} = emit{T, '_mm_sub_epi16', a, b}
def __sub{a:T,b:T & w128i{T, 32}} = emit{T, '_mm_sub_epi32', a, b}
def __sub{a:T,b:T & w128i{T, 64}} = emit{T, '_mm_sub_epi64', a, b}
def __mul {a:T,b:T & [8]i16==T} = emit{T, '_mm_mullo_epi16', a, b}
def __mulhi{a:T,b:T & [8]i16==T} = emit{T, '_mm_mulhi_epi16', a, b}
def __mulhi{a:T,b:T & [8]u16==T} = emit{T, '_mm_mulhi_epu16', a, b}
def __mul32{a:T,b:T & [2]u64==T} = emit{T, '_mm_mul_epu32', a, b} # reads only low 32 bits of arguments
def __mul{a:T,b:T & [8]i16==T} = emit{T, '_mm_mullo_epi16', a, b}
def mulHi{a:T,b:T & [8]i16==T} = emit{T, '_mm_mulhi_epi16', a, b}
def mulHi{a:T,b:T & [8]u16==T} = emit{T, '_mm_mulhi_epu16', a, b}
def mul32{a:T,b:T & [2]u64==T} = emit{T, '_mm_mul_epu32', a, b} # reads only low 32 bits of arguments
def __mul{a:T,b:T & [4]i32==T} = {
def mu{x, y} = [4]i32 ~~ __mul32{[2]u64~~x, [2]u64~~y}
def mu{x, y} = [4]i32 ~~ mul32{[2]u64~~x, [2]u64~~y}
def sw{n, ...vs} = each{{c} => shuf{[4]i32, c, n}, vs}
lo:= mu{a, b}
hi:= mu{...sw{4b2301, a, b}}