This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembly ADD with vector

I'm just learning assembly code, trying to do the following, but it doesn't work. Why? Thanks.

register uint32 c[] = { 0, 0, 0, 0 };
register uint32 a[] = { 2, 5, 7, 9 };
register uint32 b[] = { 3, 3, 4, 5 };
__asm__ __volatile__(
"ADD %0.2d, %1.2d, %2.2d;"
: "=w" (c) // output
: "w" (a) // input
, "w" (b) // input
);
for(auto i = 0; i < (sizeof(c)/sizeof(c[0])); ++i)
{
    printf("%s a(%d) + b(%d) = c(%d)\n", __FUNCTION__, a[i], b[i], c[i]); //TODO: remove all printf's
}

Parents
  • Hello, what are you expecting?

    I made an example file based on your source. and got the following error, which is due to the 'register' qualifier, forcing the arrays to be stored in internal registers.

    > error: address of register variable requested

    Regards, Ronan

Reply
  • Hello, what are you expecting?

    I made an example file based on your source. and got the following error, which is due to the 'register' qualifier, forcing the arrays to be stored in internal registers.

    > error: address of register variable requested

    Regards, Ronan

Children
No data