Skip to content

Instantly share code, notes, and snippets.

@al42and
Created November 18, 2023 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save al42and/0911a0288479fecda1de88c2ced4d565 to your computer and use it in GitHub Desktop.
Save al42and/0911a0288479fecda1de88c2ced4d565 to your computer and use it in GitHub Desktop.
#include <cstdio>
#define FARM_NB_BITS_IN_VEC 128
#include "farm_sve.h"
int main()
{
svfloat32_t a, b, c;
svbool_t m;
for (int i = 0; i < FARM_NB_BITS_IN_VEC / 32; i++)
{
a.vec[i] = i + 1;
b.vec[i] = 8 - i;
m.vec[i] = (i % 2);
}
c = svadd_f32_m(m, a, b);
printf("a = %.1f %.1f %.1f %.1f\n", a.vec[0], a.vec[1], a.vec[2], a.vec[3]);
printf("b = %.1f %.1f %.1f %.1f\n", b.vec[0], b.vec[1], b.vec[2], b.vec[3]);
printf("m = %d %d %d %d\n", m.vec[0], m.vec[1], m.vec[2], m.vec[3]);
printf("c = svadd_f32_m(m, a, b)\n");
printf("c = %.1f %.1f %.1f %.1f\n", c.vec[0], c.vec[1], c.vec[2], c.vec[3]);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment