1 2 | [root@localhost test]# cp spu/test_spu.c spu/test_spu.c.bak [root@localhost test]# vi spu/test_spu.c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | [root@localhost test]# more spu/test_spu.c #include <stdio.h> int c[4] __attribute__ ((aligned (128))); int main() { vector signed int a = {120, 230, 580, 970}; vector float b = {1.8, 1.98, 0.68, 0.7}; vector signed int cVec; vector float tmp; int i = 0; tmp = spu_convtf( a, 0 ); tmp = spu_mul( tmp, b ); cVec = spu_convts( tmp, 0 ); *(vector signed int *)c = cVec; for( i = 0; i < 4; i ++ ) { printf("c[%d] = %d\n", i, c); } return 0; } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |