assembly on Rpi 2
Posted: Sat Mar 05, 2016 4:58 pm
Hi,
I have been studying how to program in assembly on the Rpi-2. I use raspbian wheezy, and gcc-4.9
I compile the following:
with:
Thank you.
I have been studying how to program in assembly on the Rpi-2. I use raspbian wheezy, and gcc-4.9
I compile the following:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <sys/time.h>
static float asm_sqrt(float x)
{
float y;
asm ("flds s0, %[va2]\n\t"
"FSQRTS s16, s0"
"fsts s16, %[va3]\n\t" : [va3]"=m"(y) : [va2]"m"(x) : "s0" , "s16");
return y;
}
int main()
{
float x , y;
struct timeval time1;
gettimeofday(&time1 , 0);
srand(time1.tv_sec * 1000000 + time1.tv_usec);
x = (float)rand() / (float)RAND_MAX;
y = asm_sqrt(x);
printf("%f -> %f\n" , x , y);
return 0;
}and I get:gcc-4.9 -O3 -lm sqrt_asm_test.c
What's wrong? Please advise....
Error: VFP single precision register expected -- 'fsqrts s16, s0fsts s16,[sp,#12]'
Thank you.