void test_vst1Qs8 (void) { int8_t *arg0_int8_t; int8x16_t arg1_int8x16_t; vst1q_s8 (arg0_int8_t, arg1_int8x16_t); }
void memcpy_neon(char *src, char *des, int len) { int8_t *src1 = (int8_t*)src; int8_t *des1 = (int8_t*)des; int8x16_t vec; int i; int temp = len % 16; int len1 = len - temp; char ch; /*use neon */ for(i = 0; i < len1; i += 16) { vec = vld1q_s8(src1); vst1q_s8(des1, vec); src1 += 16; des1 =+ 16; } /*duplicate the rest characters*/ while(temp != 0) { *(char*)des1 = *(char*)src1; des1++; src1++; temp--; } }
test_vdupq_lane_s8 () { int8x8_t a; int8x16_t b; int i; /* Only two first cases are interesting. */ int8_t c[8] = { 0, 1, 2, 3, 4, 5, 6, 7 }; int8_t d[16]; a = vld1_s8 (c); b = wrap_vdupq_lane_s8_0 (a); vst1q_s8 (d, b); for (i = 0; i < 16; i++) if (c[0] != d[i]) return 1; b = wrap_vdupq_lane_s8_1 (a); vst1q_s8 (d, b); for (i = 0; i < 16; i++) if (c[1] != d[i]) return 1; return 0; }
test_vreinterpretq_s8_f64 () { float64x2_t a; int8x16_t b; float64_t c[2] = { PI_F64, E_F64 }; int8_t d[16] = { 0x18, 0x2D, 0x44, 0x54, 0xFB, 0x21, 0x09, 0x40, 0x69, 0x57, 0x14, 0x8B, 0x0A, 0xBF, 0x05, 0x40 }; int8_t e[16]; int i; a = vld1q_f64 (c); b = wrap_vreinterpretq_s8_f64 (a); vst1q_s8 (e, b); for (i = 0; i < 16; i++) if (d[i] != e[i]) return 1; return 0; };
/* s8x16 add */ void mw_neon_mm_add_s8x16(signed char * A, int Row, int Col, signed char * B, signed char * C) { int8x16_t neon_a, neon_b, neon_c; int size = Row * Col; int i = 0; int k = 0; for (i = 16; i <= size ; i+=16) { k = i - 16; neon_a = vld1q_s8(A + k); neon_b = vld1q_s8(B + k); neon_c = vaddq_s8(neon_a, neon_b); vst1q_s8(C + k, neon_c); } k = i - 16; for (i = 0; i < size % 16; i++) { C[k + i] = A[k + i] + B[k + i]; } }
/* s8x16 mv mul */ void mw_neon_mv_mul_s8x16(signed char * A, int Row, int T, signed char * B, signed char * C) { int i = 0; int k = 0; int8x16_t neon_b, neon_c; int8x16_t neon_a0, neon_a1, neon_a2, neon_a3, neon_a4, neon_a5, neon_a6, neon_a7; int8x16_t neon_a8, neon_a9, neon_a10, neon_a11, neon_a12, neon_a13, neon_a14, neon_a15; int8x16_t neon_b0, neon_b1, neon_b2, neon_b3, neon_b4, neon_b5, neon_b6, neon_b7; int8x16_t neon_b8, neon_b9, neon_b10, neon_b11, neon_b12, neon_b13, neon_b14, neon_b15; for (i = 0; i < Row; i+=16) { neon_c = vmovq_n_s8(0); for (k = 0; k < T; k+=16) { int j = k * T + i; neon_a0 = vld1q_s8(A + j); j+=Row; neon_a1 = vld1q_s8(A + j); j+=Row; neon_a2 = vld1q_s8(A + j); j+=Row; neon_a3 = vld1q_s8(A + j); j+=Row; neon_a4 = vld1q_s8(A + j); j+=Row; neon_a5 = vld1q_s8(A + j); j+=Row; neon_a6 = vld1q_s8(A + j); j+=Row; neon_a7 = vld1q_s8(A + j); j+=Row; neon_a8 = vld1q_s8(A + j); j+=Row; neon_a9 = vld1q_s8(A + j); j+=Row; neon_a10 = vld1q_s8(A + j); j+=Row; neon_a11 = vld1q_s8(A + j); j+=Row; neon_a12 = vld1q_s8(A + j); j+=Row; neon_a13 = vld1q_s8(A + j); j+=Row; neon_a14 = vld1q_s8(A + j); j+=Row; neon_a15 = vld1q_s8(A + j); neon_b = vld1q_s8(B + k); neon_b0 = vdupq_n_s8(vgetq_lane_s8(neon_b, 0)); neon_b1 = vdupq_n_s8(vgetq_lane_s8(neon_b, 1)); neon_b2 = vdupq_n_s8(vgetq_lane_s8(neon_b, 2)); neon_b3 = vdupq_n_s8(vgetq_lane_s8(neon_b, 3)); neon_b4 = vdupq_n_s8(vgetq_lane_s8(neon_b, 4)); neon_b5 = vdupq_n_s8(vgetq_lane_s8(neon_b, 5)); neon_b6 = vdupq_n_s8(vgetq_lane_s8(neon_b, 6)); neon_b7 = vdupq_n_s8(vgetq_lane_s8(neon_b, 7)); neon_b8 = vdupq_n_s8(vgetq_lane_s8(neon_b, 8)); neon_b9 = vdupq_n_s8(vgetq_lane_s8(neon_b, 9)); neon_b10 = vdupq_n_s8(vgetq_lane_s8(neon_b, 10)); neon_b11 = vdupq_n_s8(vgetq_lane_s8(neon_b, 11)); neon_b12 = vdupq_n_s8(vgetq_lane_s8(neon_b, 12)); neon_b13 = vdupq_n_s8(vgetq_lane_s8(neon_b, 13)); neon_b14 = vdupq_n_s8(vgetq_lane_s8(neon_b, 14)); neon_b15 = vdupq_n_s8(vgetq_lane_s8(neon_b, 15)); neon_c = vaddq_s8(vmulq_s8(neon_a0, neon_b0), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a1, neon_b1), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a2, neon_b2), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a3, neon_b3), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a4, neon_b4), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a5, neon_b5), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a6, neon_b6), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a7, neon_b7), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a8, neon_b8), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a9, neon_b9), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a10, neon_b10), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a11, neon_b11), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a12, neon_b12), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a13, neon_b13), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a14, neon_b14), neon_c); neon_c = vaddq_s8(vmulq_s8(neon_a15, neon_b15), neon_c); } vst1q_s8(C + i, neon_c); } }
inline void vst1q(s8 * ptr, const int8x16_t & v) { return vst1q_s8(ptr, v); }