-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I'm developing a bare-metal firmware on BF537(Surveyor SVS board). I don't have the time to learn assembly for blackfin, fortunately I saw SIMD i spossible with plain C. So 1- Does the compiler automatically use SIMD features if I do some loop unrolling like: instead of for(i=0;i<N;i++) c[i]=a[i]+b[i]; this: for(i=0;i<N;i+=2) { c[i]=a[i]+b[i]; c[i+1]=a[i+1]+b[i+1]; } 2- I saw some gcc built-in constructs like "__attribute__ ((mode(V2HI)))" to pack data for SIMD operations. I think this is two short integers packed. Is there a list of such attributes? Do I really need to use them? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyYlAsACgkQyjWa9oynuqDN1ACfQKFjHVT5HTaYDoLxoexUhADQ 6XAAn1h8ZAEjxDfgURXjoGCr91uvHtYo =/OjB -----END PGP SIGNATURE-----
SIMD with blackfin-gcc
Started by ●September 21, 2010
Reply by ●September 21, 20102010-09-21
Op Tue, 21 Sep 2010 13:16:29 +0200 schreef Atilla <atilla@stack+rest+is+junk+junk.nl>:> I'm developing a bare-metal firmware on BF537(Surveyor SVS board). I > don't have > the time to learn assembly for blackfin, fortunately I saw SIMD i > spossible with plain C. So > > 1- Does the compilerWhich compiler?> automatically use SIMD features if I do some loop unrolling like: > instead of > > for(i=0;i<N;i++) > c[i]=a[i]+b[i]; > > this: > for(i=0;i<N;i+=2) > { > c[i]=a[i]+b[i]; > c[i+1]=a[i+1]+b[i+1]; > }Most compilers can perform loop unrolling themselves.> 2- I saw some gcc built-in constructs like "__attribute__ > ((mode(V2HI)))" to pack data for SIMD operations. > I think this is two short integers packed. Is > there a list of such attributes?http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html 6.37.1 Blackfin Variable Attributes Your attribute is not on the list, so that attribute is either not a GCC attribute and/or your compiler is not standard GCC.> Do I really need to use them?It depends what they really do. -- Gemaakt met Opera's revolutionaire e-mailprogramma: http://www.opera.com/mail/ (remove the obvious prefix to reply by mail)
Reply by ●September 21, 20102010-09-21
Atilla wrote:> I'm developing a bare-metal firmware on BF537(Surveyor SVS board). I don't have > the time to learn assembly for blackfin,Too bad. You will have to learn assembler for BlackFin even if you don't have time for it.> fortunately I saw SIMD i spossible with plain C. So > > 1- Does the compiler automatically use SIMD featuresNo. Unless you use built-ins. Even if you do so, it does miserable job. Vladimir Vassilevsky DSP and Mixed Signal Design Consultant http://www.abvolt.com
Reply by ●September 21, 20102010-09-21
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 09/21/2010 02:50 PM, Boudewijn Dijkstra wrote:> Which compiler?$ bfin-elf-gcc --version bfin-elf-gcc (GCC) 4.1.2 (ADI svn) $ bfin-elf-gcc -v Using built-in specs. Target: bfin-elf Configured with: /usr/src/packages/BUILD/blackfin-toolchain-09r1/../gcc-4.1/configure - --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=bfin-elf - --prefix=/opt/uClinux/bfin-elf --with-newlib --disable-libstdcxx-pch - --enable-languages=c,c++ --disable-symvers --disable-libssp --disable-libffi - --enable-clocale=generic --enable-version-specific-runtime-libs - --enable-__cxa_atexit - --with-bugurl=URL:http://blackfin.uclinux.org/gf/project/toolchain/tracker - --with-pkgversion=ADI-09r1-10 Thread model: single gcc version 4.1.2 (ADI svn)> Most compilers can perform loop unrolling themselves.thanks> http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html > 6.37.1 Blackfin Variable Attributes > > Your attribute is not on the list, so that attribute is either not a GCC > attribute and/or your compiler is not standard GCC.It is standard gcc for blackfin. For some reason that list does not include packing attributes. See http://ds9a.nl/gcc-simd/example.html for x86 packing. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkyYtrcACgkQyjWa9oynuqDw9gCfSsjgGQ4whDWM6IPf4IC09SIq gGUAoKWS7KyMWpTlASY17WmMwcsIOwzX =HnSI -----END PGP SIGNATURE-----