diff --git a/src/layer/mips/mips_mathfun.h b/src/layer/mips/mips_mathfun.h index c1f34b08f..703242ec3 100644 --- a/src/layer/mips/mips_mathfun.h +++ b/src/layer/mips/mips_mathfun.h @@ -170,11 +170,11 @@ static inline v4f32 tanh_ps(v4f32 x) // abs(x) > HALFMAXLOGF // return 1.0 or -1.0 - v4i32_w mask_pos = __msa_fcle_w((v4f32)__msa_fill_w(0), x2); - v4f32 y1 = (v4f32)__msa_bsel_v((v16u8)mask_pos, (v16u8)__msa_fill_w(c_1.i), (v16u8)__msa_fill_w(c_n1.i)); + v4i32_w mask_pos = __msa_fcle_w((v4f32)__msa_fill_w(0), x); + v4f32 y1 = (v4f32)__msa_bsel_v((v16u8)mask_pos, (v16u8)__msa_fill_w(c_n1.i), (v16u8)__msa_fill_w(c_1.i)); - y = (v4f32)__msa_bsel_v((v16u8)mask_l, (v16u8)y0, (v16u8)y); - y = (v4f32)__msa_bsel_v((v16u8)mask_l2, (v16u8)y1, (v16u8)y); + y = (v4f32)__msa_bsel_v((v16u8)mask_l, (v16u8)y, (v16u8)y0); + y = (v4f32)__msa_bsel_v((v16u8)mask_l2, (v16u8)y, (v16u8)y1); return y; } diff --git a/src/layer/mips/tanh_mips.cpp b/src/layer/mips/tanh_mips.cpp index f5fb97e4c..92ff1576a 100644 --- a/src/layer/mips/tanh_mips.cpp +++ b/src/layer/mips/tanh_mips.cpp @@ -15,9 +15,8 @@ #include "tanh_mips.h" #if __mips_msa -#include "mips_mathfun.h" - #include +#include "mips_mathfun.h" #endif // __mips_msa #include @@ -36,14 +35,14 @@ int TanH_mips::forward_inplace(Mat& bottom_top_blob, const Option& opt) const { float* ptr = bottom_top_blob.channel(q); -#if 0 // __mips_msa +#if __mips_msa int nn = size >> 2; int remain = size - (nn << 2); #else int remain = size; #endif // __mips_msa -#if 0 // __mips_msa +#if __mips_msa for (; nn > 0; nn--) { v4f32 _p = (v4f32)__msa_ld_w(ptr, 0);