extra_vsx4_mma.c 499 B

123456789101112131415161718192021
  1. #ifndef __VSX__
  2. #error "VSX is not supported"
  3. #endif
  4. #include <altivec.h>
  5. typedef __vector float fv4sf_t;
  6. typedef __vector unsigned char vec_t;
  7. int main(void)
  8. {
  9. __vector_quad acc0;
  10. float a[4] = {0,1,2,3};
  11. float b[4] = {0,1,2,3};
  12. vec_t *va = (vec_t *) a;
  13. vec_t *vb = (vec_t *) b;
  14. __builtin_mma_xvf32ger(&acc0, va[0], vb[0]);
  15. fv4sf_t result[4];
  16. __builtin_mma_disassemble_acc((void *)result, &acc0);
  17. fv4sf_t c0 = result[0];
  18. return (int)((float*)&c0)[0];
  19. }