Commit 3f0eb933 authored by Federico Rossi's avatar Federico Rossi

Updated sve test example

parent bfd30c3c
......@@ -262,7 +262,7 @@ if(USE_SVE)
set(USE_SSE OFF)
add_definitions(-DCNN_USE_SVE)
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -O3 -march=armv8-a+sve ")
set(EXTRA_C_FLAGS "${EXTRA_C_FLAGS} -Ofast -march=armv8-a+sve -fPIC -mcpu=native")
endif(USE_SVE)
......
......@@ -4,22 +4,17 @@
#endif /* __ARM_FEATURE_SVE */
void daxpy_1_1(int64_t n, double da, double *dx, double *dy)
{
int64_t i = 0;
svbool_t pg = svwhilelt_b64(i, n);
// [1]
do
{
svfloat64_t dx_vec = svld1(pg, &dx[i]);
svfloat64_t dy_vec = svld1(pg, &dy[i]);
svst1(pg, &dy[i], svmla_x(pg, dy_vec, dx_vec, da));
i += svcntd();
pg = svwhilelt_b64(i, n);
}
while (svptest_any(svptrue_b64(), pg));
void sv_madd(std::vector<float> x,std::vector<float> y) {
int32_t n = x.size(), i =0;
svbool_t pg = svwhilelt_b32(i,n);
for(int i = 0;svptest_any(svptrue_b32(),pg),i+=svcntw()) {
svfloat32_t x_vec = svld1(pg,&x[i]);
svfloat32_t y_vec = svld1(pg,&y[i]);
svst1(pg,&dy[i],svmla_x(pg,x_vec,y_vec,0));
} while (svptest_any(svptrue_b32(),pg));
}
int main() {
std::vector<float> a{1,2,3},b{1,2,3};
sv_madd(a,b);
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment