diff --git a/linalg/arm64/arm64simd/arm64simd_act_f32_32n.tmpl b/linalg/arm64/arm64simd/arm64simd_act_f32_32n.tmpl index 15b1ea7ff4..3b85f31668 100644 --- a/linalg/arm64/arm64simd/arm64simd_act_f32_32n.tmpl +++ b/linalg/arm64/arm64simd/arm64simd_act_f32_32n.tmpl @@ -69,11 +69,33 @@ .max: b .unsupported .add_const: - b .unsupported + ins v24.s[0], w3 + add x5, x5, 4 + dup v24.4s, v24.s[0] + fadd v0.4s, v0.4s, v24.4s + fadd v1.4s, v1.4s, v24.4s + fadd v2.4s, v2.4s, v24.4s + fadd v3.4s, v3.4s, v24.4s + fadd v4.4s, v4.4s, v24.4s + fadd v5.4s, v5.4s, v24.4s + fadd v6.4s, v6.4s, v24.4s + fadd v7.4s, v7.4s, v24.4s + b .inner_loop .sub_const: b .unsupported .mul_const: - b .unsupported + ins v24.s[0], w3 + add x5, x5, 4 + dup v24.4s, v24.s[0] + fmul v0.4s, v0.4s, v24.4s + fmul v1.4s, v1.4s, v24.4s + fmul v2.4s, v2.4s, v24.4s + fmul v3.4s, v3.4s, v24.4s + fmul v4.4s, v4.4s, v24.4s + fmul v5.4s, v5.4s, v24.4s + fmul v6.4s, v6.4s, v24.4s + fmul v7.4s, v7.4s, v24.4s + b .inner_loop .min_const: b .unsupported diff --git a/linalg/src/frame/activations/tests.rs b/linalg/src/frame/activations/tests.rs index 1e91ab414a..795f4837b5 100644 --- a/linalg/src/frame/activations/tests.rs +++ b/linalg/src/frame/activations/tests.rs @@ -56,6 +56,20 @@ macro_rules! act_tests { } } + #[test] + fn add_const_prop(alpha in any::<$ti>(), x in x_strat()) { + if $cond { + run_kernel_test::<$ti, $ker>(&x, &[AddConst(alpha)], |x| x + alpha); + } + } + + #[test] + fn mul_const_prop(alpha in any::<$ti>(), x in x_strat()) { + if $cond { + run_kernel_test::<$ti, $ker>(&x, &[MulConst(alpha)], |x| x * alpha); + } + } + #[test] fn max_const_prop(alpha in any::<$ti>(), x in x_strat()) { if $cond { @@ -97,6 +111,17 @@ macro_rules! act_tests { ); } } + + #[test] + fn affine_prop(x in x_strat(), alpha in any::<$ti>(), beta in any::<$ti>()) { + if $cond { + run_kernel_test::<$ti, $ker>( + &x, + &$crate::frame::activations::definitions::affine(alpha, beta).ops, + |x| x * alpha + beta + ); + } + } } /* prop_act_e2e!($cond, $ti, $ker, affine(alpha, beta));