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