diff --git a/src/singeli/src/avx.singeli b/src/singeli/src/avx.singeli index a660bcfa..694dfabf 100644 --- a/src/singeli/src/avx.singeli +++ b/src/singeli/src/avx.singeli @@ -1,6 +1,3 @@ -def load{V=[_]E, ptr:*E, vl if w256{V} and vl*width{E}<=128} = undef_promote{V, load{n_h{V}, ptr, vl}} -def store{ptr:*E, x:V=[k]E, vl if w256{V} and vl*width{E}<=128} = store{ptr, half{x, 0}, vl} - # f32 arith def rsqrtE{a:T==[8]f32} = emit{T, '_mm256_rsqrt_ps', a} def rcpE{a:T==[8]f32} = emit{T, '_mm256_rcp_ps', a} diff --git a/src/singeli/src/x86.singeli b/src/singeli/src/x86.singeli index 547ff8fa..c27a96d4 100644 --- a/src/singeli/src/x86.singeli +++ b/src/singeli/src/x86.singeli @@ -5,7 +5,7 @@ include 'arch/iintrinsic/select' def v2i{x:T=[_]E} = if(isint{E}) x else re_el{u8, x} def v2f{x:T=[_]_} = re_el{f32, x} def v2d{x:T=[_]_} = re_el{f64, x} -def x86_vec_low{n, E} = [__max{128/width{E},n}]E +def x86_vec_low{n, E if primt{E}} = [__max{128/width{E},n}]E def x86_has512{V=[_]E} = if (width{V}==512) hasarch{'AVX512F'} else hasarch{'AVX512VL'} def x86_has512{V, post} = has512{V} and hasarch{merge{'AVX512', post}} @@ -76,6 +76,15 @@ def extract{D=[kd]E, x:X=[ks]E, i if kd128 +def load{R=[k]E, ptr:*E, vl if low_vl{vl, R}} = undef_promote{R, load{x86_vec_low{vl,E}, ptr, vl}} +def store{ptr:*E, x:V=[k]E, vl if low_vl{vl, V}} = store{ptr, x86_low_elts{vl, x}, vl} + # float stuff @@ -105,8 +114,6 @@ def mul_sum_sat{2, a:V=[k](u8), b:[k](i8) if has_bw{V}} = { emit{[k/2]i16, intrin{V, 'maddubs_epi16'}, a, b} } -def x86_low_elts{n, x:V=[k]E} = extract{x86_vec_low{n,E}, x, 0} - def widen{D=[k]DE, x:S=[k0]SE if isint{DE} and quality{DE}==quality{SE} and DE>SE and k<=k0 and hasarch{match (width{D}) { {128} => 'SSE4.1' {256} => 'AVX2'