1

Is it possible to use C/C++ SIMD instructions in a program and run it on a raspberry pi model b+ ?

The raspberry pi has an arm processor, and there's a C/C++ SIMD instructions set for the ARM architecture, but can one use these SIMD instructions in any arm processor (including that of the raspberry pi model b+)?


In order to test whether the raspberry pi model b+ supports SIMD instructions, I tried to execute a program containing an SIMD intrinsic:

#include <stdio.h>

unsigned int add_halfwords(unsigned int val1, unsigned int val2)
{
 unsigned int res;
 res = __qadd16(val1,val2);
 return res;
}
int main()
{
printf("%f\n",add_halfwords(2014,1)); 
return 0;
}

I used the function add_halfwords() from the infocenter.arm.com website. However I got a compilation error from gcc:

simd_test1.o: In function `add_halfwords':
simd_test1.c:(.text+0x1c): undefined reference to `__qadd16'
collect2: ld returned 1 exit status

From what I experienced on the intel architecture, each SIMD instruction requires the inclusion of its relative library. I looked for the library which contains the definition of __qadd16() but I was enable to find any useful hint. Has anyone any idea?

3
  • Why not just try? I can't see much point on a single processor unit such as the Pi. If you don't have a Pi could you post some code (plus instructions) and I'm sure someone will compile and run it for you.
    – joan
    Dec 12 '14 at 9:11
  • Thank you joan for your comment. Indeed, I have to try to run some simd instructions on my pi. Is there another way to know whether a processor supports simd instructions?
    – S.E.K.
    Dec 12 '14 at 11:15
  • Google? I know nothing about SIMD but Google suggests it is first supported in the ARMv7 instruction set. The Pi uses the ARMv6 instruction set.
    – joan
    Dec 12 '14 at 11:22
0

ARM's own site refers to SIMD functionality for armv6, which is the instruction set for the pi's processor.

It also claims if the platform doesn't support something, you should get a compiler error if you try. I don't use asm, but this makes sense.

So there should not be any ambiguity. If you confirm this one way or another for yourself, please come back and provide a better answer to your question!

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .